tanii
Empire-war.com
- Joined
- Jan 16, 2015
- Messages
- 383
- Solutions
- 1
- Reaction score
- 12
Hello Otlanders i got this error on npc script how i can solv?
0.3.6 8.6
Error is:
Script
0.3.6 8.6
Error is:
PHP:
[23/06/2015 15:11:18] [Error - Npc interface]
[23/06/2015 15:11:18] data/npc/scripts/darkskull.lua:onCreatureSay
[23/06/2015 15:11:18] Description:
[23/06/2015 15:11:18] data/npc/scripts/darkskull.lua:19: attempt to perform arithmetic on field '?' (a nil value)
[23/06/2015 15:11:18] stack traceback:
[23/06/2015 15:11:18] data/npc/scripts/darkskull.lua:19: in function 'callback'
[23/06/2015 15:11:18] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[23/06/2015 15:11:18] data/npc/scripts/darkskull.lua:8: in function <data/npc/scripts/darkskull.lua:8>
Script
PHP:
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 erexo, sthl, sfbp = {10,50,100}, 59349, 24321
local killValue = erexo[sthl] - getPlayerStorageValue(cid, 29303)
if(msgcontains(msg, 'mission')) then
if getPlayerStorageValue(cid, sfbp) < 1 then
for i = 1, #erexo do
if getPlayerStorageValue(cid, sthl) < 1 then
setPlayerStorageValue(cid, sthl, 1)
end
if getPlayerStorageValue(cid, sthl) == i then
setPlayerStorageValue(cid, sfbp, 1)
setPlayerStorageValue(cid, 29303, 0)
selfSay('Lets see, you want a mission? Oke, kill ' .. erexo .. ' players for me', cid)
talkState[talkUser] = 0
return true
end
selfSay('I dont have more missions for you.', cid)
talkState[talkUser] = 0
end
else
selfSay('You did not complete my last mission? Go and kill ' .. killValue .. ' players more', cid)
talkState[talkUser] = 0
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())