28.08.2016, 07:16
sSiddhant Tutorial 2# Join Message
Hi, guys this is my second tutorial on How to make Join Messages. This is for those players who are new to Pawn and wanted to make their own server. Ok..So let's begin
First of all we are gonna make an array to store players name
Quote:
new sname[MAX_PLAYER_NAME]; |
Quote:
new str[22+MAX_PLAYERS_NAME]; |
Now we will get the player name
Quote:
GetPlayerName(playerid, sname, sizeof(sname)); |
Now, lets format that String Variable which we have created.
Quote:
format(str,sizeof(str),"%s has joined the Server,sname"); |
The first parameter allows us to specify where we want to have the formatted string. We created the string array for this purpose earlier. The second parameter is the max length of the formatted string. That will be the size of the string. The third parameter is the actual string we want to format. %s is a placeholder for another string. Using the forth parameter we specify that it should be replaced with sname. That way we will have "<player's name> has joined the server." in the string array. This is taken from samp wikia
In this way we can use as much arguments we want after the third argument and we can put in the message using %s. So basically, this command will format the string and store it in the same array.
Now let's send this message to all users
Quote:
SendClientMessageToAll(-1, str); |
Quote:
public OnPlayerConnect(playerid) { //put your script here } |
This is for now. I will most more tutorials soon. Hope you like this Please Comment and Give suggestions for my next tutorial. See you Soon!