• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua isPzLocked npc

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

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())
 
Hi, what is the function for npc not to teleport a player when he has pz
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 or you are pz locked", 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())
Lua:
if player:isPzLocked()

use this
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 not player:isPzLocked() then
    player:teleportTo(pos)
    npcHandler:say('', cid)
    setPlayerStorageValue(cid,8000,-1)
    player:teleportTo(pos)
else
("Sorry You Cant Do this saga or you are pz locked", 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())
 
Last edited:
Back
Top