Jump to content
  • 0

Got problem with cmds.


Batista

Question

3 days ago I start learning scripting and my dream is to be scripter.

When I open my server to testing my scriptes I do this script:

function createTeamsOnStart () 
    teamStaff = createTeam ( "Staff", 255, 255, 255 ) 
    if ( command == "staff" ) then 
     setPlayerTeam ( source, nil ) 
  end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) 

And when I type /staff on chat or staff on console I didn't move to Staff team on TAB, please help me how to fix this.

THank you :D

Link to comment

11 answers to this question

Recommended Posts

  • 0

This code will work when you start your script. But it won't update players' skin when you change team.

for i, v in ipairs ( getElementsByType ( "player" ) ) do 
 local team = getPlayerTeam ( v ) 
 if team == getTeamFromName ( "someTeamName" ) then setElementModel ( v, someSkin ) 
 elseif team == getTeamFromName ( "anotherTeamName" ) then setElementModel ( v, anotherSkin ) end 
end 

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