• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Rebirth Bugg

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,268
Solutions
5
Reaction score
188
Location
Sweden
Hello guys, can anyone explain or solve this error for me?

Error:
Code:
[14/8/2013 22:43:40] [Error - NpcScript Interface] 
[14/8/2013 22:43:40] data/npc/scripts/rebirth.lua:onCreatureSay
[14/8/2013 22:43:40] Description: 
[14/8/2013 22:43:40] data/npc/scripts/rebirth.lua:29: attempt to concatenate global 'rebs' (a nil value)
[14/8/2013 22:43:40] stack traceback:
[14/8/2013 22:43:40]     data/npc/scripts/rebirth.lua:29: in function 'callback'
[14/8/2013 22:43:40]     data/npc/lib/npcsystem/npchandler.lua:403: in function 'onCreatureSay'
[14/8/2013 22:43:40]     data/npc/scripts/rebirth.lua:12: in function <data/npc/scripts/rebirth.lua:12>

Script:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
local level = 715000
local cost = 0
 
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
    elseif msgcontains(msg, 'prestige') then
        selfSay('Are you ready to start a new life?', cid)
        t[cid] = 1
    elseif t[cid] == 1 then
        npcHandler:releaseFocus(cid)
        t[cid] = nil
        if msgcontains(msg, 'yes') then
            if getPlayerLevel(cid) >= level then
                if doPlayerRemoveMoney(cid, cost) then
                        doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, 200)) + 1)
                        local q = "UPDATE players SET level=8,experience=98800 WHERE id="..getPlayerGUID(cid)
                        local r = "UPDATE `players` SET `Rebirths` = `Rebirths` + " .. rebs .. " WHERE id=" .. getPlayerGUID(cid)
                        npcHandler:releaseFocus(cid)
                        doRemoveCreature(cid)
                        db.executeQuery(q)
                        db.executeQuery(r)
                    else
                        selfSay('You don\'t have enough money. You need to pay ' .. cost .. ' coins to be rebirthed.', cid)
                    end
                else
                    selfSay('Only characters of level ' .. level .. ' or higher can be prestiged.', cid)
                end
            else
                selfSay('Okay, come back when you are ready.', cid)
            end
        end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Undeclared variable
Code:
local r = "UPDATE `players` SET `Rebirths` = `Rebirths` + [COLOR=#ff0000]" .. rebs .. "[/COLOR] WHERE id=" .. getPlayerGUID(cid)

Just put something like this above that line,
Code:
 local rebs = 1

- - - EDITED - - -
Please keep in mind that issues like this should be posted in Support. :p
 
Undeclared variable
Code:
local r = "UPDATE `players` SET `Rebirths` = `Rebirths` + [COLOR=#ff0000]" .. rebs .. "[/COLOR] WHERE id=" .. getPlayerGUID(cid)

Just put something like this above that line,
Code:
 local rebs = 1

- - - EDITED - - -
Please keep in mind that issues like this should be posted in Support. :p

Thanks alot!, will keep that in mind for the next time! :)
 
Back
Top