KingSCR Posted February 1, 2019 Share Posted February 1, 2019 Hello my friends, I need to edit my Gamemode so when a player dies he loses all guns. Can someone help me? Sorry, I'm using the translator. : D Link to comment
AncienT Posted February 1, 2019 Share Posted February 1, 2019 takeAllWeapons (player) Or modify save system 1 Link to comment
KingSCR Posted February 1, 2019 Author Share Posted February 1, 2019 9 minutes ago, AncienT said: takeAllWeapons (player) Or modify save system Thanks, I'll try to add it to my save system. function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) takeAllWeapons (player) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) How does it work? Link to comment
AncienT Posted February 1, 2019 Share Posted February 1, 2019 8 minutes ago, KingSCR said: Thanks, I'll try to add it to my save system. function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) takeAllWeapons (player) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) How does it work? Remove this setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) 1 Link to comment
KingSCR Posted February 1, 2019 Author Share Posted February 1, 2019 (edited) 5 minutes ago, AncienT said: Remove this setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) Thank you, stayed like this. Correct? function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) takeAllWeapons (player) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) Edited February 1, 2019 by KingSCR Link to comment
AncienT Posted February 1, 2019 Share Posted February 1, 2019 1 minute ago, KingSCR said: Thank you, stayed like this. Right? function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) takeAllWeapons (player) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) Looks good 1 Link to comment
AncienT Posted February 1, 2019 Share Posted February 1, 2019 16 minutes ago, KingSCR said: Thank you! Your welcome 1 Link to comment
KillerX Posted February 1, 2019 Share Posted February 1, 2019 8 hours ago, KingSCR said: getPedSkin WIKI : This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. Please use getElementModel instead. 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