Batista Posted November 17, 2011 Share Posted November 17, 2011 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 Link to comment
0 DiSaMe Posted November 17, 2011 Share Posted November 17, 2011 (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 November 18, 2011 by Guest Link to comment
0 Batista Posted November 18, 2011 Author Share Posted November 18, 2011 I didn't understand, can you explain more please? EDIT: probleme solved. Another question, how to add skin when I moved to another team by cmd? Link to comment
0 JR10 Posted November 18, 2011 Share Posted November 18, 2011 You use functions to do things. setElementModel Link to comment
0 Batista Posted November 18, 2011 Author Share Posted November 18, 2011 As that? : setElementModel(playerSource = 217) Link to comment
0 12p Posted November 18, 2011 Share Posted November 18, 2011 If you see highlighted functions, click them. setElementModel(playerSource, 217) Link to comment
0 Batista Posted November 18, 2011 Author Share Posted November 18, 2011 I do this but I moved to staff team on TAB and I didn't get the skin... setElementModel(playerSource = 217) Bad argument @ 'setElementModel' Link to comment
0 12p Posted November 18, 2011 Share Posted November 18, 2011 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. Link to comment
0 Batista Posted November 18, 2011 Author Share Posted November 18, 2011 Yes I read what you say in your previous post, How to fix it? Link to comment
0 12p Posted November 18, 2011 Share Posted November 18, 2011 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
0 Batista Posted November 18, 2011 Author Share Posted November 18, 2011 Probleme solved, thanks Link to comment
0 12p Posted November 18, 2011 Share Posted November 18, 2011 Fine. btw can someone pls move this to scripting? Link to comment
Question
Batista
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:
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
Link to comment
11 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now