SkatCh Posted September 11, 2014 Share Posted September 11, 2014 guys please i need some help here i create save system for guns but i have small problem here , addEventHandler ( "onPlayerSpawn", root, function () local theAccount = getPlayerAccount ( source ); -- weapons local weapon0 = getAccountData ( theAccount, "weapons.weapon0" ); -- ammo local ammo0 = getAccountData ( theAccount, "weapons.ammo0" ); -- give the weapons if ( weapon0 > 0 ) then giveWeapon ( source, weapon0, ammo0 ); end ----- this line ); the script is working fine but this weapon Fist 0 , when a new player join the server i got this error ; attempt to compare number with boolean . Link to comment
Anubhav Posted September 11, 2014 Share Posted September 11, 2014 Are you sure you have set the account data? Link to comment
SkatCh Posted September 11, 2014 Author Share Posted September 11, 2014 ofc i add it all weapons working fine but simple Note ; just new members when they join i got this error . Link to comment
Anubhav Posted September 11, 2014 Share Posted September 11, 2014 So check if the value exist by a if statment. Link to comment
SkatCh Posted September 11, 2014 Author Share Posted September 11, 2014 ?? i don't undrestand. Link to comment
Anubhav Posted September 11, 2014 Share Posted September 11, 2014 addEventHandler ( "onPlayerSpawn", root, function () local theAccount = getPlayerAccount ( source ); -- weapons local weapon0 = getAccountData ( theAccount, "weapons.weapon0" ); -- ammo local ammo0 = getAccountData ( theAccount, "weapons.ammo0" ); if weapon0 == false or ammo0 == false then return end -- give the weapons if ( weapon0 > 0 ) then giveWeapon ( source, weapon0, ammo0 ); end ----- this line ); Link to comment
darhal Posted September 12, 2014 Share Posted September 12, 2014 Fist id is 0 so u will edit this if weapom0 >= 0 then -- code end also u should set the account data of fist id 0 Link to comment
darhal Posted September 12, 2014 Share Posted September 12, 2014 Edit !!!!!!!! [LUA] if weapon0 >= 0 then -- some code [\LUA] Link to comment
Saml1er Posted September 12, 2014 Share Posted September 12, 2014 addEventHandler ( "onPlayerSpawn", root, function () local theAccount = getPlayerAccount ( source ); -- weapon if not theAccount then return end local weapon0 = tonumber (getAccountData ( theAccount, "weapons.weapon0" ) ) or 0 -- ammo local ammo0 = tonumber (getAccountData ( theAccount, "weapons.ammo0" ) ) or 0 if not weapon0 or not ammo0 then return end[code][/code] -- give the weapons if ( weapon0 > 0 ) then giveWeapon ( source, weapon0, ammo0 ); end end ); 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