Island Life Prison Roleplay
Welcome back to ILRP! Please type in your username and password to 'login'.


WEBSITE: http://island-life.webs.com/
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog 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!

Share | 
 

 Using Strings to collect Information

Go down 
AuthorMessage
AxelPetrov

avatar

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

PostSubject: 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.
Back to top Go down
View user profile
 
Using Strings to collect Information
Back to top 
Page 1 of 1
 Similar topics
-
» Basic Roleplay Information and Rules
» Basic Roleplay Information and Rules
» Haki System Rules & Information
» Uglies by Scott Westerfeild
» The Number-smart Parrot (More like information than a story...but...yah)

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