Jump to content

Teams


Luther123

Recommended Posts

Posted

HI,i would like to ask on how to keep them with their team when they die..

because for me when i and other players die i lose my team and i have to manually

set my team to admin panel. Please help me out :3

Thanks.

Posted

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Maybe one of your script's is messing with it, post your spawning script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

Posted

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 
) 

Posted
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) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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