26.05.2012, 11:42
This might help
PHP код:
new togglepm[MAX_PLAYERS],ID,message[128],str[128],Nam[MAX_PLAYER_NAME],Pname[MAX_PLAYER_NAME];
public OnPlayerConnect(playerid)
{
togglepm[playerid] = 1;
return 1;
}
CMD:pm(playerid, params[])
{
if(sscanf(params,"us",ID,message)) return SendClientMessage(playerid,0xF6BB0AA,"USAGE: /pm [ID] [message]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,0xFF0000FF,"Invalid ID");
if(togglepm[ID] == 0) return SendClientMessage(playerid,0xFB0000AA,"ERROR: That user has his pm toggled off");
GetPlayerName(ID,Pname,sizeof(Pname));
GetPlayerName(playerid,Nam,sizeof(Nam));
format(str,sizeof(str),">> %s(%d): %s",Pname,playerid,message);
SendClientMessage(playerid,0xFFFF00FF,str);
format(str,sizeof(str),"** %s(%d): %s",Nam,playerid,message);
SendClientMessage(ID,0xFFFF00FF,str);
return 1;
}
CMD:togglepm(playerid,params[])
{
if(togglepm[playerid] == 1)
{
SendClientMessage(playerid,0xF6BB0AA,"You had toggled your pm OFF");
togglepm[playerid] = 0;
}
else if(togglepm[playerid] == 0)
{
SendClientMessage(playerid,0xF6BB0AA,"You had toggled your pm ON");
togglepm[playerid] = 1;
}
return 1;
}