Jump to content

Wasted Team Respawn


Bean666

Recommended Posts

hi , i need help , is there anyway to make this as a team? because when the players die, different teams , they all respawn in this place when they die , is it possible to make different teams with a different respawn point? here is an example of my wasted / respawn system and is it possible for this wasted/respawn thing to attach it to the code of survivor and military if yes please help.

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, 3000, 1, source, 213.7412109375, 1868.505859375, 13.140625, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) 
    setTimer (setCameraTarget, 1250, 1, source, source) 
    setTimer (fadeCamera, 3000, 1, source, true) 
    setTimer ( outputChatBox, 3000, 1, "You Have Died! Do Better Next Time!",source, 0, 200, 0, false) 
  end 
end 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 
  

code of Military :

function createMilitaryTeam () 
    MilitaryTeam = createTeam ("Military", 0, 200, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createMilitaryTeam) 
  
function joinMilitary() 
     spawnPlayer (source, 213.7412109375, 1868.505859375, 13.140625, 0,287, 0, 0) 
     setPlayerTeam(source,MilitaryTeam) 
    setPlayerNametagColor ( source, 0, 200, 0 ) 
     setElementModel(source,287) 
      giveWeapon ( source, 31, 200 ) 
     outputChatBox("You have chosen to be a Military Now Click Cancel To Close The GUI!And go to weaponshop",source,255,200,0) 
end 
addEvent("setMilitary", true) 
addEventHandler("setMilitary",root,joinMilitary) 

Code of survivor:

function createSurvivorTeam () 
    SurvivorTeam = createTeam ("Survivors", 255, 200, 0) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSurvivorTeam) 
  
function joinSurvivor() 
     setPlayerTeam(source,SurvivorTeam) 
    setPlayerNametagColor ( source, 255, 200, 0 ) 
     setElementModel(source,127) 
      giveWeapon ( source, 31, 200 ) 
      spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0,127, 0, 0) 
     outputChatBox("You have chosen to be a Survivor!Now Click Cancel to close the GUI!",source,255,200,0) 
end 
addEvent("setSurvivor", true) 
addEventHandler("setSurvivor",root,joinSurvivor) 

Link to comment

You can either use tables, or use 'if' statements.

Example:

local x, y, z = 213.7412109375, 1868.505859375, 13.140625 -- Default position 
local team = getPlayerTeam ( source ) 
if ( team ) then 
    local teamName = getTeamName ( team ) 
    if ( teamName == "Military" ) then 
        x, y, z = 213.7412109375, 1868.505859375, 13.140625 
    elseif ( teamName == "Survivors" ) then 
        x, y, z = -2523.3408203125, -619.9560546875, 132.5625 
    end 
end 
setTimer ( spawnPlayer, 3000, 1, source, x, y, z, 0, getElementModel ( source ), 0, 0, team ) 

Link to comment

function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) 
local x, y, z = 213.7412109375, 1868.505859375, 13.140625 -- Default position 
local team = getPlayerTeam ( source ) 
if ( team ) then 
    local teamName = getTeamName ( team ) 
    if ( teamName == "Military" ) then 
        x, y, z = 213.7412109375, 1868.505859375, 13.140625 
    elseif ( teamName == "Survivors" ) then 
        x, y, z = -2523.3408203125, -619.9560546875, 132.5625 
    end 
end 
setTimer ( spawnPlayer, 3000, 1, source, x, y, z, 0, getElementModel ( source ), 0, 0, team ) 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 
  

this one didnt work , do i need to edit anything in here?

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