Problem With Color Chat Text
#1

Hey Guys
this is my code which i wanted that when Admin types They get a Different Color
Код:
    if(pInfo[playerid][Admin] >= 3)
	{
      format(str, sizeof(str), "{A5CDCE}%s",text[0]);
      SendPlayerMessageToAll(playerid, str);
 	}
And the problem is i get Doubled Text
Reply
#2

add return 0;
If you want not to get double message for players too then return 0; OnPlayerText.
If you're not using any custom messages OnPlayerText then only return 0; on the code that you gave to us.
Reply
#3

Ohk Thnx +rep
Reply
#4

Sorry For Bump"
But still Not working Here's My Code
pawn Код:
public OnPlayerText(playerid, text[])
{
    new str[200];
    if(pInfo[playerid][Admin] >= 1)
    {
      format(str, sizeof(str), "{A5CDCE}%s",text[0]);
      SendPlayerMessageToAll(playerid, str);
    }
   
    if(pInfo[playerid][Admin] >= 0)
    {
    format(str, sizeof(str), "{FFFFFF}%s",text[0]);
    SendPlayerMessageToAll(playerid, str);
    }
   
    return 0;
}
And when a Player type's something in chat it only gives it once
But when admin type's something It gives it in twice?
Reply
#5

Add else before the second if.
Reply
#6

Now BOth Colors are White
I mean When admin types it gives it in the color white
and when player types it also gives it in color white?
Reply
#7

The first part checks if player's admin level is 1 or higher. The second check if player's admin level is 0 or higher.
If a player is admin, both checks will return true, so it will be display twice.

Change your code to this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new str[200];
    if(pInfo[playerid][Admin] >= 1)
    {
         format(str, sizeof(str), "{A5CDCE}%s",text[0]);
         SendPlayerMessageToAll(playerid, str);
    }
    else
    {
        format(str, sizeof(str), "{FFFFFF}%s",text[0]);
        SendPlayerMessageToAll(playerid, str);
    }
   
    return 0;
}
Reply
#8

Finally Working
Thnx Dude +rep
Reply
#9

topic ended!!!

/lock the topic!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)