Код:
CMD:pm(playerid, cmdtext[])
{
new idx = strfind(cmdtext, " ", true);
if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) {
SendClientMessage(playerid,COLOR_RED,"Usage: /pm [id] [message]");
return 1;
}
if(cmdtext[idx + 1] == EOS) {
SendClientMessage(playerid,COLOR_RED,"Usage: /pm [id] [message]");
return 1;
}
cmdtext[idx++] = EOS;
new
id = strval(cmdtext);
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,COLOR_RED,"Invalid Player ID");
return 1;
}
if(playerid == id) {
SendClientMessage(playerid,COLOR_RED,"You cannot PM yourself.");
return 1;
}
new
string[256];
if(TogPM{id} == 0) return SendClientMessage(playerid, COLOR_ERROR, "This player has turned off his PM's!");
else
GetPlayerName(id, string, MAX_PLAYER_NAME);
format(string, sizeof string, "[PM] sent to %s(%d): {FFFFFF}%s", string, id, cmdtext[idx]);
SendClientMessage(playerid, COLOR_RED, string);
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
format(string, sizeof string, "[PM] from %s(%d): {FFFFFF}%s", string, playerid, cmdtext[idx]);
SendClientMessage(id, COLOR_RED, string);
printf("PM: %s", cmdtext[idx]);
return 1;
}
shows the number line inside parentheses; for example: (line_number_here).
Goto that line and paste it here.
pawn Код:
if(isnull(cmdtext)) return SendClientMessage(playerid,COLOR_RED,"Usage: /pm [id] [message]");
// Assuming cmdtext is similar to "params".