Island Life Prison Roleplay
Welcome back to ILRP! Please type in your username and password to 'login'.
Island Life Prison Roleplay
Welcome back to ILRP! Please type in your username and password to 'login'.
Island Life Prison Roleplay
Would you like to react to this message? Create an account in a few clicks or log in to continue.


WEBSITE: http://island-life.webs.com/
 
HomeLatest imagesSearchRegisterLog in
Welcome to Island Life Prison Roleplay! Our Server and Forums is under Major Construction, and will be for quit some time, but feel free to Go In Game, and check it out, as we script and Map new things everyday! Feel free to create topics on the forums, and claim your spot in DoC if you want to be a guard! Thanks and enjoy!

 

 Using Strings to collect Information

Go down 
AuthorMessage
AxelPetrov

AxelPetrov


Posts : 15
Join date : 2013-03-02
Age : 27
Location : United States

Using Strings to collect Information Empty
PostSubject: Using Strings to collect Information   Using Strings to collect Information Empty3/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.
Back to top Go down
 
Using Strings to collect Information
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Island Life Prison Roleplay :: Tutorials :: Pawno Tutorials-
Jump to: