Makin
New Member
- Joined
- Sep 17, 2018
- Messages
- 37
- Solutions
- 1
- Reaction score
- 2
Hi, what is the function for npc not to teleport a player when he has pz
im use tfs 1.2
im use tfs 1.2
Lua:
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 player = Player(cid)
local pos = Position(132, 610, 7)
if(msgcontains(msg, "yes")) then
if getPlayerStorageValue(cid,8000) == -1 then
if player:teleportTo(pos) then
npcHandler:say('', cid)
setPlayerStorageValue(cid,8000,-1)
player:teleportTo(pos)
else
npcHandler:say("Sorry You Cant Do this saga", cid)
end
else
npcHandler:say("You already did it! Don't waste my time.", cid)
end
elseif(talkState[talkUser] == 1) then
npcHandler:say("", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, 'Can you help me?')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())