Jump to content

Help me save team


Akranes123

Recommended Posts

-- SERVER

function setTeam( player, team ) -- Use this function to change players team.
 local acc = getPlayerAccount( player )
 local log = isGuestAccount( acc )
 if ( player and team ) and not ( log ) then
    local _team = getTeamFromName( team )
    if ( _team ) then
      setPlayerTeam( player, _team )
      setAccountData( acc, "team", _team )
      outputChatBox( "Your team has been changed to: " .. team, player, 255, 0, 0 )
    end
 end
end

function assignTeam( _, a )
  if ( a ) then
     local team = getAccountData( a, "team" ) or nil
     if ( team ) then
      setPlayerTeam( source, team )
     end
  end
end
addEventHandler( "onPlayerLogin", root, assignTeam )

function deathTeam()
  local acc = getPlayerAccount( source )
  local log = isGuestAccount( acc )
  if not ( log ) then
    local team = getAccountData( acc, "team" )
    setPlayerTeam( source, team )
  end
end
addEventHandler( "onPlayerWasted", root, deathTeam )

 

Edited by Simple01
Added death team assignament.
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...