fiz rapidinho, vê se é isso que vc quer:
Mods
Saffari.xml
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Saffari" version="1.0" author="Vodkart" contact="none.com" enabled="yes">
<config name="saffari_func"><![CDATA[
config = {
Price = 2000,
Premium = false,
Level = 50,
Saffari_Pos = {Enter = {x=189,y=53,z=7}, Exit = {x=195,y=53,z=7}},
Time = 30,
AddPokeballs = {11445,30},
Blocked_pokeballs = {2146, 2147, 11437, 11441},
Storages = {874547,874548},
levelandskills = false,
loot = false
}
]]></config>
<event type="login" name="SaffariRegister" event="script"><![CDATA[
function onLogin(cid)
registerCreatureEvent(cid, "SaffariDeath")
return true
end]]></event>
<talkaction words="/saffari;!saffari" event="buffer"><![CDATA[
domodlib('saffari_func')
param = string.lower(param)
if (param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"invalid command, for more information enter !saffari info")
elseif(param == "info") then
doShowTextDialog(cid,2160,"Saffari Info:\n\nLevel Minimum: "..config.Level.."\nSaffari Cost: "..config.Price.."\nTime Limit: "..config.Time.." minutes\n\nThe safari is home to rare creatures, some are dangerous and others not\n[*Warning*]\nis only allowed to enter with saffari balls.\n\nTo leave enter command:\n!saffari leave")
elseif(param == "leave") then
if getPlayerStorageValue(cid, config.Storages[1]) >= 1 then
doTeleportThing(cid, config.Saffari_Pos.Exit)
setPlayerStorageValue(cid, config.Storages[1], -1)
setPlayerStorageValue(cid, config.Storages[2], -1)
doPlayerSendTextMessage(cid,22,'you left the saffari zone.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"you are not in Saffari")
end
end
return true
]]></talkaction>
<globalevent name="SaffariCheck" interval="60" event="script"><![CDATA[
domodlib('saffari_func')
function onThink(interval, lastExecution)
local on = getPlayersOnline()
if #on > 0 then
for i = 1, #on do
if getPlayerStorageValue(on[i], config.Storages[2]) <= os.time() and getPlayerStorageValue(on[i], config.Storages[1]) >= 1 then
doTeleportThing(on[i], config.Saffari_Pos.Exit)
setPlayerStorageValue(on[i], config.Storages[1], -1)
setPlayerStorageValue(on[i], config.Storages[2], -1)
doPlayerSendTextMessage(on[i],22,'you left the saffari zone.')
end
end
end
return true
end
]]></globalevent>
<event type="death" name="SaffariDeath" event="script"><![CDATA[
domodlib('saffari_func')
function onDeath(cid, corpse, deathList)
if isPlayer(cid) and getPlayerStorageValue(cid, config.Storages[1]) >= 1 then
setPlayerStorageValue(cid, config.Storages[1], -1)
setPlayerStorageValue(cid, config.Storages[2], -1)
if config.loot == false then doCreatureSetDropLoot(cid, false) end
if config.levelandskills == false then doPlayerSetLossSkill(cid, 0) end
end
return true
end
]]></event>
</mod>
Npc
domodlib('saffari_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
if isInArray({"saffari","enter","entrar"}, msg) then
npcHandler:say('you can stay in the Saffari zone by '..config.Time..' minutes, the price is '..config.Price..' gp(s), You want enter? {yes}', cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
for i = 1, #config.Blocked_pokeballs do
if getPlayerItemCount(cid, config.Blocked_pokeballs[i]) >= 1 then
npcHandler:say('Keep your PokeBalls!', cid) return true
end
end
if config.Premium == true and not isPremium(cid) then
npcHandler:say('Sorry, you need to be premium!', cid) return true
elseif getPlayerLevel(cid) < config.Level then
npcHandler:say('Sorry, you must be at least level '..config.Level..' to enter the Saffari zone!', cid) return true
elseif not doPlayerRemoveMoney(cid, config.Price) then
npcHandler:say('Sorry, you do not have enough money!', cid) return true
end
doPlayerAddItem(cid, config.AddPokeballs[1], config.AddPokeballs[2])
selfSay("Thanks, you've been teleported to the Saffari zone and has "..config.Time.." minutes, if you want to leave enter {!saffari leave}.", cid)
doTeleportThing(cid, config.Saffari_Pos.Enter)
setPlayerStorageValue(cid, config.Storages[1], 1)
setPlayerStorageValue(cid, config.Storages[2], os.time()+config.Time*60)
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("tudo bem então.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
configurações
config = {
Price = 2000, -- qnto vai custar
Premium = false, -- se precisa ser premium
Level = 50, -- level minimo para entrar
Saffari_Pos = {Enter = {x=189,y=53,z=7}, Exit = {x=195,y=53,z=7}}, -- pos da safari, e pos pra onde ele vai dps que acaba o tempo
Time = 30, -- tempo maximo q ele pode ficar no saffari in minutes
AddPokeballs = {11445,30}, -- id da saffari ball e quantidade
Blocked_pokeballs = {2146, 2147, 11437, 11441}, -- pokeballs q ele n pode estar na bag
Storages = {874547,874548}, -- n mexa
levelandskills = false, -- se vai perder skills e exp ao morrer
loot = false -- se vai perder loot ao morrer
}
comandos extra:
!saffari info -- mostra em uma janela sobre o preço, lvl e o tempo que pode ficar lá
!saffari leave -- faz com que o player saia da saffari zone