14.12.2014, 15:35
pawn Код:
new LastPMed[MAX_PLAYERS] = INVALID_PLAYER_ID;
CMD:pm(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendUsageError( playerid, "/pm [ID] [Message]" );
return 1;
}
if( playerid == id )
return SendClientMessage(playerid, 0xFF0000FF, "ERROR:{FFFFFF} You cannot send a PM to yourself!");
if( id == INVALID_PLAYER_ID )
return InvalidPlayerError(playerid);
if( NOPM{ id } == true)
return SendClientMessage(playerid, 0xFF0000FF, "ERROR:{FFFFFF} This person has turned off their PM's");
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM sent to %s[%d]: %s", Name2, id, str2);
SendClientMessage(playerid, 0xFFF700FF, str);
format(str, sizeof(str), "PM from %s[%d]: %s", Name1, playerid, str2);
SendClientMessage(id, 0xFFF700FF, str);
LastPMed[id] = playerid;
return 1;
}
CMD:reply(playerid, params[])
{
if(LastPMed[playerid] != INVALID_PLAYER_ID)
{
if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /reply [text]");
new id = LastPMed[playerid];
new Name1[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name1, sizeof(Name1));
format(str, sizeof(str), "PM from %s[%d]: %s", Name1, playerid, id);
SendClientMessage(id, 0xFFF700FF, str);
return 1;
}
else
{
SendClientMessage(playerid, -1, "No one has PMed you.");
return 1;
}
}