Brolis Posted August 15, 2012 Share Posted August 15, 2012 (edited) 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 August 16, 2012 by Guest Link to comment
AMARANT Posted August 15, 2012 Share Posted August 15, 2012 Your account data returns false. So you're trying to compare some numbers with false. Link to comment
Brolis Posted August 15, 2012 Author Share Posted August 15, 2012 How I could fix that? Link to comment
AMARANT Posted August 15, 2012 Share Posted August 15, 2012 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
Anderl Posted August 15, 2012 Share Posted August 15, 2012 (zombiekills <= 4) zombiekills is nil. Link to comment
Brolis Posted August 16, 2012 Author Share Posted August 16, 2012 Thanks, I gess it works now fine. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now