14.04.2011, 07:03
I would make an function to process Pm's.
GetPlayerNameEx :
pawn Код:
stock OnPlayerGetPm(playerid, senderid, Text[])
{
if(APlayerData[senderid][Muted] == true) return SendClientMessage(senderid, 0x0, "You are muted, and cannot send any message..");
if(GetPVarInt(playerid, "NoPM") == 1) return SendClientMessage(senderid, 0x0, "This player has disabled pm's.");
new string[128]; format(string, sizeof(string), "Pm from : %s ( %d ) : %s", GetPlayerNameEx(senderid), senderid, Text);
SendClientMessage(playerid, 0x0, string);
format(string, sizeof(string), "Pm to : %s ( %d ) : %s", GetPlayerNameEx(playerid), playerid, Text);
SendClientMessage(playerid, 0x0, string);
return 1;
}
pawn Код:
stock GetPlayerNameEx(playerid)
{
new pName[25];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}
pawn Код:
command(pm, playerid, params[])
{
new pID, tText[90];
if(sscanf(params, "us[90]", pID, tText)) return SendClientMessage(playerid, 0x0, "Usage /pm [playerid/Name & Text]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0x0, "This player is not connected.");
OnPlayerGetPm(pID, playerid, tText)
return 1;
}