Help with WatchPM Command
#1

Hey guys. I made a watchpm ccommand for my pm system but its not working.

Pm command:

Код:
dcmd_pm(playerid, params[])
{
	new pID, text[128], string[128];
	if(sscanf(params, "us[128]", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message)");
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not joined.");
	if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cant pm yourself.");
	format(string, sizeof(string), "%s (%d) not accepting private messages now.", PlayerName(pID), pID);
	if(PMInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
	format(string, sizeof(string), "PM Sent %s(%d): %s", PlayerName(pID),pID, text);
	SendClientMessage(playerid, COLOR_YELLOW, string);
	format(string, sizeof(string), "PM %s(%d): %s", PlayerName(playerid),playerid, text);
	SendClientMessage(pID, COLOR_YELLOW, string);
  for(new i = 0; i < MAX_PLAYERS; i ++) 
    {
if(PmWatch[playerid][i]==1)
{
   	format(string, sizeof(string), "[PM Watch] %s(%d) >> %s(%d): %s", PlayerName(playerid),playerid,PlayerName(pID),pID, text);
	SendClientMessage(i, COLOR_GREY, string);     
}
    }
	PMInfo[pID][Last] = playerid;
	return 1;
}
/Watchpmon and /watchpmoff command:
Код:
dcmd_watchpmon(playerid,params[])
{
#pragma unused params
new ID;
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)");

if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Player is not joined.");

if(PmWatch[playerid][ID]==1) return SendClientMessage(playerid, COLOR_ERROR, "You have already wathing player's private messages");

PmWatch[playerid][ID]=1;
SendClientMessage(playerid,COLOR_ADMIN,"Watch PM: Turned on.");

return 1;
}

dcmd_watchpmoff(playerid,params[])
{
#pragma unused params
new ID;
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmoff (id)");

if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Player is not joined.");

if(PmWatch[playerid][ID]==0) return SendClientMessage(playerid, COLOR_ERROR, "Wath pm have already off.");

PmWatch[playerid][ID]=0;

SendClientMessage(playerid,COLOR_ADMIN,"Watch pm: Turned off");

return 1;
}
Please help me
Reply
#2

Код:
new ID;
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)");
I am wondering, why are you asking for an ID parameter when you are not even using it?
Reply
#3

Quote:
Originally Posted by Sellize
Посмотреть сообщение
Код:
new ID;
	if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)");
I am wondering, why are you asking for an ID parameter when you are not even using it?
Because I want watch one person's private messages. not everyone
Reply
#4

pawn Код:
dcmd_pm(playerid, params[])
{
    new pID, text[128], string[128];
    if(sscanf(params, "us[128]", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message)");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not joined.");
    if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cant pm yourself.");
    format(string, sizeof(string), "%s (%d) not accepting private messages now.", PlayerName(pID), pID);
    if(PMInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
    format(string, sizeof(string), "PM Sent %s(%d): %s", PlayerName(pID),pID, text);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "PM %s(%d): %s", PlayerName(playerid),playerid, text);
    SendClientMessage(pID, COLOR_YELLOW, string);
    for(new i = 0; i != MAX_PLAYERS; i++)
    {
        if(PmWatch[i][playerid] == 1) // You were checking [playerid][i] instead of this.
        {
            format(string, sizeof(string), "[PM Watch] %s(%d) >> %s(%d): %s", PlayerName(playerid),playerid,PlayerName(pID),pID, text);
            SendClientMessage(i, COLOR_GREY, string);    
        }
    }
    PMInfo[pID][Last] = playerid;
    return 1;
}
This should probably work.
Reply
#5

Its working. Thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)