So im looking at one of xXziroXx's old scripts and i had some questions
Quote:
Originally Posted by xXziroXx
PHP Code:
function onPlayerChats() { tokens = player.chat.tokenize(); BodyParts = { "skin", "coat", "sleeves", "shoes", "belt", "all"}; BodyColors = { "white", "yellow", "orange", "pink", "red", "darkred", "lightgreen", "green", "darkgreen", "lightblue", "blue", "darkblue", "brown", "cynober", "purple", "darkpurple", "lightgray", "gray", "black"}; if (BodyParts.index( tokens[0]) > -1 && BodyColors.index( tokens[1]) > -1) { if (tokens[0] != "all") player.colors[ BodyParts.index( tokens[0])] = tokens[1]; else { for (i: BodyParts) player.colors[ BodyParts.index( i)] = tokens[1]; } player.chat = "Changed " @ tokens[0] @ " to " @ tokens[1] @ "!"; } }
|
PHP Code:
if (BodyParts.index( tokens[0]) > -1 && BodyColors.index( tokens[1]) > -1)
What does the -1 do? Assuming its the word number, how can words be less than first word (which is number 0).
PHP Code:
for (i: BodyParts) player.colors[ BodyParts.index( i)] = tokens[1];
What does the "i" do? My guess is its a variable?
Lastly can SPC be used instead of "@"?