Stopping PMs - 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: Stopping PMs (
/showthread.php?tid=70588)
Stopping PMs -
Mikep - 25.03.2009
pawn Код:
if(ignoring[recieverid][playerid])
{
SendClientMessage(playerid,COLOR_RED,"This player is ignoring you!");
return 0;
}
Any idea why the PM still sends?
Re: Stopping PMs -
Pyrokid - 25.03.2009
Why are you doing ignoring[recieverid][playerid] when you could just do
pawn Код:
if(ignoring[receiverid]) { //stufff }
That might even be the problem.
Re: Stopping PMs -
Mikep - 25.03.2009
I need to check if the receiver is ignoring the sender, so I used a two dimensional array.
Besides, that's not the problem, the SendClientMessage sends, but the PM gets sent aswell..
This is the whole callback:
pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
if(dispm == true)
{
SendClientMessageToAllBut(playerid,COLOR_ORANGE,"PMs are disabled!");
return 0;
}
if(ignoring[recieverid][playerid])
{
SendClientMessage(playerid,COLOR_RED,"This player is ignoring you!");
return 0;
}
if(PMspam[playerid] == MAX_WARNS+1)
{
new pName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"%s has been kicked from the server (Reason: PM Spam)",pName);
SendClientMessageToAllBut(playerid,COLOR_ORANGE,string);
SendClientMessage(playerid,COLOR_RED, "You have been kicked for spam!");
Kick(playerid);
}
if(PMspam[playerid] < MAX_WARNS && PMspam[playerid] > 0)
{
PMspam[playerid]++;
KillTimer(PMspammer[playerid]);
SendClientMessage(playerid,COLOR_RED,"DO NOT SPAM!");
PMspammer[playerid] = SetTimerEx("PMunspam",PM_WAIT*1000, false, "i", playerid);
return 0;
}
if(PMspam[playerid] == 0)
{
PMspam[playerid]++;
KillTimer(PMspammer[playerid]);
PMspammer[playerid] = SetTimerEx("PMunspam",PM_WAIT*1000, false, "i", playerid);
}
if(pmon[recieverid] == 0)
{
SendClientMessage(playerid,COLOR_RED,"ERROR: This player has disabled Private messages!");
return 0;
}
#if PM_SOUND == 1
if(pmallowed[recieverid] == 1)
{
PlayerPlaySound(recieverid,1085,0.0,0.0,0.0);
PlayerPlaySound(recieverid,1085,0.0,0.0,0.0);
PlayerPlaySound(recieverid,1085,0.0,0.0,0.0);
}
#endif
return 1;
}
Re: Stopping PMs -
ICECOLDKILLAK8 - 25.03.2009
What are you returning at the end of OnPlayerPrivateMessage?
Re: Stopping PMs -
Mikep - 25.03.2009
1, see last post.
Whoever fixes it will get credits
It's either a bug or something REALLY simple that I just can't see..
Re: Stopping PMs -
Pyrokid - 25.03.2009
Uh I just tested the nopms script I posted in some other thread and it works like a charm.
http://forum.sa-mp.com/index.php?top...6152#msg606152
Re: Stopping PMs -
Mikep - 25.03.2009
It doesn't work for me, silly question but, would linux cause it?
Re: Stopping PMs -
ICECOLDKILLAK8 - 25.03.2009
Try returning 0 at the end of OnPlayerPrivateMessage, Then returning 1 in an else statement, See if that works
Re: Stopping PMs -
Mikep - 25.03.2009
return 0; should stop the PM.
Re: Stopping PMs -
Dujma - 25.03.2009
Did you try with return 1;?