10.03.2010, 14:19
Quote:
|
Originally Posted by Joe Torran C
Do you think you could add a thing stopping the player from sending a PM to himself
|
pawn Code:
COMMAND:pm(playerid, params[])
{
new string[128], name[MAX_PLAYER_NAME], tmp[128], index;
tmp = strtok(params, index);
new otherid = strval(tmp);
if (strlen(tmp) && strlen(params[2]))
{
if (IsPlayerConnected(otherid))
{
if (playerid != otherid)
{
// Message to "otherid"
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "PM from %s: %s", name, params[2]);
SendClientMessage(otherid, YELLOW, string);
//Message to sender
GetPlayerName(otherid, name, sizeof(name));
format(string, sizeof(string), "PM to %s: %s", name, params[2]);
SendClientMessage(playerid, WHITE, string);
}
else
{
SendClientMessage(playerid, RED, "You cannot sent a PM to yourself.");
}
}
else
{
SendClientMessage(playerid, WHITE, "Invalid player id.");
}
}
else
{
SendClientMessage(playerid, WHITE, "USAGE: /pm [playerid] [message]");
}
return 1;
}

