01.03.2015, 09:51
I have found the error in the code, but I am not clever enough to find the solution.
That is the code, and this is the problem.
Is there any alternative to this? Everytime I use /pm 2 hi (My ID being 1 as I have a NPC in-game.) I get [ERROR]: You can't PM yourself.
pawn Код:
CMD:pm(playerid, params[])
{
new pm1[128], pm2[128], text[128], targetid;
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: No one with that playerid is connected to the server!");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You can't PM yourself!");
if(sscanf(params, "us[128]", targetid, text)) return SendClientMessage(playerid, COLOR_RED, "[USAGE]: /pm <playerid> <Message>");
format(pm1, sizeof(pm1), "*PM SENT* %s[%d]: %s", PlayerName(playerid), playerid, text);
format(pm2, sizeof(pm2), "*PM RECEIVED* %s[%d]: %s", PlayerName(playerid), playerid, text);
SendClientMessage(playerid, COLOR_YELLOW, pm1);
SendClientMessage(targetid, COLOR_YELLOW, pm2);
return 1;
}
pawn Код:
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You can't PM yourself!");