| Blockland Forums > Modification Help |
| Iban Explains it All |
| << < (18/39) > >> |
| cucumberdude:
Well I actually already knew most of it. I'm just rusty on torquescript, and needed the syntax for calling a clientsided function from the server. |
| Treynolds416:
I need a little help with discerning a client's team. --- Code: ---function tellTeam() { if(%client.tdmTeam > -1) { echo("You are in team "@%client.tdmTeam); } else if(%client.tdmTeam = -1) { echo("You are not in a team!"); } } --- End code --- What am I doing wrong? |
| Iban:
I don't know how else to better explain server commands. If you want to be able to put a slash infront of something in chat and have something happen, you need it to be a server command. The structure for a server command is always like this. function serverCmdCommandName(%client, %word1) - There can be something like 15 "%word#"s. Also, your if statement is pretty handicapped looking. --- Code: ---if(%client.tdmTeam != -1) messageClient(%client, '', "\c5You are in team" SPC %client.tdmTeam); else messageClient(%client, '', "\c5You not on a team."); --- End code --- You can take the curly-braces out because there is only one statement to be ran if it evaluates true. An else if is not required because there's only one alternative to what the first if is. |
| Treynolds416:
--- Quote from: Iban on March 13, 2011, 06:49:15 PM ---I don't know how else to better explain server commands. If you want to be able to put a slash infront of something in chat and have something happen, you need it to be a server command. The structure for a server command is always like this. function serverCmdCommandName(%client, %word1) - There can be something like 15 "%word#"s. Also, your if statement is pretty handicapped looking. --- Code: ---if(%client.tdmTeam != -1) messageClient(%client, '', "\c5You are in team" SPC %client.tdmTeam); else messageClient(%client, '', "\c5You not on a team."); --- End code --- You can take the curly-braces out because there is only one statement to be ran if it evaluates true. An else if is not required because there's only one alternative to what the first if is. --- End quote --- No, for client. I know how to structure a server command just fine. I want to be able to join any server, type tellTeam(); into the console and have it return either "You are not in a team" or "You are in team (whatever)". |
| Iban:
sigh. You can't do that. That information is server-side. |
| Navigation |
| Message Index |
| Next page |
| Previous page |