Jump to content
  • 0

Got problem with cmds.


Batista

Question

Posted

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

11 answers to this question

Recommended Posts

  • 0
Posted (edited)

It's clear why it doesn't teleport, your script has no code which has something to do with teleporting. Create a function which uses setElementPosition (oops, didn't read carefully) and attach it to the command with addEventHandler.

Edited by Guest
  • 0
Posted

I didn't understand, can you explain more please?

EDIT: probleme solved. :D

Another question, how to add skin when I moved to another team by cmd?

  • 0
Posted

I do this but I moved to staff team on TAB and I didn't get the skin...

setElementModel(playerSource = 217) 

Bad argument @ 'setElementModel'
  • 0
Posted

First of all, your syntax is completely wrong, doesn't make sense. Have you even read what I said in my previous post?

Second, playerSource is not defined anywhere.

  • 0
Posted

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 

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