22.04.2014, 15:50
You can add it at the /pm part, for an example;
* not exactly tested, but it should avoid the message, and should ban the player *
pawn Код:
CMD:pm(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us[256]", id, str2))
{
SendClientMessage(playerid, 0xFF0000FF, "{FFFFFF}* {00C0FF} /pm [ID] [MESSAGE]");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[PM] - Player not connected");
if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "[PM] - You cannot pm yourself!");
if (dnd { id } ) return SendClientMessage(playerid, COLOR_RED, "[DND] - Target is in DND(Do Not Disturb) mode");
if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_RED, "[MUTE] - You can't talk while you're muted!");
if(strfind(str2, ":", true) != -1)
{
new i_numcount, i_period, i_pos;
while(str2[i_pos])
{
if('0' <= str2[i_pos] <= '9') i_numcount ++;
else if(str2[i_pos] == '.') i_period ++;
i_pos++;
}
if(i_numcount >= 8 && i_period >= 3)
{
new reason[128], str[112];
new Admin[24] = "Server";
format(reason,sizeof(reason),"Advertisement %s",str);
BanPlayer(playerid,reason,Admin);
}
}
else
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "[PM] To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, COLOR_YELLOW, str);
format(str, sizeof(str), "[PM] From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, COLOR_YELLOW, str);
format(str, sizeof(str), "PM From %s[%d] to %s[%d]: %s", Name1, playerid, Name2, id, str2);
SendMessageToAdmins(COLOR_GRAY,str);
}
printf("* PM -- From %s -- To %s -- MSG: %s", Name1, Name2, str2);
return 1;
}