slotman Posted October 16, 2013 Share Posted October 16, 2013 function saveWeaponStats(player) if (not player or not isElement(player)) then return end local account = getPlayerAccount(player) if (account and not isGuestAccount(account)) then local stats = "" for stat=69, 81 do local value = getPedStat(player, stat) stats = stats ..",".. stat ..";".. value end setAccountData(account, "weaponStats", stats) end end function loadWeaponStats(player) if (not player or not isElement(player)) then return end local account = getPlayerAccount(player) if (account and not isGuestAccount(account)) then local statsData = getAccountData(account,"weaponStats") local stats = split(statsData, ",") for k, v in ipairs(stats) do local stat = split(v, ";") setPedStat(player, tonumber(stat[1]), tonumber(stat[2])) end end end addEventHandler("onPlayerQuit",root,function () saveWeaponStats(source) end) addEventHandler("onPlayerLogin",root,function () loadWeaponStats(source) end) onPlayerWasted No saveing Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 Is it working properly? You just want to add a function which saves then loads the stats when someone dies? Right? Link to comment
slotman Posted October 16, 2013 Author Share Posted October 16, 2013 yes . onPlayerWasted to save Weaponstats Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 addEventHandler("onPlayerWasted",root,function () saveWeaponStats(source) end) -- saves it when he dies addEventHandler("onPlayerSpawn",root,function () loadWeaponStats(source) end) -- loads it when he spawns Link to comment
slotman Posted October 16, 2013 Author Share Posted October 16, 2013 Thank you very much.I love you 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