OnPlayerText
#1

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?
Reply
#2

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);
Reply
#3

Same
Reply
#4

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

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;
}
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)