10.09.2011, 10:42
PHP Code:
if(!strcmp(cmd, "/pm"))
{
if(IsPlayerConnected(playerid))
{
new player;
new message;
if(sscanf(params, "ds", player, message)) return SendClientMessage(playerid,COLOR_WHITE," {FF0000}/PM {FFFF00}: Usage: {FF4040}/pm [player id] [message]{FFFF00}.");
if(IsPlayerConnected(player)==0) return SendClientMessage(playerid,COLOR_WHITE," {FF0000}/PM {FFFF00}: That player isn't connected.");
if(player == playerid) return SendClientMessage(playerid,COLOR_WHITE," {FF0000}/PM {FFFF00}: You can't PM yourself.");
else
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid,sendername,sizeof(sendername));
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
new string[128];
format(string,sizeof(string)," {FF0000}/PM {FFFF00}: PM from {FF4040}%s{FFFF00}: {FFFFFF}%d",sendername,message);
SendClientMessage(player,COLOR_WHITE,string);
format(string,sizeof(string)," {FF0000}/PM {FFFF00}: You've sent a PM to {FF4040}%s{FFFF00}: {FFFFFF}%d",name,message);
SendClientMessage(player,COLOR_WHITE,string);
return 1;
}
}