mint3d Posted May 18, 2013 Share Posted May 18, 2013 ok i have a script but when i die is dosent save my guns or my team addEventHandler ( "onPlayerWasted", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) setPlayerTeam ( source, getTeamFromName(team) ) setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) end end end ) end Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 addEventHandler ( "onPlayerWasted", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) setPlayerTeam ( source, getTeamFromName(team) ) setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) end end end ) You had an unecessary 'end'. Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 At "onPlayerSpawn" function all of the variables aren't defined. Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 what do you mean or how to i make it get team name Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 What part you don't understand? ALL YOUR VARIABLES ARE UNDEFINED. Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 how do i define them then Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 Did you save them like you did with weapons or not? Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 oh so like setAccountData ( account, "save-team".. slot, getPedTeamName ( source, slot ) ) and local team = getAccountData ( account, "save-team".. slot ) Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 What is "slot" there for? and there's no such function: "getPedTeamName", could you please think what you are doing? Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 To get the team name use the following functions: getPlayerTeam -- Gets the team element from a player. getTeamName -- Gets the team name from a team element. Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 so like setAccountData ( account, "save-team".. , getPlayerTeam ( source ) ) Link to comment
iPrestege Posted May 18, 2013 Share Posted May 18, 2013 local team = getPlayerTeam ( source ) if ( team ) then setAccountData ( account , "save-team" , getTeamName ( team ) ) end Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 dosent work and i lost all guns and ammo Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) setPlayerTeam ( source, getTeamFromName(team) ) setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) local team = getPlayerTeam ( source ) if ( team ) then setAccountData ( account , "save-team" , getTeamName ( team ) ) end end end end ) Link to comment
iPrestege Posted May 18, 2013 Share Posted May 18, 2013 (edited) No don't put here put when the player die . Edited May 18, 2013 by Guest Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 addEventHandler ( "onPlayerWasted", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then for slot = 1, 12 do setAccountData ( account, "save-wep".. slot, getPedWeapon ( source, slot ) ) setAccountData ( account, "save-ammo".. slot, getPedTotalAmmo ( source, slot ) ) end local team = getPlayerTeam ( source ) if ( team ) then setAccountData ( account, "save-team", getTeamName ( team ) ) end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) local account = getPlayerAccount ( source ) if ( account and not isGuestAccount ( account ) ) then setElementData ( source, "Role", role ) spawnPlayer ( source, x, y, z, interior, dimension ) setElementHealth ( source, health ) setElementModel ( source, skin ) setPlayerTeam ( source, getTeamFromName(team) ) setPlayerMoney ( source, money ) setPedArmor ( source, armor ) for slot = 1, 12 do local wep = getAccountData ( account, "save-wep".. slot ) local ammo = getAccountData ( account, "save-ammo".. slot ) giveWeapon ( source, wep, ammo ) end end end ) Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 i copied above and nothing still and i lost all guns again Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 It'll only save the team, it won't load it. Link to comment
mint3d Posted May 18, 2013 Author Share Posted May 18, 2013 because my friend killed me and i didnt spawn in the same team shouldn't there be something on the onplayerspawn side 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