Stopping PMs
#1

pawn Код:
if(ignoring[recieverid][playerid])
{
  SendClientMessage(playerid,COLOR_RED,"This player is ignoring you!");
  return 0;
}
Any idea why the PM still sends?
Reply
#2

Why are you doing ignoring[recieverid][playerid] when you could just do

pawn Код:
if(ignoring[receiverid]) { //stufff }
That might even be the problem.
Reply
#3

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;
}
Reply
#4

What are you returning at the end of OnPlayerPrivateMessage?
Reply
#5

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..
Reply
#6

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
Reply
#7

It doesn't work for me, silly question but, would linux cause it?
Reply
#8

Try returning 0 at the end of OnPlayerPrivateMessage, Then returning 1 in an else statement, See if that works
Reply
#9

return 0; should stop the PM.
Reply
#10

Did you try with return 1;?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)