Admin Chat
#1

SOLVED.
Reply
#2

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

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

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

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

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

<= 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.
Reply
#8

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

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 :/
Reply
#10

Lol vassili
That you posted is correct.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)