Jump to content

Set player team by skin.


kevenvz

Recommended Posts

That is the only function no event etc.

fullcode:

function createTeams() 
    teamCriminal = createTeam ( "Crimineel", 255, 0, 0 ) 
    teamWorkless = createTeam ( "Werkloos", 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeams ) 
  
function setTeams() 
   if getElementModel(source) == 78 then 
     setPlayerTeam ( source, teamWorkless) 
   end 
end 
  

Link to comment
That is the only function no event etc.

fullcode:

function createTeams() 
    teamCriminal = createTeam ( "Crimineel", 255, 0, 0 ) 
    teamWorkless = createTeam ( "Werkloos", 255, 255, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeams ) 
  
function setTeams() 
   if getElementModel(source) == 78 then 
     setPlayerTeam ( source, teamWorkless) 
   end 
end 
  

how you use setTeams function?

Link to comment
function setTeam() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam" class="kw6">setPlayerTeam ( player , teamWorkless) 
   end 
end 
end 
setTimer(1000, setTeam,-1) 

Try this, i did not test it, but i think that it can be work...

P.S: Set the player's team every 1 second...

Link to comment

That script got bugs but I changed a bit and this is teh code:

function setTeam() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam ( player , teamWorkless) 
   end 
end 
end 
setTimer(setTeam, 1000, -1) 

Link to comment

try this

  
setTimer(function() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam ( player , teamWorkless) 
   end 
end 
end,1000,0) 
  

please explain how you would like to receive getElementModel in which case

Link to comment
try this

  
setTimer(function() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam ( player , teamWorkless) 
   end 
end 
end,1000,0) 
  

please explain how you would like to receive getElementModel in which case

"getElementsByType("player")" returns a table with all players in the server

"for id, player in ipairs(getElementsByType("player")) do" - this means "do it for all elements in table (all players)", id is a table index, "player" is some player in the cell with index "id"

so " getElementModel(player )" is correct

Link to comment
function setTeam() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam ( player , teamWorkless) 
   end 
end 
end 
setTimer(1000, setTeam,-1) 
 

Try this, i did not test it, but i think that it can be work...

P.S: Set the player's team every 1 second...

Your timer is wrong, it should be, setTimer(setTeam, 1000, 0)

Link to comment
function setTeam() 
for id, player in ipairs(getElementsByType("player")) do 
       if getElementModel(player ) == 78 then 
     setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam ( player , teamWorkless) 
   end 
end 
end 
setTimer(1000, setTeam,-1) 
  

Try this, i did not test it, but i think that it can be work...

P.S: Set the player's team every 1 second...

Your timer is wrong, it should be, setTimer(setTeam, 1000, 0)

Oh i forgot :S ty :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...