• 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!

Demotelvl error

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,268
Solutions
5
Reaction score
188
Location
Sweden
Hello, i got this sctipt not that long ago
Code:
function onSay(cid, words, param, channel)
	t = string.explode(param, ",", 2)
	pid = getPlayerByName(t[1])
	level = tonumber(t[2])
	doPlayerAddLevel(pid, -level)
	return true
end


it worked perfect then now i get this error
Code:
[24/02/2013 15:39:05] [Error - TalkAction Interface] 
[24/02/2013 15:39:05] data/talkactions/scripts/demote.lua:onSay
[24/02/2013 15:39:05] Description: 
[24/02/2013 15:39:05] data/talkactions/scripts/demote.lua:5: attempt to perform arithmetic on global 'level' (a nil value)
[24/02/2013 15:39:05] stack traceback:
[24/02/2013 15:39:05] 	data/talkactions/scripts/demote.lua:5: in function <data/talkactions/scripts/demote.lua:1>

(Made for addskill but demote insted)
 
LUA:
function onSay(cid, words, param, channel)
if (param == true) then
return true
end

t = string.explode(param,",")
t[1] = amount

if isPlayer(param) then
if t[1] >= 1 then
 doPlayerAddLevel(param, t[1])
else
 doPlayerRemoveLevel(param, t[1])
end
end
end

- - - Updated - - -

soz at school right now, Ill be able to give you a better script when I get home, If you can put a little more detail in what you want.....right now its...

!command playername, amount
 
data/talkactions/scripts/demote.lua:13: attempt to call global 'doPlayerRemoveLevel' (a nil value)
 
LUA:
function onSay(cid, words, param, channel)
if (param == true) then
return true
end
 
t = string.explode(param,",")
t[1] = amount
 
if isPlayer(param) then
if t[1] >= 1 then
 doPlayerAddLevel(cid, t[1])
else
 doPlayerAddLevel(cid, -t[1])
end
end
end
 
Back
Top