Batista Posted November 17, 2011 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
0 DiSaMe Posted November 17, 2011 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
0 Batista Posted November 18, 2011 Author 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?
0 JR10 Posted November 18, 2011 Posted November 18, 2011 You use functions to do things. setElementModel
0 Batista Posted November 18, 2011 Author Posted November 18, 2011 As that? : setElementModel(playerSource = 217)
0 12p Posted November 18, 2011 Posted November 18, 2011 If you see highlighted functions, click them. setElementModel(playerSource, 217)
0 Batista Posted November 18, 2011 Author 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'
0 12p Posted November 18, 2011 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.
0 Batista Posted November 18, 2011 Author Posted November 18, 2011 Yes I read what you say in your previous post, How to fix it?
0 12p Posted November 18, 2011 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
0 12p Posted November 18, 2011 Posted November 18, 2011 Fine. btw can someone pls move this to scripting?
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
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