Hello guys, I get this error when I use the convertNumber method
attempt to perform arithmetic on local 'oldZcount' (a string value)
function convertNumber ( number )
local formatted = number
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if ( k==0 ) then
break
end
end
return formatted
end
--ADJUSTS PLAYERS ZOMBIE KILL SCORE
function deanimated( ammo, attacker, weapon, bodypart )
if (attacker) then
if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then
if (getElementData (source, "zombie") == true) then
-- HERE --
local oldZcount = convertNumber(getElementData ( attacker, "Zombie kills" ))
-- HERE --
if oldZcount ~= false then
setElementData ( attacker, "Zombie kills", oldZcount+1 )
triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart )
else
setElementData ( attacker, "Zombie kills", 1 )
triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart )
end
end
end
end
end
addEventHandler("onPedWasted", resourceRoot, deanimated)
any help please?