Jump to content

[SOLVED] huh.lua:7 attempt to compare number with boolean


Brolis

Recommended Posts

ERROR: god\huh.lua:7: attempt to compare number with boolean

  
addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local idiotkills = getAccountData(account,"Zombie kills") 
if (idiotkills >= 0) and (idiotkills <= 4) then 
setAccountData ( account, "Lolid", "Asshol" ) 
elseif (idiotkills >= 5) and (idiotkills <= 29) then 
setAccountData ( account, "Lolid", "Moran" ) 
elseif (idiotkills >= 30) and (idiotkills <= 79) then 
  
end 
end 
) 
) 
) 

Edited by Guest
Link to comment

The data you want to retrieve from the database to compare with "zombiekills" value shouldn't be false. To avoid it you have to set it once in your script. You can do it like this:

addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local idiotkills = getAccountData(account,"Zombie kills") 
    if not idiotkills then 
    setAccountData(account,"Zombie kills",0) 
    idiotkills = 0 
    end 
if (idiotkills >= 0) and (zombiekills <= 4) then 
setAccountData ( account, "Lygis", "Asshol" ) 
elseif (idiotkills >= 5) and (idiotkills <= 29) then 
setAccountData ( account, "Lygis", "Moran" ) 
elseif (idiotkills >= 30) and (idiotkills <= 79) then 
  
end 
end 
) 
) 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...