Jump to content

[HELP] Weapon pack random


OrbTanT

Recommended Posts

Posted

hi guys, anyone could spawn a script type with: sawn off, deagle, m4. more when the person dies it respawn with another type of pack: deagle, combat shotgun, ak47. already tried some ways most have not had results, use a simple system to respawn.

local spawnX, spawnY, spawnZ = 2030.22, -1418.29, 16.99 
function joinHandler() 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Bem Vindo", source) 
end 
addEventHandler( "onPlayerJoin", getRootElement(), joinHandler) 
  
addEventHandler( "onPlayerWasted" , getRootElement ( ), 
    function() 
        setTimer( spawnPlayer, 5000, 1, source, 2030.22, -1418.29, 16.99 ) 
    end 
) 

Posted

like a pack of weapons spawn with ai pack that comes deagle, sawnoff, and m4's when the player is killed he the spawn with another random type pack, now with deagle, combat shotgun, ak47.

Posted

addEventHandler ( 'onPlayerJoin', root,  
function ( ) 
    spawnPlayer ( source, 2030.22, -1418.29, 16.99 ) 
    fadeCamera( source, true ) 
    setCameraTarget ( source, source ) 
    outputChatBox ( ' Bem Vindo', source, 255, 255, 0  ) 
     giveWeapon ( source, 31, 200 ) -- Gives the M4 weapon with 200 ammo 
      giveWeapon ( source, 26, 200 ) -- Gives the sawnoff weapon with 200 ammo 
       giveWeapon ( source, 24, 200 ) -- Gives the deagle weapon with 200 ammo 
  end 
) 
  
addEventHandler( "onPlayerWasted" , root, 
    function() 
        setTimer( spawnPlayer, 5000, 1, source, 2030.22, -1418.29, 16.99 ) 
          triggerEvent ( 'onNextSpawn',source ) --- trigger the other pack and take the old pack 
    end 
) 
  
addEvent('onNextSpawn', true ) 
addEventHandler ( 'onNextSpawn', root, 
function ( ) 
    giveWeapon ( source, 27 , 200 )  
    giveWeapon ( source, 30, 200 ) 
   giveWeapon ( source, 24, 200 ) 
   takeWeapon ( source, 31)  
   takeWeapon ( source, 26)  
   takeWeapon ( source, 24) 
   outputChatBox(' * Weapons has beeen replaced * ' ,source, 255, 0 , 0 ) 
 end 
) 
Posted

Thanks helped me a lot, more so if I want the event onPlayerWasted have more than one option pack weapons? type using the math.random.

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