Jump to content

Can't getPlayerTeam on spawn


FWCentral

Recommended Posts

Posted
  
local team = getPlayerTeam(source) 
  

If i use this onPlayerSpawn then it doesn't get the team, is there any way around this?

Note:

When a player dies they lose there team and when they spawn they get a team from another resource.

3677124c9d4d768da64a55d5bebf578e.png
Posted
function asd(player) 
......... 
end 
  
function timer() 
setTimer(asd,1000,1,source) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),timer) 

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

  • 1 month later...
Posted

-- server side:

addEventHandler("onPlayerWasted",root, 
function () 
    local team = getPlayerTeam(source) 
    if (team) then 
        setElementData(source,"tempTeam",getTeamName(team)) 
    end 
end) 
  
addEventHandler("onPlayerSpawn",root, 
function () 
    local team = getElementData(source,"tempTeam") 
    if (team and getTeamFromName(team)) then 
        setPlayerTeam(source,getTeamFromName(team)) 
    end 
end) 

That script should save the team on wasted and load it on spawn.

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