This not working?
#1

Hello,

When a player talks on my server i want it to show there ID aswell as name and text,
So i just wrote this piece of code that i thought would work, But it dosent seem to be,

pawn Код:
public OnPlayerText(playerid, text[])
{
    new playername;
    new string[300];
    new name[MAX_PLAYER_NAME];
    playername = GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "(%d): %s", playerid, text);
    SendPlayerMessageToAll(playername, string);
    return 0;
}

Ingame if i talk it dosent show a thing,
If i change return 0; to return 1; It shows what i say as it normally would
Reply
#2

pawn Код:
format(string, sizeof(string), "(%d): %s", playerid, text[0]);
      SendPlayerMessageToAll(playerid, string);
      return 0;
Reply
#3

Still dosent show anything
Reply
#4

Weird it works for me.Maybe too big string?
Reply
#5

Try to low your string, put something like
pawn Код:
new string[256];
Reply
#6

public OnPlayerText(playerid, text[])
{

SetPlayerChatBubble(playerid, text, 0xFB0000FF, 300.0, 10000);

return 1;
}



Try with this?
Reply
#7

Код:
public OnPlayerText(playerid, text[])
{
new string[128];
format(string, sizeof(string), "(%d): %s", playerid, text);
SendPlayerMessageToAll(0xFFFFFF, string);
return 0;
}
Just my guess
Reply
#8

Tried lowering string, Still not working
Reply
#9

Quote:
Originally Posted by Desert
Код:
public OnPlayerText(playerid, text[])
{
new string[128];
format(string, sizeof(string), "(%d): %s", playerid, text);
SendPlayerMessageToAll(0xFFFFFF, string);
return 0;
}
Just my guess
Quote:
Originally Posted by Torran
Tried lowering string, Still not working
This problem is rather frequent in longer scripts.
Try it so:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new
        bool:Chat = true,
        string[144];
    if(Chat)
    {
        format(string, sizeof(string), "(%d): %s", playerid, text);
        SendPlayerMessageToAll(playerid, string);
        return 0;
    }
    return 1;
}
Reply
#10

try this , not tested
Код:
public OnPlayerText(playerid, text[])
{
	new string[128], tmpname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, tmpname, sizeof(tmpname));
    format(string, sizeof(string), "%s(ID:%d): %s", tmpname,playerid, text[0]);
    
    return 1;
}
________
Vapor Brothers Vaporizer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)