Jump to content

Teams


Luther123

Recommended Posts

-- server side:

addEventHandler("onPlayerWasted",root, 
function () 
    local team = getPlayerTeam(source) 
    if (team) then 
        setElementData(source, "tempTeam", tostring(getTeamName(team))) 
    end 
end) 
  
addEventHandler("onPlayerSpawn",root, 
function () 
    local teamName = getElementData(source, "tempTeam") 
    if (not teamName) then return end 
    local team = getTeamFromName(teamName) 
    if (team) then 
        setPlayerTeam(source, team) 
    end 
    removeElementData(source, "tempTeam") 
end) 

Link to comment

you mean the thing that spawns you when you log in? here it is

spawnTeam = createTeam ("Unemployed", 205, 201, 201)  
function spawnOnLogin (prevA, curA, autoLogin) 
    outputChatBox ("Welcome to SAAR:RPG", source, 255, 0, 0, false) 
    spawnPlayer (source,1683.7286376953, -2248.0695800781, 13.550338745117, 0, math.random (0,288), 0, 0, spawnTeam)  
  
    fadeCamera (source, true) 
    setCameraTarget (source, source) 
end 
addEventHandler("onPlayerLogin", getRootElement(), spawnOnLogin) 

Link to comment
No, I mean when you get killed, it must have a respawn system.

oh here:

addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
        setTimer(spawnPlayer (source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288) 
    end 
) 

Link to comment
addEventHandler("onPlayerWasted",root, 
function () 
    setTimer(spawnPlayer, 2000, 1, source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288)) 
    local team = getPlayerTeam(source) 
    if (team) then 
        setElementData(source, "tempTeam", tostring(getTeamName(team))) 
    end 
end) 
  
addEventHandler("onPlayerSpawn",root, 
function () 
    local teamName = getElementData(source, "tempTeam") 
    if (not teamName) then return end 
    local team = getTeamFromName(teamName) 
    if (team) then 
        setTimer(setPlayerTeam,6000,1,source, team) 
    end 
    removeElementData(source, "tempTeam") 
end) 

Link to comment
addEventHandler("onPlayerWasted",root, 
function () 
    setTimer(spawnPlayer, 2000, 1, source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288)) 
    local team = getPlayerTeam(source) 
    if (team) then 
        setElementData(source, "tempTeam", tostring(getTeamName(team))) 
    end 
end) 
  
addEventHandler("onPlayerSpawn",root, 
function () 
    local teamName = getElementData(source, "tempTeam") 
    if (not teamName) then return end 
    local team = getTeamFromName(teamName) 
    if (team) then 
        setTimer(setPlayerTeam,6000,1,source, team) 
    end 
    removeElementData(source, "tempTeam") 
end) 

Thanks Alot Man :D

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