bosslorenz Posted May 1, 2015 Share Posted May 1, 2015 Does anyone know the script for save weapon per account? Link to comment
WhoAmI Posted May 1, 2015 Share Posted May 1, 2015 function saveWeapons ( ) local account = getPlayerAccount ( source ); if ( isGuestAccount ( account ) ) then return; end local t = { } for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ); if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ); if ( ammo > 0 ) then t [ weapon ] = ammo; end end end setAccountData ( account, "weapons", t ); end function loadWeapons ( _, account ) if ( isGuestAccount ( account ) ) then return; end local t = getAccountData ( account, "weapons" ); if ( t ) then for weapon, ammo in pairs ( t ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ); end end end addEventHandler ( "onPlayerQuit", root, saveWeapons ); addEventHandler ( "onPlayerLogout", root, saveWeapons ); addEventHandler ( "onPlayerLogin", root, loadWeapons ); Link to comment
bosslorenz Posted May 1, 2015 Author Share Posted May 1, 2015 Both are not working tho Link to comment
WhoAmI Posted May 1, 2015 Share Posted May 1, 2015 Errors in debug? Are you putting them s-side? Link to comment
bosslorenz Posted May 1, 2015 Author Share Posted May 1, 2015 Thanks for your helps. I`ve found other solution . https://forum.multitheftauto.com/viewtop ... 08&t=27611 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