Drakath Posted July 26, 2012 Share Posted July 26, 2012 Hello, I just want to ask is there a resource that makes you lose all weapons when you die? Link to comment
Anderl Posted July 26, 2012 Share Posted July 26, 2012 They are already removed. From wiki: "Note: Weapons are removed when a player dies by default. This means that it is only appropriate to use this function while a player is alive." To take all weapons from a player use "takeAllWeapons". Link to comment
Scripting Moderators Sarrum Posted July 26, 2012 Scripting Moderators Share Posted July 26, 2012 Standard resource 'deathpickups'. Link to comment
Drakath Posted July 26, 2012 Author Share Posted July 26, 2012 But when player die he still has his weapons how can I make them lose it? Link to comment
Castillo Posted July 26, 2012 Share Posted July 26, 2012 addEventHandler ( "onPlayerWasted", root, function ( ) takeAllWeapons ( source ) end ) Link to comment
Drakath Posted July 26, 2012 Author Share Posted July 26, 2012 Is this Client or Server side? Link to comment
Drakath Posted July 27, 2012 Author Share Posted July 27, 2012 Now when players get killed they lose weapons but if they reconnect when killed weapons are back. Link to comment
Anderl Posted July 27, 2012 Share Posted July 27, 2012 You should have something making that. It's not default in MTA:SA. Link to comment
Drakath Posted July 27, 2012 Author Share Posted July 27, 2012 I guess it is because of save system. But how can I make that people won't get their weapons back after death by reconnecting? Link to comment
scratcher911 Posted July 27, 2012 Share Posted July 27, 2012 remove it from save system ? Link to comment
Drakath Posted July 27, 2012 Author Share Posted July 27, 2012 But than weapons won't save at all. Link to comment
scratcher911 Posted July 27, 2012 Share Posted July 27, 2012 addEventHandler("onPlayerLogin", getRootElement(), function() takeAllWeapons(source) end ) Link to comment
Drakath Posted July 29, 2012 Author Share Posted July 29, 2012 But now players lose they weapon when they log in. I just don't want them to get their weapon back when they die... Link to comment
Mega9 Posted July 29, 2012 Share Posted July 29, 2012 Have you tried using a timer? Or maybe your save system gives weapons back onPlayerSpawn, in that case you should use that handler to remove weapons. Link to comment
Drakath Posted July 29, 2012 Author Share Posted July 29, 2012 No, I think its a bug if you reconnect as soon as you die your weapons get back. Link to comment
Drakath Posted July 30, 2012 Author Share Posted July 30, 2012 But yes, my save system save weapons how can I make it to don't save it after death? Link to comment
Castillo Posted July 30, 2012 Share Posted July 30, 2012 You must edit the script, post it here. Link to comment
Drakath Posted July 30, 2012 Author Share Posted July 30, 2012 function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "zmgm.money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "zmgm.money") local playerSkin = getAccountData (theCurrentAccount, "zmgm.skin") local playerHealth = getAccountData (theCurrentAccount, "zmgm.health") local playerArmor = getAccountData (theCurrentAccount, "zmgm.armor") local playerWeaponID0 = getAccountData (theCurrentAccount, "zmgm.weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "zmgm.weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "zmgm.weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "zmgm.weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "zmgm.weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "zmgm.weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "zmgm.weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "zmgm.weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "zmgm.weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "zmgm.weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "zmgm.weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "zmgm.weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "zmgm.weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "zmgm.weaponAmmo12") local skill0 = getAccountData(theCurrentAccount, "zmgm.skill0") local skill1 = getAccountData(theCurrentAccount, "zmgm.skill1") local skill2 = getAccountData(theCurrentAccount, "zmgm.skill2") local skill3 = getAccountData(theCurrentAccount, "zmgm.skill3") local skill4 = getAccountData(theCurrentAccount, "zmgm.skill4") local skill5 = getAccountData(theCurrentAccount, "zmgm.skill5") local skill6 = getAccountData(theCurrentAccount, "zmgm.skill6") local skill7 = getAccountData(theCurrentAccount, "zmgm.skill7") local skill8 = getAccountData(theCurrentAccount, "zmgm.skill8") local skill9 = getAccountData(theCurrentAccount, "zmgm.skill9") local skill10 = getAccountData(theCurrentAccount, "zmgm.skill10") local zombieKills = getAccountData(theCurrentAccount,"zombies.kills") setElementData(source,"Zombie kills",zombieKills) triggerClientEvent(source,"expOnChange",getRootElement(),zombieKills,0) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setElementModel, 500, 1, source, playerSkin) giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true) giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, false) giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, false) giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, false) giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, false) giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, false) giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, false) giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, false) giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, false) giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, false) giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, false) giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, false) giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, false) setPedStat ( source, 69, skill0 ) setPedStat ( source, 70, skill1 ) setPedStat ( source, 71, skill2 ) setPedStat ( source, 72, skill3 ) setPedStat ( source, 73, skill4 ) setPedStat ( source, 74, skill5 ) setPedStat ( source, 75, skill6 ) setPedStat ( source, 76, skill7 ) setPedStat ( source, 77, skill8 ) setPedStat ( source, 78, skill9 ) setPedStat ( source, 79, skill10 ) else triggerClientEvent(source,"expOnChange",getRootElement(),0,0) giveWeapon(source, 22, 200, true) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then local account = getPlayerAccount (source) if (account) then setAccountData (account, "zmgm.money", tostring (getPlayerMoney (source))) setAccountData (account, "zmgm.skin", tostring (getPedSkin (source))) setAccountData (account, "zmgm.health", tostring (getElementHealth (source))) setAccountData (account, "zmgm.armor", tostring (getPedArmor (source))) setAccountData (account, "zmgm.weaponID0", getPedWeapon (source, 0)) setAccountData (account, "zmgm.weaponID1", getPedWeapon (source, 1)) setAccountData (account, "zmgm.weaponID2", getPedWeapon (source, 2)) setAccountData (account, "zmgm.weaponID3", getPedWeapon (source, 3)) setAccountData (account, "zmgm.weaponID4", getPedWeapon (source, 4)) setAccountData (account, "zmgm.weaponID5", getPedWeapon (source, 5)) setAccountData (account, "zmgm.weaponID6", getPedWeapon (source, 6)) setAccountData (account, "zmgm.weaponID7", getPedWeapon (source, 7)) setAccountData (account, "zmgm.weaponID8", getPedWeapon (source, -- s8) -->) setAccountData (account, "zmgm.weaponID9", getPedWeapon (source, 9)) setAccountData (account, "zmgm.weaponID10", getPedWeapon (source, 10)) setAccountData (account, "zmgm.weaponID11", getPedWeapon (source, 11)) setAccountData (account, "zmgm.weaponID12", getPedWeapon (source, 12)) setAccountData (account, "zmgm.weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "zmgm.weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "zmgm.weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "zmgm.weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "zmgm.weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "zmgm.weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "zmgm.weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "zmgm.weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "zmgm.weaponAmmo8", getPedTotalAmmo (source, -- s8) -->) setAccountData (account, "zmgm.weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "zmgm.weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "zmgm.weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "zmgm.weaponAmmo12", getPedTotalAmmo (source, 12)) setAccountData (account, "zmgm.skill0", getPedStat ( source, 69 )) setAccountData (account, "zmgm.skill1", getPedStat ( source, 70 )) setAccountData (account, "zmgm.skill2", getPedStat ( source, 71 )) setAccountData (account, "zmgm.skill3", getPedStat ( source, 72 )) setAccountData (account, "zmgm.skill4", getPedStat ( source, 73 )) setAccountData (account, "zmgm.skill5", getPedStat ( source, 74 )) setAccountData (account, "zmgm.skill6", getPedStat ( source, 75 )) setAccountData (account, "zmgm.skill7", getPedStat ( source, 76 )) setAccountData (account, "zmgm.skill8", getPedStat ( source, 77 )) setAccountData (account, "zmgm.skill9", getPedStat ( source, 78 )) setAccountData (account, "zmgm.skill10", getPedStat ( source, 79 )) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) Link to comment
Castillo Posted July 30, 2012 Share Posted July 30, 2012 That script has no onPlayerWasted event, how could it be saved after death? Link to comment
Drakath Posted July 30, 2012 Author Share Posted July 30, 2012 It doesn't save after death, but if player reconnects after death he gets weapons back... Link to comment
Castillo Posted July 30, 2012 Share Posted July 30, 2012 That script will save weapons on quit and load them on login. Link to comment
Drakath Posted July 30, 2012 Author Share Posted July 30, 2012 And how can I make it to don't load weapons back when someone die? Link to comment
Castillo Posted July 30, 2012 Share Posted July 30, 2012 You want to reset weapons after killed? Link to comment
Drakath Posted July 30, 2012 Author Share Posted July 30, 2012 I want players to lose weapons after death without possible way to get it back by reconnecting. 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