esse system está incompleto,está faltando a parte da storage.
vá em servidor/data/creatureevent e crie um arquivo chamado "Monster Hunter.lua" depois disso copie o código abaixo e cole no arquivo e salve.
function onKill(cid, target, lastHit)
if isPlayer(cid) and isMonster(target) then
if isPlayer(getCreatureMaster(target)) then
return true
end
local name = getGlobalStorageValue(90904488)
if tostring(string.lower(getCreatureName(target))) == tostring(string.lower(name)) then
doPlayerSetStorageValue(cid, 90904487, getPlayerStorageValue(cid, 90904487) + 1)
doPlayerSendTextMessage(cid, 19, "[Evento: Mate o Pokémon] Voce ja matou "..getPlayerStorageValue(cid, 90904487).." "..name.."s! Continue matando para ser o vencedor!")
else
-- print('target: '..string.lower(getCreatureName(target))..'')
-- print('name: '..string.lower(name)..'')
end
end
return true
end
function onLogin(cid)
if getGlobalStorageValue(90904488) == 0 then
doPlayerSetStorageValue(cid, 90904487, 0)
end
registerCreatureEvent(cid, "MonsterHunter")
return true
end
Agora em CreatureEvent.xml e adicione a tag
<event type="kill" name="Monster Hunter" event="script" value="Monster Hunter.lua"/>
<event type="login" name="Monster Hunterl" event="script" value="Monster Hunter.lua"/>




info
Grupo: Campones
Registrado: 04/03/19
Posts: 11
Reputação: +5
Opa boa tarde galera, hoje venho trazer a vocês o sistema de evento igual ao do OtPokemon, no qual se define um horario, e sorteia um pokemon para voce matar, quem matar mais pokemons ganha o evento.
OBS: Pokemons na tabela podem ser alterados, e os premios também, vamos la.
Vá em data/globalevents e crie um arquivo lua com nome Monster Hunter.lua/ depois disso copie o código abaixo e cole no arquivo e salve.
local monsters = { "Rattata","Caterpie","Metapod","Raticate","Charmander","Charmeleon","Butterfree","Beautifly","Squirtle","Wartortle","Poliwag","Cubone","Marowak","Diglett","Dugtrio","Sandshrew","Mareep","Beedril","Magnemite","Pikachu","Voltorb","Electrode","Elekid","Gastly","Haunter","Geodude","Machoke","Graveler","Pidgey","Pidgeotto","Weepinbell","Oddish","Gloom","Golbat","Zubat","Drowzee","Abra","Machop","Spearow","Nidoran Female","Nidoran Male","Nidorino","Nidorina","Bulbasaur","Ivysaur","Weedle","Kakuna","Eevee"} -- Monstros que podem ser sorteados local time_min, max = 10, 30 -- Em minutos local premios, gold = {{9020, 1}, {2152, 25}}, 10000 -- {id do item, quantidade} que o jogador ganha e quantia de gold function winMonsterEvent() local max_sto, winner = 0, 0 local monster = getGlobalStorageValue(90904488) for _, pid in pairs(getPlayersOnline()) do local sto = getPlayerStorageValue(pid, 90904487) if sto > max_sto then max_sto = sto winner = pid end end if isPlayer(winner) then local artigo = getPlayerSex(winner) == 0 and "[Derrote o Pokémon]: A jogadora" or "[Derrote o Pokémon]: O jogador" doBroadcastMessage(artigo.." "..getCreatureName(winner).." derrotou "..getPlayerStorageValue(winner, 90904487).." "..monster.."s e venceu o evento. Parabéns!",25) for _, prize in pairs(premios) do doPlayerAddItem(winner, prize[1], prize[2]) end doPlayerAddMoney(winner, gold) else doBroadcastMessage("[Derrote o Pokémon]: O evento terminou e não houve nenhum vencedor.") end setGlobalStorageValue(90904488, 0) end function onTimer() local random = math.random(1, #monsters) local time = math.random(time_min, max) for _, pid in pairs(getPlayersOnline()) do doPlayerSetStorageValue(pid, 90904487, 0) end setGlobalStorageValue(90904488, monsters[random]) doBroadcastMessage("[Derrote o Pokémon]: O evento começou e durará "..time.." minutos. O pokémon sorteado foi "..monsters[random].."! Quem conseguir derrotar mais "..monsters[random].."'s até o fim será o vencedor!",25) addEvent(winMonsterEvent, time*1000*60) return true endFeito isso vá em globalevents.xml e adicione essa tag.
Beleza, feito isso salve e de reload em seu servidor, que ja estara funcionando.
Perguntas:
"Ah se eu quiser por mais horarios? simples vá na tag copie ela e cole de novo, onde está "Monster Hunter Event1" time="10:00" mude para "Monster Hunter Event2" time="12:00"...lembrando sempre que voce adicionar 1 novo evento o horario também deve mudar.
É isso obrigado a todos e até mais.
Créditos:
PokeZRing (de onde foi retirado)
OTP (criador, me corrija caso esteja errado)
Eu ( por disponibilizar)