Simple Join/Leave msgs with reason -
ItzRbj - 05.11.2014
Join/Leave Messages Tutorial
first , you have to define the colours we're going to use
pawn Код:
#include <a_samp>
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_GREY 0xAFAFAFAA
Second , OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "[Join]: {eca3f7}%s joined the server", pname);
SendClientMessageToAll(COLOR_MAGENTA, string);
return 1;
}
new pname [MAX_PLAYER_NAME] is used in the (string) of (SendClientMessageToAll) to show the player's name
GetPlayerName is to get the logged in player name to be displayed to all players, the {eca3f7} is a colour nvm xD
3rd , the OnPlayerDisconnect function
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "[Timout/Crashed]: %s left the server.", pname);
case 1: format(string, sizeof(string), "[Quit]: %s left the server.", pname);
case 2: format(string, sizeof(string), "[Kicked/Banned]: %s left the server.", pname);
}
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
pname is already explained , switch&case is something nearly like if but a bit bigger , if u r gonna use them then ur case must start from 0 , otherwise it'll cause errors , in this switch&case we have only 3 cases , case 0 in case the player (Crashed) , case 1 in case the player quit or do /q , case 2 in case the player is kicked/banned by admin or anticheat/spam/advertise anything
hope its explained enough
Re: Simple Join/Leave msgs with reason -
Eth - 05.11.2014
That is not a tutorial, It's not explained at all.
Re: Simple Join/Leave msgs with reason -
ItzRbj - 05.11.2014
Quote:
Originally Posted by Eth
That is not a tutorial, It's not explained at all.
|
Sorry , it's my first tutorial post thread , editing .....
Re: Simple Join/Leave msgs with reason -
Eth - 06.11.2014
Good editing . Well Explained + Rep for your first tutorial
Re: Simple Join/Leave msgs with reason -
Glossy42O - 06.11.2014
Explained good.
Good job and good luck in next tutorial!
Re: Simple Join/Leave msgs with reason -
Arastair - 06.11.2014
Quote:
Originally Posted by Eth
That is not a tutorial, It's not explained at all.
|
Same thought,
It's me rbj, Zeus, go learn scripting :P
Re: Simple Join/Leave msgs with reason -
Glossy42O - 06.11.2014
Quote:
Originally Posted by Arastair
Same thought,
It's me rbj, Zeus, go learn scripting :P
|
He edited it.
Re: Simple Join/Leave msgs with reason -
ItzRbj - 06.11.2014
Quote:
Originally Posted by Arastair
Same thought,
It's me rbj, Zeus, go learn scripting :P
|
lol hey man , im not stopping to learn but i like to share what i know to those who dont know :P
Re: Simple Join/Leave msgs with reason -
Eth - 06.11.2014
Quote:
Originally Posted by ItzRbj
lol hey man , im not stopping to learn but i like to share what i know to those who dont know :P
|
But if you want my suggestion then you need to post a full Tutorial that will really help players
Re: Simple Join/Leave msgs with reason -
ItzRbj - 06.11.2014
Quote:
Originally Posted by Eth
But if you want my suggestion then you need to post a full Tutorial that will really help players 
|
i'll do it as soon as i get back home :3