PM Command
#1

pawn Код:
CMD:pm(playerid,params[])
{
    new PID,p_Send[24],p_Rec[24],str[128],str2[128],Message[100];
    if(PM_Enabled[playerid]==0) return SendClientMessage(playerid,COLOR_RED,"This player has disabled his pm");
    else if(PM_Enabled[playerid]==1)
    {
        if(sscanf(params,"us[100]",PID,Message)) return SendClientMessage(playerid,COLOR_GREEN,"USAGE:/pm playerid message");
        if(isnull(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/pm playerid message");
        if(PID==playerid) return SendClientMessage(playerid,COLOR_RED,"You can't pm your self.");
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid,COLOR_RED,"This player is not connected.");
        GetPlayerName(PID,p_Rec,24);
        format(str2,sizeof(str),"Pm To "#COL_GREEN"%s[%d]:%s",p_Rec,PID,Message);
        SendClientMessage(playerid,COLOR_RED,str);
        GetPlayerName(playerid,p_Send,24);
        format(str,sizeof(str2),"Pm From "#COL_GREEN"%s[%d]:%s",p_Send,playerid,Message);
        SendClientMessage(PID,COLOR_YELLOW,str2);
    }
    return 1;
}
When i use /pmoff , it still send the message :/
WAI?!
Reply
#2

What will say if you type /pmoff? Is that a valid command?
Reply
#3

yes its a valid command , and its working

Here
pawn Код:
CMD:pmon(playerid,params[])
{
    if(PM_Enabled[playerid]==1) return SendClientMessage(playerid,COLOR_RED,"Your PM is already enabled");
    else if (PM_Enabled[playerid]==0)
    {
        PM_Enabled[playerid]=1;
        SendClientMessage(playerid,COLOR_GREEN,"You've enabled your PM");
    }
    return 1;
}
CMD:pmoff(playerid,params[])
{
    if(PM_Enabled[playerid]==0) return SendClientMessage(playerid,COLOR_RED,"Your pm is already off");
    else if (PM_Enabled[playerid]==1)
    {
        PM_Enabled[playerid]=0;
        SendClientMessage(playerid,COLOR_GREEN,"You've disabled your pm");
    }
    return 1;
}
Reply
#4

pawn Код:
CMD:pm(playerid,params[])
{
    new PID,p_Send[24],p_Rec[24],str[128],str2[128],Message[100];
    if(PM_Enabled[PID]==0) return SendClientMessage(playerid,COLOR_RED,"This player has disabled his pm");
    else if(PM_Enabled[PID]==1)
    {
        if(sscanf(params,"us[100]",PID,Message)) return SendClientMessage(playerid,COLOR_GREEN,"USAGE:/pm playerid message");
        if(isnull(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/pm playerid message");
        if(PID==playerid) return SendClientMessage(playerid,COLOR_RED,"You can't pm your self.");
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid,COLOR_RED,"This player is not connected.");
        GetPlayerName(PID,p_Rec,24);
        format(str2,sizeof(str),"Pm To "#COL_GREEN"%s[%d]:%s",p_Rec,PID,Message);
        SendClientMessage(playerid,COLOR_RED,str);
        GetPlayerName(playerid,p_Send,24);
        format(str,sizeof(str2),"Pm From "#COL_GREEN"%s[%d]:%s",p_Send,playerid,Message);
        SendClientMessage(PID,COLOR_YELLOW,str2);
    }
    return 1;
}
You had: PM_Enabled[playerid] instead of PM_Enabled[PID]
Reply
#5

*Epic fail*
*Face Palm*
Thank you mate!
Reply
#6

No Problems
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)