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



[HELP] OnPlayerText - TheBluec0de - 09.06.2012

hey, i have found 1 bug.... send two message. i have changed the return 1; in return 0; ... but nothing else don't work

and i have changed in return 1; but don't send the message

example:

Bluec0de: Text example
Bluec0de: Text example

all onplayertext

Code:
public OnPlayerText(playerid, text[]) {
	// 
    new
        iText;
    while (text[iText++])
    {
        if ('A' <= text[iText] <= 'Z') text[iText] |= 0x20;
    }
    // 
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if((GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) && (playerid !=i))
            {
                new
		            s[128];
                format(s, sizeof(s), "%s: "#EMB_COL_WHITE"%s", name(playerid), text);
                SendClientMessage(i, GetPlayerColor(playerid), s);
            }
        }
    }
    return 0;
}



Re: [HELP] OnPlayerText - TheBluec0de - 09.06.2012




Re : [HELP] OnPlayerText - ricardo178 - 09.06.2012

What a confused code.. Doesn't it show an error here? xD

Try this:
pawn Code:
format(s, sizeof(s), "%s: #EMB_COL_WHITE %s", name(playerid), text);



Re: [HELP] OnPlayerText - Elysian` - 09.06.2012

I don't even know what the code even does, it's all over the place


Re: [HELP] OnPlayerText - TheBluec0de - 09.06.2012

Quote:
Originally Posted by Windows32
View Post
I don't even know what the code even does, it's all over the place
yes..


Re: [HELP] OnPlayerText - Elysian` - 09.06.2012

so it repeats?
Use the default one then:
pawn Code:
public OnPlayerText(playerid, text[])
{
    new string[128];
    format(string, sizeof(string), "%s(%d): %s", PlayerName, playerid, text);
    SendClientMessage(playerid, COLORHERE, string);
    return 1;
}



Re: [HELP] OnPlayerText - JhnzRep - 09.06.2012

He wants it to send the code to only people in his world. I recommend you download foreach and do it.


Re: [HELP] OnPlayerText - Elysian` - 09.06.2012

What exactly do you mean "his world"?


Re: [HELP] OnPlayerText - JhnzRep - 09.06.2012

What he means by his world is, virtualworld.

pawn Code:
public OnPlayerText(playerid, text[])
{
    foreach(Player, i)
    {
        if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)
        {
            //blah blah lbah
        }
    }
}



Re: [HELP] OnPlayerText - Jefff - 09.06.2012

Remove only (playerid !=i)


Re: [HELP] OnPlayerText - ReneG - 09.06.2012

Quote:
Originally Posted by ricardo178
View Post
What a confused code.. Doesn't it show an error here? xD

Try this:
pawn Code:
format(s, sizeof(s), "%s: #EMB_COL_WHITE %s", name(playerid), text);
There is nothing wrong with that code.
pawn Code:
#define #EMB_COL_WHITE "{FFFFFF}"

format(s, sizeof(s), "%s: "#EMB_COL_WHITE" %s", name(playerid), text);
He's just inserting an embedded color with format?


Re: [HELP] OnPlayerText - TheBluec0de - 10.06.2012

Quote:
Originally Posted by VincentDunn
View Post
There is nothing wrong with that code.
pawn Code:
#define #EMB_COL_WHITE "{FFFFFF}"

format(s, sizeof(s), "%s: "#EMB_COL_WHITE" %s", name(playerid), text);
He's just inserting an embedded color with format?
yes..