SkatCh Posted June 30, 2014 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 ] Failure is simply an opportunity to begin again more intelligently - Henry Ford
Et-win Posted June 30, 2014 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? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
AshFTW Posted July 1, 2014 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
SkatCh Posted July 1, 2014 Author Posted July 1, 2014 lol i already fixed it . topic can be closed Failure is simply an opportunity to begin again more intelligently - Henry Ford
Et-win Posted July 1, 2014 Posted July 1, 2014 lol i already fixed it . topic can be closed You could have say that... ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
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