Best-Killer Posted December 17, 2015 Share Posted December 17, 2015 bad argument @ 'getaccountdata' expected account at argumen 1 got nill bad argument @ 'getPlayerAccount' expected element at argumen 1 got nill code : function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerstats = getPedStat ( localPlayer ) setAccountData ( playeraccount, "save-stats", playerstats ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) local playerAccount = getPlayerAccount(localPlayer) if ( playeraccount ) then local stats = getAccountData ( account, "save-stats" ) if ( stats ) then setPedStat ( localPlayer, stats ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
1LoL1 Posted December 17, 2015 Share Posted December 17, 2015 bad argument @ 'getaccountdata' expected account at argumen 1 got nill bad argument @ 'getPlayerAccount' expected element at argumen 1 got nill code : function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerstats = getPedStat ( localPlayer ) setAccountData ( playeraccount, "save-stats", playerstats ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) local playerAccount = getPlayerAccount(localPlayer) if ( playeraccount ) then local stats = getAccountData ( account, "save-stats" ) if ( stats ) then setPedStat ( localPlayer, stats ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) function onPlayerQuit () local playeraccount = getPlayerAccount(source) if (playeraccount) and not isGuestAccount (playeraccount) then local playerstats = getPedStat (source) setAccountData (playeraccount, "save-stats", playerstats) -- save it in his account end end function onPlayerLogin (_, playeraccount) local playerAccount = getPlayerAccount(source) if (playeraccount) then local stats = getAccountData (playerAccount, "save-stats") if (stats) then setPedStat(source, stats) end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) localPlayer in server-side? Link to comment
Best-Killer Posted December 17, 2015 Author Share Posted December 17, 2015 your code 0 errors but stats not saved that full code : data={}; function onStart() for i=0,9 do data[i] = {}; end data[0].weapon="Sniper" data[1].weapon="Taser" data[2].weapon="Pistol" data[3].weapon="MP5" data[4].weapon="Deagle" data[5].weapon="Ak-47" data[6].weapon="M4" data[7].weapon="Uzi/TEC-9" data[8].weapon="Sawn-Off" data[9].weapon="ShotGun" data[0].ammo=6000 data[1].ammo=2500 data[2].ammo=3000 data[3].ammo=3500 data[4].ammo=4500 data[5].ammo=4500 data[6].ammo=5000 data[7].ammo=5000 data[8].ammo=5500 data[9].ammo=5500 data[0].id=79 data[1].id=70 data[2].id=69 data[3].id=76 data[4].id=71 data[5].id=77 data[6].id=78 data[7].id=75 data[8].id=73 data[9].id=72 end addEvent("skill:inc",true) guimarker = createMarker ( 840.81, 859.91, 13.04, "cylinder", 1.5, 255, 255, 0, 90 ) listing = createBlipAttachedTo(guimarker,8) function showSkillsgui ( uPlayer ) onStart(); triggerClientEvent ( uPlayer, "openGView", root ) end addEventHandler ( "onMarkerHit", guimarker, showSkillsgui ) function incSkill( player ,ik) stats = { [data[ik].id] = 1000; } if getPlayerMoney(player) >= data[ik].ammo then for stat,value in pairs(stats) do setPedStat(player, stat, value) end takePlayerMoney(player,data[ik].ammo) outputChatBox("success"); else outputChatBox("not enough money",player) end end addEventHandler ( "skill:inc", root, incSkill ) function onPlayerQuit () local account = getPlayerAccount(source) if (playeraccount) and not isGuestAccount (playeraccount) then local playerstats = getPedStat (source) setAccountData (playeraccount, "save-stats", playerstats) -- save it in his account end end function onPlayerLogin (_, playeraccount ) local playerAccount = getPlayerAccount(source) if (playeraccount) then local stats = getAccountData (playerAccount, "save-stats" ) if (stats) then setPedStat(source, stats ) end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) pls help me Link to comment
Best-Killer Posted December 17, 2015 Author Share Posted December 17, 2015 Guys Please help i need it urgent Link to comment
iPrestege Posted December 17, 2015 Share Posted December 17, 2015 function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerstats = getPedStat ( source ) setAccountData ( playeraccount, "save-stats", playerstats ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local stats = getAccountData ( playeraccount, "save-stats" ) if ( stats ) then setPedStat ( source, stats ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Best-Killer Posted December 17, 2015 Author Share Posted December 17, 2015 Thanks But It's Sloved 3 minute ago hhh But Thanks 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