PM Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PM Command (
/showthread.php?tid=359010)
PM Command -
CoDeZ - 12.07.2012
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?!
Re: PM Command -
Captain_Mani - 12.07.2012
What will say if you type /pmoff? Is that a valid command?
Re: PM Command -
CoDeZ - 12.07.2012
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;
}
Re: PM Command -
clarencecuzz - 12.07.2012
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]
Re: PM Command -
CoDeZ - 12.07.2012
*Epic fail*
*Face Palm*
Thank you mate!
Re: PM Command -
clarencecuzz - 12.07.2012
No Problems