Nesse sisteminha eu e meu amigo conseguimos
fazer um npc que teleporta para algum lugar
casoo jogador possua a storage !
Data/Script/npc.lua
local price = 50 local config = { pos1 = {x=2061,y=2140,z=10}, pos2 = {x=2061,y=2144,z=10}, } 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 if(msgcontains(msg, 'travel')) then if getPlayerStorageValue(cid, 13595) - os.time() <= 0 then selfSay('Desculpa, você não tem acesso a area.',cid) return TRUE end talkState[talkUser] = 1 selfSay("Bem-vindo!", cid) doTeleportThing(cid, config.pos1) elseif (msgcontains(msg, 'travel')) and talkState[talkUser] == 1 then if doPlayerRemoveMoney(cid, price)==true then doTeleportThing(cid, config.pos1) else return selfSay('Você não tem dinheiro para se teleportar.',cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Data/npc.xml
<?xml version="1.0"?> <npc name="Bastown" script="data/npc/scripts/npc" access="3" lookdir="1"> <health now="1" max="1"/> <look type="57" head="20" body="30" legs="40" feet="50" corpse="3128"/> </npc>
Obs: Deve ter muita coisa desnecessaria na scrip (eu acho),
não entendemos mto de script, mais ta ai o resultado.
@Atualização
Conversation Log:
Hi
Travel
"Se tiver storage irá teleportar e falar bem-vindo"
"Se falar travel e não tiver storagedará acesso negado."
Creditos:
Harpia look / 60%
Esaus / 40%