SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/01/2012, 10:55 AM   #1
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default OnPlayerText

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?
Face9000 is offline   Reply With Quote
Old 25/01/2012, 10:57 AM   #2
James Coral
Gangsta
 
James Coral's Avatar
 
Join Date: Sep 2011
Location: In San Fierro
Posts: 533
Reputation: 4
Default Re: OnPlayerText

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);
__________________
4System Gaming Community Is Back!
James Coral is offline   Reply With Quote
Old 25/01/2012, 11:02 AM   #3
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: OnPlayerText

Same
Face9000 is offline   Reply With Quote
Old 25/01/2012, 11:05 AM   #4
MasterJoker
Big Clucker
 
MasterJoker's Avatar
 
Join Date: Jan 2012
Location: Joker Place
Posts: 150
Reputation: 5
Default Re: OnPlayerText

Code:
- double message onplayertext
just make return 1; to return 0; to fix the problem.
__________________
Scripting Crazy GaGs!, Current finding a partner GM Tester for my GM

Give me some rep+ if i ever helped you

My Works
MasterJoker is offline   Reply With Quote
Old 25/01/2012, 11:12 AM   #5
Unte99
Gangsta
 
Unte99's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 627
Reputation: 65
Default Re: OnPlayerText

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;
}
Unte99 is offline   Reply With Quote
Old 25/01/2012, 07:37 PM   #6
Face9000
Banned
 
Join Date: Jan 2010
Location: Pigland
Posts: 3,351
Reputation: 190
Default Re: OnPlayerText

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.
Face9000 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
onplayertext xir Help Archive 11 22/02/2011 06:22 PM
Help in OnPlayerText MBX97 Help Archive 4 20/02/2011 09:51 PM
OnPlayerText ?? park4bmx Help Archive 4 20/02/2011 07:38 PM
OnPlayerText blackwave Help Archive 2 12/12/2010 02:13 PM
Help, onplayertext hab2ever Help Archive 3 07/07/2010 12:36 PM


All times are GMT. The time now is 01:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.