SA-MP Forums Archive
[Help] /pm - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] /pm (/showthread.php?tid=82467)



[Help] /pm - borisblat - 18.06.2009

i tried to change a bit the "/pm" command
but when i do it, it sends my message to the recieverid, but send olso the regular message,
how can I disable the regular message?

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
new string[256], string2[256], p1[MAX_PLAYER_NAME], p2[MAX_PLAYER_NAME];
GetPlayerName(playerid, p1, sizeof(p1));
GetPlayerName(recieverid, p2, sizeof(p2));
format(string, sizeof(string), "You Sent PM to [ID:%d | %s]: %s", recieverid, p2, text);
SendClientMessage(playerid, LIGHTBLUE, string);
format(string2, sizeof(string2), "You Recived PM from [ID:%d | %s]: %s", playerid, p1, text);
SendClientMessage(recieverid, LIGHTBLUE, string2);

return 1;
}


Re: [Help] /pm - Grim_ - 18.06.2009

instead of returning 1, return 0;


Re: [Help] /pm - MenaceX^ - 18.06.2009

Also a correct code without useless arrays, espeicaly while you use 256 cells.
pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
  new string[128],p1[MAX_PLAYER_NAME],p2[MAX_PLAYER_NAME];
  GetPlayerName(playerid,p1,sizeof(p1));
  GetPlayerName(recieverid,p2,sizeof(p2));
  format(string,sizeof(string),"You Sent PM to [ID:%d | %s]: %s",recieverid,p2,text);
  SendClientMessage(playerid,LIGHTBLUE,string);
  format(string,sizeof(string),"You Recived PM from [ID:%d | %s]: %s",playerid,p1,text);
  SendClientMessage(recieverid,LIGHTBLUE,string);
  return 0;
}



Re: [Help] /pm - borisblat - 18.06.2009

but why is that like this?


Re: [Help] /pm - MenaceX^ - 18.06.2009

Be specific, I don't understand what you're asking.


Re: [Help] /pm - borisblat - 18.06.2009

why is that 0 and not 1?


Re: [Help] /pm - GTA_Rules - 18.06.2009

It means you return false.


Re: [Help] /pm - MenaceX^ - 18.06.2009

Quote:
Originally Posted by Matthias™
It means you return false.
Oh'rly?

return 1 keeps the regular PMing which is made by sa-mp, return 0 lets you use your own code on OnPlayerPrivMsg, if you just have the public returned with false, nothing in there. /pm and /msg won't work at all.