Jump to content

Set player team on marker hit.


Recommended Posts

Hi,

I need to make a script that when a player walks into the marker it notifys him/her that they have joined a certain team. So for i have got this :

local teamMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) 
  
function teamMarkerHit( hitElement, matchingDimension ) 
  if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
 setPlayerTeam ( source, Police ) 
  elseif getElementType( hitElement ) == "vehicle" then 
  end 
end 
addEventHandler( "onMarkerHit", teamMarker, teamMarkerHit ) 
  

I also need it to make the team everytime the server starts but im not sure how to do that.

Thanks

Link to comment
local Police = createTeam("Police", 0, 0, 255)   -- this will create the team everytime the script starts 
local teamMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) 
  
function teamMarkerHit( hitElement, matchingDimension ) 
    if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then 
        setPlayerTeam ( hitElement, Police)            -- source is the marker in this event, hitElement is the player 
  end 
end 
addEventHandler( "onMarkerHit", teamMarker , teamMarkerHit )  

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