Sign in to follow this  
KingSCR

Losing all guns when they die (help)

Recommended Posts

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

 

Share this post


Link to post
9 minutes ago, AncienT said:

 
  1. 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?

Share this post


Link to post
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)
  • Thanks 1

Share this post


Link to post
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 by KingSCR

Share this post


Link to post
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

  • Thanks 1

Share this post


Link to post
16 minutes ago, KingSCR said:

Thank you!

Your welcome

  • Thanks 1

Share this post


Link to post
8 hours ago, KingSCR said:

getPedSkin

WIKI :

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getElementModel instead.

 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.