new pname[30];
new string[256];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s entrou no servidor.",pname);
SendClientMessageToAll(COR, string);
public OnPlayerConnect(playerid)
{
new pName[ 30 ], string[ 256 ];
GetPlayerName(playerid, pName, 30);
format(string, 256, "%s entrou no server.", pName);
SendClientMessageToAll(COLOR_RED,string);
return 1;
}
public OnPlayerDisconnect(playerid)
{
new pName[30], string[256];
GetPlayerName(playerid, pName, 30);
format(string, 256, "%s saiu do server.", pName);
SendClientMessageToAll(COLOR_RED ,string);
return 1;
}
public OnPlayerConnect(playerid)
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server. Welcome!",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new
string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
Originally Posted by russooooo
Sim funciona.
@Lipepva Mas no pname seria usado em princнpio o MAX_PLAYER_NAME que no mбximo seria 24. Mas na 'realidade' o nick sу usa 20 caracteres. Por isso new pname[20]; chegaria perfeitamente. A string nгo precisa de 256. O nъmero limite sгo 128 por cada linha de chat. A tua string no mбximo sera 47. Atenзгo: O uso de cells em excesso vai chegar a um ponto em que o script ficarб instбvel. |
Header size: 4808 bytes Code size: 389940 bytes Data size: 2454056 bytes Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion Total requirements: 2865188 bytes
Originally Posted by russooooo
|