Snow-Man Posted January 2, 2017 Posted January 2, 2017 how to sort weapon table exactly to save it i think it's seems like this local weapons = { weapon={}, ammos={}} USC Informations Head Staff & Owner Of USC. Youtube Channel : My Channel
myonlake Posted January 2, 2017 Posted January 2, 2017 What do you mean? If I helped you, please click the like button on the right Thanks!
Miika Posted January 2, 2017 Posted January 2, 2017 Are you trying to save weapons when player quit? Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
^iiEcoo'x_) Posted January 3, 2017 Posted January 3, 2017 20 hours ago, Miika said: Are you trying to save weapons when player quit? onPlayerQuit onPlayerWasted setAccountData or executeSQLQuery - Hashemite Kingdom Of Jordan -
Snow-Man Posted January 4, 2017 Author Posted January 4, 2017 On Monday, January 02, 2017 at 11:05 PM, Miika said: Are you trying to save weapons when player quit? Yes, that's Exactly What I Mean 19 hours ago, #_iMr,[E]coo said: onPlayerQuit onPlayerWasted setAccountData or executeSQLQuery I Know Functions But I Need Help With Table USC Informations Head Staff & Owner Of USC. Youtube Channel : My Channel
myonlake Posted January 4, 2017 Posted January 4, 2017 2 hours ago, Snow-Man said: Yes, that's Exactly What I Mean I Know Functions But I Need Help With Table Use toJSON / fromJSON? If I helped you, please click the like button on the right Thanks!
Miika Posted January 4, 2017 Posted January 4, 2017 (edited) addEventHandler("onPlayerQuit", root, function() local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local t = {} for i=0, 12 do local weapon = getPedWeapon(source, i) local ammo = getPedTotalAmmo(source, i) table.insert(t, weapon..", "..ammo) end setAccountData(account, "playerweapons", toJSON(t)) end end ) addEventHandler("onPlayerLogin", root, function() local account = getPlayerAccount(source) local t = fromJSON(getAccountData(account, "playerweapons")) for i=0, 12 do local wp = split(t[i+1][1], ", ") giveWeapon(source, wp[1], wp[2], true) setAccountData(account, "playerweapons", false) end end ) Edited January 4, 2017 by Miika 1 Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Snow-Man Posted January 5, 2017 Author Posted January 5, 2017 @Miika thanks USC Informations Head Staff & Owner Of USC. Youtube Channel : My Channel
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