05.11.2014, 22:38
(
Последний раз редактировалось ItzRbj; 05.11.2014 в 23:19.
Причина: Not explained
)
Join/Leave Messages Tutorial
first , you have to define the colours we're going to use
Second , OnPlayerConnect
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
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
first , you have to define the colours we're going to use
pawn Код:
#include <a_samp>
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_GREY 0xAFAFAFAA
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;
}
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;
}
hope its explained enough