SA-MP Forums Archive
NoPM - 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: NoPM (/showthread.php?tid=67727)



NoPM - Robbin237 - 03.03.2009

So.. the problem is, it says: Blablabla is not accepting priv. messages , but STILL sends the message you've typed. Which it shouldnt. So just say: Blablabla is not accepting private messages, and then DONT send the message. And the IsPlayerAdmin, is to make admins able to send pms to people, even though they have nopm on. Whats wrong? Please help.

Thanks!

pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
    new string[128];
    new Name[MAX_PLAYER_NAME+1];
   
    if(_Settings_NoPM[recieverid] == 1)
    {
      if(!IsPlayerAdmin(playerid)) {
            GetPlayerName(recieverid, Name, sizeof(Name));

            format(string, sizeof(string), "%s (%d) Is Not Accepting Private Messages At This Time.", Name, recieverid);
            SendClientMessage(playerid, 0xAA0000FF, string);
            return 0;
        }
    }
    return 1;
}



Re: NoPM - ICECOLDKILLAK8 - 03.03.2009

For the PM to not be sent the last return should return 0 not 1


Re: NoPM - Rks25 - 03.03.2009

Correct code.
pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
  new string[128],Name[MAX_PLAYER_NAME+1];
  if(_Settings_NoPM[recieverid] == 1)
  {
    if(!IsPlayerAdmin(playerid))
    {
      GetPlayerName(recieverid, Name, sizeof(Name));
      format(string, sizeof(string), "%s (%d) Is Not Accepting Private Messages At This Time.", Name, recieverid);
      SendClientMessage(playerid, 0xAA0000FF, string);
      return 0;
    }
  }
  return 0;
}



Re: NoPM - Nubotron - 03.03.2009

I see no difference at all, Rks_. You've just indented it


Re: NoPM - Rks25 - 03.03.2009

Note the return at last.


Re: NoPM - Robbin237 - 04.03.2009

But.. this doesnt work when i put it into a FS. It DOES work when i put it into a gamemode -- wtf?


Re: NoPM - ғαιιοцт - 04.03.2009

Quote:
Originally Posted by Robbin237
But.. this doesnt work when i put it into a FS. It DOES work when i put it into a gamemode -- wtf?
do you have errors?
or won't it just work? ...


Re: NoPM - Robbin237 - 04.03.2009

just wont work.


Re: NoPM - Robbin237 - 08.03.2009

bump


Re: NoPM - MenaceX^ - 08.03.2009

pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
  new string[128];
  new Name[MAX_PLAYER_NAME+1];
  if(_Settings_NoPM[recieverid] == false)
  {
     format(string, sizeof(string), "%s (%d) Is Not Accepting Private Messages At This Time.", Name, recieverid);
     SendClientMessage(playerid, 0xAA0000FF, string);
     return false;
  }
  return 1;
}