Wysłany: 2020-04-17, 10:42
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Witam, ot?? robi? system leveli na serwer kolegi i wszystko dzia?a lecz, gdy dodaje sobie komend? /daj.xp to wywala mi taki b??d
s_cmd.lua:360: attempt to perform arithmetic on a boolean value
Tutaj wstawiam fragment kodu:
addCommandHandler ( "daj.xp" , function( plr , cmd , cel , value )
if getAdmin ( plr , 6 ) or getAdmin ( plr , 5 ) then
if not cel or not tonumber ( value ) then
outputChatBox ( "#663300(ⓘ) #FFFFFFU?ycie: /daj.xp <nick/ID> <koszt>" , plr , 255 , 255 , 255 , true )
return
end
local target = exports [ "pystories-core" ]: findPlayer ( plr , cel )
if not target then
outputChatBox ( "#663300(✖) #FFFFFFNie znaleziono podanego gracza." , plr , 255 , 255 , 255 , true )
return
end
setElementData ( target , "xp" , getElementData ( target , "xp" ) + value )
outputChatBox ( "#663300(ⓘ) #FFFFFFOtrzyma?e?(a?) od systemu " .. value .. " PLN" , target , 255 , 255 , 255 , true )
outputChatBox ( "#663300(✔) #FFFFFFNada?e?(a?) " .. value .. " PLN dla gracza " .. getPlayerName ( target ): gsub ( "#%x%x%x%x%x%x" , "" ), plr , 255 , 255 , 255 , true )
end
end )
Prosz? o pomoc
Wysłany: 2020-04-17, 11:44
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Wska? 360 linijk?, mo?e nie masz takiej element daty?
Wysłany: 2020-04-17, 12:28
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Mam odpowiednie el. Daty, 360 linijka to:
setElementData(target, "xp", getElementData(target, "xp") + value
Wysłany: 2020-04-17, 14:54
Kuks*
Wiek: 15 Na forum: 3030 dni Posty: 246
Nick w MP: Kuks*
Piwa : 2208
local currentXp = tonumber ( getElementData ( target , "xp" )) or 0
setElementData ( target , "xp" , currentXp + tonumber ( value ))
Wysłany: 2020-04-17, 16:11
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Kuks* , Dzi?ki wielkie, dzia?a
Tagi: level
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: