Jump to content

Losing all guns when they die (help)


KingSCR

Recommended Posts

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?
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...