SA-MP Forums Archive
Problem With Color Chat Text - 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: Problem With Color Chat Text (/showthread.php?tid=435722)



Problem With Color Chat Text - BlazingKnife - 08.05.2013

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



Re: Problem With Color Chat Text - JaKe Elite - 08.05.2013

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.


Re: Problem With Color Chat Text - BlazingKnife - 08.05.2013

Ohk Thnx +rep


Re: Problem With Color Chat Text - BlazingKnife - 08.05.2013

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?


Re: Problem With Color Chat Text - IllidanS4 - 08.05.2013

Add else before the second if.


Re: Problem With Color Chat Text - BlazingKnife - 08.05.2013

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?


Re: Problem With Color Chat Text - Pooh7 - 08.05.2013

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;
}



Re: Problem With Color Chat Text - BlazingKnife - 08.05.2013

Finally Working
Thnx Dude +rep


Re: Problem With Color Chat Text - Guest4390857394857 - 21.02.2014

topic ended!!!

/lock the topic!