OnPlayerText
#1

When i use the code like this, then the "Try to short down your text, Please" work (but not the code under)
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    if(text[72] > 72)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Try to short down your text, Please");
        return 0;
    }
   
    //(code under)
    format(string, sizeof(string), "(%d) %s", playerid, text);
    SendPlayerMessageToAll(playerid, string);
    return 0;
}
If i use the colde like this:
Then the "Unknown: (0) Yoo wazzup.
work
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    /*if(text[72] > 72)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Try to short down your text, Please");
        return 0;
    }*/

   
    //(code under)
    format(string, sizeof(string), "(%d) %s", playerid, text);
    SendPlayerMessageToAll(playerid, string);
    return 0;
}
//look under "//code under" ther is my code
i want it to work like this:
Unknown(0): Your text...

but now it is like this
Unknown: (0) Your text...
Reply
#2

pawn Код:
if(text[72] > 72)
should be
pawn Код:
if(strlen(text) > 72)
Reply
#3

Quote:
Originally Posted by Krx17
Посмотреть сообщение
pawn Код:
if(text[72] > 72)
should be
pawn Код:
if(strlen(text) > 72)
Thanks, You know how to fix chat too?

Unknown(0): Yoo Wazzup!
Reply
#4

Try this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], pName[MAX_PLAYER_NAME];
    if(strlen(text) > 72)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Try to short down your text, Please");
        return 0;
    }

    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "%s(%d): %s", pName, playerid, text);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 0;
}
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Try this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], pName[MAX_PLAYER_NAME];
    if(strlen(text) > 72)
    {
        SendClientMessage(playerid, 0xFF0000FF, "Try to short down your text, Please");
        return 0;
    }

    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "%s(%d): %s", pName, playerid, text);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 0;
}
Thnx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)