Hi guys, i have a problem comparing getPlayerMoney() with price, if i dont use tonumber(price) the error is 'attemp to compare string with number' and if i use tonumber(price) then the error is 'attemp to compare nil with number'. This problem is only comparing, if I do not use the condition server-side gives me the weapon.
function onBuyWeapon()
local itemSelected= guiGridListGetSelectedItem(list)
if itemSelected ~= -1 then
local weaponName = guiGridListGetItemText (list,itemSelected,column_arma)
local ammo = guiGridListGetItemText(list,itemSelected,column_balas)
local price = guiGridListGetItemText(list,itemSelected,column_precio)
if getPlayerMoney() >= price then
triggerServerEvent("onBuyWeapon",getLocalPlayer(),weaponName,ammo,price)
end
end
end