In this code I try to make it possible to add new data to the user, depending on certain conditions of "getElementData (source," KD "), but it says" Attempt to concatenate a boleean value. "And the data is not a boolean, it is a I do not understand the error.. It's server side.
The data( getElementData(source, "KD") ) its a number type.
I do not want to do something difficult, I just want that when I log in I set a text in a data, where I can use it in a gui on client side.
Can you help me? Thank you
function SetearDatas()
if((getElementData(source, "KD")) < 1) then
setElementData(source, "ranking", "Bronze")
--Bronce
else if(getElementData(source, "KD") >= 1 and getElementData(source, "KD") < 2.5) then
setElementData(source, "ranking", "Silver")
--Plata
else if(getElementData(source, "KD") >= 2.5 and getElementData(source, "KD") < 4) then
setElementData(source, "ranking", "Gold")
--Oro
else if(getElementData(source, "KD") >= 4 and getElementData(source, "KD") < 7) then
setElementData(source, "ranking", "Platinum")
--Platino
else if(getElementData(source, "KD") >= 7 and getElementData(source, "KD") < 10) then
setElementData(source, "ranking", "Diamond")
--Diamante
else if(getElementData(source, "KD") >= 10) then
setElementData(source, "ranking", "Master")
--Challenger
end
end
end
end
end
end
end
addEventHandler ("onPlayerLogin", getRootElement(), SetearDatas)
function statsss ()
outputChatBox("Your rank is: "..getElementData (source, "ranking"), source,0,255,0)
end
addCommandHandler ( "statinfo", statsss )