infrator123
New Member
- Joined
- Aug 10, 2011
- Messages
- 24
- Reaction score
- 2
Theres any problem using alot of differents cid variables in npcs like this? this way i think its secure to control everything in big scripts..
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local moneyPrice, destination, cityName = {}, {}, {} <<<<<<<<<<<< here
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function greet(cid)
moneyPrice[cid], destination[cid], cityName[cid] = nil, nil, nil <<<<<<<<< here
return true
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, 'somewhere')) or (msgcontains(msg, 'carlin')) then
cityName[cid] = "Somewhere" <<<<<<< here
destination[cid] = {x = 4495, y = 3627, z = 7} <<<<<<< here
selfSay("The price to travel to "..cityName[cid].." its 500 gold coins,a re you sure?", cid) <<<<< here
talkState[talkUser] = 1
moneyPrice[cid] = 500 <<<<<<< here
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local moneyPrice, destination, cityName = {}, {}, {} <<<<<<<<<<<< here
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function greet(cid)
moneyPrice[cid], destination[cid], cityName[cid] = nil, nil, nil <<<<<<<<< here
return true
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, 'somewhere')) or (msgcontains(msg, 'carlin')) then
cityName[cid] = "Somewhere" <<<<<<< here
destination[cid] = {x = 4495, y = 3627, z = 7} <<<<<<< here
selfSay("The price to travel to "..cityName[cid].." its 500 gold coins,a re you sure?", cid) <<<<< here
talkState[talkUser] = 1
moneyPrice[cid] = 500 <<<<<<< here
end
Last edited: