SkatCh Posted June 30, 2014 Share Posted June 30, 2014 guys please i need some help how can i fix this i create a medkits system but i have a problem when i try to save player medkits . function getPlayerMedKits(player) local medKits = tonumber(getAccountData(player, "medKits")) or 0 return medKits end function setPlayerMedKits(player, amount) setAccountData(player, "medKits", tostring(amount)) getPlayerAccount(player, "medKits", tostring(amount)) triggerClientEvent(player, "onMedKitLoad", player, amount) return true end warnings : -Bad argument @ 'getAccountData' [Expected account at argument 1, got player ] -Bad argument @ 'setAccountData' [Expected account at argument 1, got player ] Link to comment
Et-win Posted June 30, 2014 Share Posted June 30, 2014 local medKits = tonumber(getAccountData(getPlayerAccount(player), "medKits")) or 0 EDIT: May I ask why you are getting the account with 'getPlayerAccount' in the second function without doing anything with it? Or is it an other function in the script? Link to comment
AshFTW Posted July 1, 2014 Share Posted July 1, 2014 Try, it will be works perfectly: function getPlayerMedKits(player) local account = getPlayerAccount(player) if not account then outputChatBox("Player not logged in!") return 0 end local medKits = getAccountData(account, "medKits") or 0 return medKits end function setPlayerMedKits(player, amount) local account = getPlayerAccount(player) if not account then outputChatBox("Player not logged in!") return false end setAccountData(account, "medKits", tonumber(amount)) --WTF? getPlayerAccount(player, "medKits", tonumber(amount)) triggerClientEvent(player, "onMedKitLoad", player, tonumber(amount)) return true end Link to comment
SkatCh Posted July 1, 2014 Author Share Posted July 1, 2014 lol i already fixed it . topic can be closed Link to comment
Et-win Posted July 1, 2014 Share Posted July 1, 2014 lol i already fixed it . topic can be closed You could have say that... 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