AxelPetrov
Posts : 15 Join date : 2013-03-02 Age : 27 Location : United States
| Subject: Using Strings to collect Information 3/6/2013, 3:39 pm | |
| Here is the command that we are going to be working with - Code:
-
CMD:teleport(playerid, params[]) { SetPlayerPos(playerid, 0.00, 0.00, 0.00); return 1; } We are going to add some coding to this that will tell EVERYONE on the server that that player has teleported. But how do we do that? Here we go. - Code:
-
CMD:teleport(playerid, params[]) { new string[238]; //this signifies a new string of no more than 238 characters name = GetName(playerid); //this signifies the players name using the name 'name' SetPlayerPos(playerid, 0.00, 0.00, 0.00); //setes the players position to 0,0,0 on the map format(string, sizeof(string), "%s has teleported using '/teleport'.", name); //this formats a string containing a players name(player who does the command). SendClientMessageToAll(string); //and this sends a client message to everyone on the server that allows them to see the string. return 1; } And that is a simple coding example on how you would go about using strings to send a ton of people a message containing parameters such as player names, levels, ect. | |
|