Bug in script but don't know what.
#1

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    if(text[0] == '@')
    {
        format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

      for(new j = 0; j < MAX_PLAYERS; j++)
        {
            if(IsPlayerConnected(j) && pInfo[j][level] > 0) SendClientMessage(j, COLOR_NOTICE, string);
        }
        return 0;
    }
If normal players type @message all admins can read it. But the players can't. How to get it that they can't talk in the admin chat?
Reply
#2

I don't know if it works, but try this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    if(text[0] == '@')
    {
        format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && pInfo[i][level] > 0) return SendClientMessage(i, COLOR_NOTICE, string);
        }
    }    
    return 0;
}
Reply
#3

Quote:
Originally Posted by Seif_
Add IsPlayerAdmin.
He uses
pawn Код:
pInfo[i][level]
instead of
pawn Код:
IsPlayerAdmin
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    if(text[0] == '@' && pInfo[j][level] > 0) //Won't let the next part happen, unless the person's "level" is more than 0
    {
        format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

      for(new j = 0; j < MAX_PLAYERS; j++)
        {
            if(IsPlayerConnected(j) && pInfo[j][level] > 0) SendClientMessage(j, COLOR_NOTICE, string);
        }
        return 0;
    }
Try that, Sorry if it doesn't work, I haven't done much Pawn coding recently.
Reply
#5

Oops, EDIT:
Код:
public OnPlayerText(playerid, text[])
{
	new string[256];
	if(text[0] == '@')
	{
		if(pInfo[playerid][level] >= 1) return SendClientMessage(playerid,0xFF0000AA, "You cant talk here...");
  		format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

	  for(new j = 0; j < MAX_PLAYERS; j++)
		{
			if(IsPlayerConnected(j) && pInfo[j][level] > 0) SendClientMessage(j, COLOR_NOTICE, string);
	 	}
	 	return 0;
	}
Reply
#6

Quote:
Originally Posted by GTAguillaume
Код:
public OnPlayerText(playerid, text[])
{
	new string[256];
	if(text[0] == '@')
	{
  		format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

	  for(new j = 0; j < MAX_PLAYERS; j++)
		{
			if(IsPlayerConnected(j) && pInfo[j][level] > 0) SendClientMessage(j, COLOR_NOTICE, string);
	 	}
	 	SendClientMessage(playerid,string); //:P
	 	return 0;
	}
if(IsPlayerConnected(j) && pInfo[j][level] > 0) SendClientMessage(j, COLOR_NOTICE, string);

-.-
Reply
#7

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by AivaMan
Quote:
Originally Posted by Seif_
Add IsPlayerAdmin.
He uses
pawn Код:
pInfo[i][level]
instead of
pawn Код:
IsPlayerAdmin
Obviously not. Read his code.
Okay, then try this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    if(text[0] == '@')
    {
        format(string, sizeof(string), "[Team Admin Chat] %s[%i]: %s", pInfo[playerid][name], playerid, text[1]);

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && IsPlayerAdmin(i)) return SendClientMessage(i, COLOR_NOTICE, string);
        }
    }    
    return 0;
}
But then the message will be only visible to RCON Admins.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)