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



[SOLVED]Admin Chat - vassilis - 03.02.2012

SOLVED.


Re: Admin Chat - -ExG-VirusKiller - 03.02.2012

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#' && PInfo[playerid][Level] > 0) {
      new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[ADMIN]%s: %s",string,text[1]); SendAdminMessage(red,string);
        return 0;      
        }
      return 1;
}

stock SendAdminMessage(color,const msg[])
{
   for (new i=0; i<MAX_PLAYERS; i++)
   {
      if (IsPlayerConnected(i) && PInfo[i][Level] > 0) SendClientMessage(i,color,msg);
   }
}
Try.


Re: Admin Chat - Wesley221 - 03.02.2012

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#' && PInfo[playerid][Level] <= 1) {
      new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[ADMIN]%s: %s",string,text[1]);
        SendAdminMessage(red,string);
        return 0; // this will stop the callback, and wont show the message in the public chat
      }
      return 1;
}
Check the comment.


Re: Admin Chat - vassilis - 03.02.2012

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#' && PInfo[playerid][Level] <= 1) {
      new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"[ADMIN]%s: %s",string,text[1]);
        SendAdminMessage(red,string);
        return 0; // this will stop the callback, and wont show the message in the public chat
      }
      return 1;
}
Check the comment.
i thought that way too and havent tested it yet..i just want to see if this way would be valid ok thanks wesley i will try it out

EDIT:Now it doesnt even send message to admins :P


Re: Admin Chat - Konstantinos - 03.02.2012

PInfo[playerid][Level] <= 1
Do you want Non Admins and Admins Level 1 see the message? Or mistake?


Re: Admin Chat - vassilis - 03.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
PInfo[playerid][Level] <= 1
Do you want Non Admins and Admins Level 1 see the message? Or mistake?
i want admins more and equal to level 1 to see the msg..


Re: Admin Chat - Konstantinos - 03.02.2012

<= means for Admins Level 1 and Less.
Change it to
>= 1 OR > 0

And return 0; as Wesley said, because it will send to non Admins too.


Re: Admin Chat - -ExG-VirusKiller - 03.02.2012

Thats what i said.vassilis have you tested my code?


Re: Admin Chat - vassilis - 03.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
<= means for Admins Level 1 and Less.
Change it to
>= 1 OR > 0

And return 0; as Wesley said, because it will send to non Admins.
a > b = a greater than b...
a < b = a smaller than b..
a <= b = a smaller or equal to b..
a >= b = a greater or equal to b.. are you sure?? i am not sure for that :/


Re: Admin Chat - Konstantinos - 03.02.2012

Lol vassili
That you posted is correct.