CMD:pm(playerid, params[])
{
new str[175], str2[175], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /pm <id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player not connected");
if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot pm yourself!");
{ // This isn't needed
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, COLOR_ORANGE, str);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, COLOR_YELLOW, str);
PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
printf(str);
LastPm[id] = playerid;
} // This isn't needed
return 1;
}
|
The code itself isn't to bad I guess, i couldn't help but notice this.
Код:
CMD:pm(playerid, params[])
{
new str[175], str2[175], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /pm <id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player not connected");
if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot pm yourself!");
{ // This isn't needed
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, COLOR_ORANGE, str);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, COLOR_YELLOW, str);
PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
printf(str);
LastPm[id] = playerid;
} // This isn't needed
return 1;
}
|
|
The code itself isn't to bad I guess, i couldn't help but notice this.
Код:
CMD:pm(playerid, params[])
{
new str[175], str2[175], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, COLOR_ORANGE, "Usage: /pm <id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player not connected");
if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot pm yourself!");
{ // This isn't needed
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, COLOR_ORANGE, str);
PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, COLOR_YELLOW, str);
PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
printf(str);
LastPm[id] = playerid;
} // This isn't needed
return 1;
}
|
if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot pm yourself!");
if (playerid == id) return SendClientMessage(playerid, COLOR_ORED, "ERROR: You cannot pm yourself!"); // Continue code..
|
He already returned the value after the statement.
Код:
if (playerid == id) return SendClientMessage(playerid, COLOR_ORED, "ERROR: You cannot pm yourself!"); // Continue code.. |