Tempesto
Member
Now I made a lot of metatable changes but its still not working, here's the script:
I'm getting these errors:
Some code you need to look at to help me probably is on my pastebin:
You can jump to the different 4 scripts at ctrl + f and type in "455555555" find next etc
4 luas - Pastebin.com
I gather that those files are relevant because I see a lot of pull-code from those files
Npcsystem.lua , npchandler.lua , modules.lua, keywordhandler.lua
Could someone help me please ?
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
if(msgcontains(msg, 'prestige')) then
selfSay('Are you ready to prestige and start a new life?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 717217
local cost = 0
------/CONFIGS-------
-----LOCALS-----
local id = player:getGuid()
local name = player:getName()
local vocation = player:getVocation()
local storage = player:getStorageValue(85987)
local Max_Rebirth = 10000 --Change this for the number of rebirths
----/LOCALS-----
if(player:getLevel() >= level) then
if player:getStorageValue(85987) < Max_Rebirth then
if(player:removeMoney(cost) == TRUE) then
if(isInArray({5, 6, 7, 8}, vocation)) then
player:setStorageValue(85987, storage == -1 and 1 or storage + 1)
db.executeQuery('UPDATE players SET rebirths=rebirths+'.. 1 ..' WHERE id='..player:getGuid())
doBroadcastMessage("" .. name .. " has just prestiged!", TALKTYPE_ORANGE_1)
player:remove()
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
else
selfSay('Please talk with Forgotten King and promote first.', cid)
talkState[talkUser] = 0
end
else
selfSay('You don\'t have enough money. You need to pay 0 mil to be rebirthed.', cid)
talkState[talkUser] = 0
end
else
selfSay('You have reached the maximum rebirth.', cid)
talkState[talkUser] = 0
end
else
selfSay('Only characters of level 717217 or higher can be rebirthed.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Okey. Come back when you feel ready.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I'm getting these errors:
Code:
Lua Script Error: [Npc interface]
data/npcs/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:27: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function ' __index'
data/npc/scripts/Prestiger.lua:27: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:411: in function <data/npcs/scripts/Prestiger.lua:8>
Lua Script Error: [Npc interface]
data/npc/scripts/Prestiger.lua:onCreatureSay
data/npc/scripts/Prestiger.lua:27: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
data/npc/scripts/Prestiger.lua:27 in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
data/npc/scripts/Prestiger.lua:8: in function <data/npc/scripts/Prestiger.lua:8>
Some code you need to look at to help me probably is on my pastebin:
You can jump to the different 4 scripts at ctrl + f and type in "455555555" find next etc
4 luas - Pastebin.com
I gather that those files are relevant because I see a lot of pull-code from those files
Npcsystem.lua , npchandler.lua , modules.lua, keywordhandler.lua
Could someone help me please ?