11-27-2013, 06:12 PM
|
Deleted by Darlene159
|
|
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
|
|
Quote:
Originally Posted by iDigzy
Well I haven't posted a question on here in a bit, but I ran into another problem. I want to make a script that sets the players tag. I'm not sure if this script is correct in any way/or if I over thought it. Can someone tell me whats wrong :o?
PHP Code:
function onActionSeverside(tags){
if (tokens[0] == "/tag"){
player.guild = "Elepahnt";
}
}
//#CLIENTSIDE
function onPlayerChats(){
if (player.chat == "/tag"){
temp.tokens = player.chat.tokenize();
triggerServer("gui", this,name, tags);
}
}
|
- the 2nd parameter for triggerserver(); is the name of the object you are communicating with, you have a comma after 'this' instead of a dot
- you are storing 'player.chat.tokenize()' as 'temp.tokens', but you are not sending temp.tokens as a parameter, you are sending 'tags' which is undefined
- because you have already established the player is using the tag command on clientside, it is not necessary to check this condition on serverside
- it is not necessary to send the full array of tokenized chat, you only need to send the 2nd value, which is temp.tokens[1]
PHP Code:
function onActionSeverside(temp.tag){
player.guild = temp.tag;
}
//#CLIENTSIDE
function onPlayerChats(){
if (player.chat.starts("/tag")){
temp.tokens = player.chat.tokenize();
triggerServer("gui", this.name, temp.tokens[1]);
}
}
|
__________________
This signature has been deleted by Darlene159.
|
Last edited by Jakov_the_Jakovasaur; 11-27-2013 at 09:44 PM..
Reason: thank you!
|
|