nick1995 Posted June 9, 2012 Share Posted June 9, 2012 Is there a resource that save your weapons if you died? Link to comment
Smart. Posted June 9, 2012 Share Posted June 9, 2012 This saves some basic information, such as position, weapons and some more. *You have to be registered and logged in else it won't save. https://community.multitheftauto.com/ind ... ils&id=732 Link to comment
nick1995 Posted June 9, 2012 Author Share Posted June 9, 2012 Thanks, but i have try that already... It doesn't save if you died... Link to comment
Wei Posted June 11, 2012 Share Posted June 11, 2012 You could search at forum before asking Sample... https://forum.multitheftauto.com/viewtopic.php?f=91&t=41780&p=424047&hilit=getPedTotalAmmo+setAccountData#p424047 Link to comment
nick1995 Posted June 12, 2012 Author Share Posted June 12, 2012 And if you read my topic... I am searching for weapon save if you died.... Link to comment
Wei Posted June 12, 2012 Share Posted June 12, 2012 local tempData = { } addEventHandler ( "onPlayerWasted", getRootElement(), function ( ) tempData [ source ] = { weapons = getWeaponsTable ( source ), skin = getElementModel ( source ) } end ) addEventHandler ( "onPlayerSpawn", getRootElement(), function ( ) if ( tempData [ source ] ) then setElementModel ( source, tempData [ source ].skin ) for weapon, ammo in pairs ( tempData [ source ].weapons ) do giveWeapon ( source, weapon, ammo, true ) end end end ) function getWeaponsTable ( thePlayer ) local weapons = { } local hasAnyWeapon = false for slot = 0, 12 do local weapon = getPedWeapon ( thePlayer, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( thePlayer, slot ) if ( ammo > 0 ) then weapons [ weapon ] = ammo hasAnyWeapon = true end end end if ( hasAnyWeapon ) then return weapons end end Here you have 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