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



OnPlayerText - Face9000 - 25.01.2012

Hello,so i've this code:

pawn Code:
public OnPlayerText(playerid, text[])
{
    SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 5000);
    if(gTeam[playerid] == COP)
    {
        SendClientMessageToAll(lightblue, text);
    }

    if(gTeam[playerid] == CIV)
    {
        SendClientMessageToAll(white, text);
    }
    return 1;
}
I've 1 code and 2 problems.

1st: It sends double messages like in this screen: http://i41.tinypic.com/js1xlx.jpg

2nd: It doesn't show the right team color.For COP team is Lightblue,for CIV team is White.Both team it sends lightblue.

What's wrong?


Re: OnPlayerText - James Coral - 25.01.2012

pawn Code:
public OnPlayerText(playerid, text[])
{
    SetPlayerChatBubble(playerid, "text", 0xFF0000FF, 100.0, 5000);
    if(gTeam[playerid] == COP)
    {
        SendClientMessageToAll(lightblue, "Text");
    }

    if(gTeam[playerid] == CIV)
    {
        SendClientMessageToAll(white, "text");
    }
    return 1;
}
And For COP Color use

pawn Code:
SetPlayerColor(playerid,COLOR_BLUE);



Re: OnPlayerText - Face9000 - 25.01.2012

Same


Re: OnPlayerText - MasterJoker - 25.01.2012

Code:
- double message onplayertext
just make return 1; to return 0; to fix the problem.


Re: OnPlayerText - Unte99 - 25.01.2012

Quote:
Originally Posted by MasterJoker
View Post
just make return 1; to return 0; thats all

Logitech90 don't follow his code its wrong just change return 1; to return 0;
Your solution won't work either. In this situation, he has to return something in those checks. Of he doesn't return, then the codel will continue.

It should look like this:

pawn Code:
public OnPlayerText(playerid, text[])
{    
    SetPlayerChatBubble(playerid, text, 0xFF0000FF, 100.0, 5000);    
    if(gTeam[playerid] == COP)    
    {        
        SendClientMessageToAll(lightblue, text);
        return 1;    
    }    
    if(gTeam[playerid] == CIV)    
    {        
        SendClientMessageToAll(white, text);
        return 1;    
    }    
    return 1;
}



Re: OnPlayerText - Face9000 - 25.01.2012

Quote:
Originally Posted by ******
View Post
And what's with all the trailing whitespace?
Thanks,the trailing whitespace is for my person instrucions if i need to add more teams.