[HELP] OnPlayerText
#1

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

Reply
#3

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

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

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

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

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

What exactly do you mean "his world"?
Reply
#9

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
        }
    }
}
Reply
#10

Remove only (playerid !=i)
Reply
#11

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)