PM command
#10

pawn Код:
CMD:pm(playerid, params[])
{
    new id, str[100];
    if(sscanf(params, "ds[100]", id, str)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /pm [id] [message]");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not connected");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself");
    if(!DND[id]) return SendClientMessage(playerid, COLOR_RED, "That player is in 'Do Not Disturb' mode!");
    new str2[144];
    format(str2, sizeof(str2), "PM to [%d]%s: %s", id, GetPlayerName(id), str);
    SendClientMessage(playerid, COLOR_YELLOW, str);
    format(str, sizeof(str), "PM from [%d]%s: %s", playerid, GetPlayerName(playerid), str);
    SendClientMessage(id, COLOR_YELLOW, str);
    SendClientMessage(id, -1, "Use "cyellow"/rpm [message] "cwhite"to reply to this PM");
    format(str2, sizeof(str2), "PM from %s[%d] to %s[%d]: %s", GetPlayerName(playerid), playerid, GetPlayerName(id), id, str);
    SendClientMessageToAll(COLOR_WHITE, str2); // SendClientMessageToAll? I don't think that's right...
    LastPm[id] = playerid;
    return 1;
}
If this still crashes your server, the problem is either:
DND[id]

or:
LastPm[id] = playerid;

Where 'id' is causing an out of bounds error.
Reply


Messages In This Thread
PM command - by KamalBa - 23.06.2015, 08:56
Re: PM command - by Hessu - 23.06.2015, 09:24
Re: PM command - by KamalBa - 23.06.2015, 09:41
Re: PM command - by KamalBa - 23.06.2015, 10:06
Re: PM command - by AndySedeyn - 23.06.2015, 10:11
Re: PM command - by KamalBa - 23.06.2015, 10:50
Re: PM command - by KamalBa - 23.06.2015, 10:54
Re: PM command - by KamalBa - 23.06.2015, 11:01
Re: PM command - by Hessu - 23.06.2015, 11:07
Re: PM command - by Threshold - 23.06.2015, 11:19

Forum Jump:


Users browsing this thread: 1 Guest(s)