Onplayertext
#1

I'm trying to make it shows the playerid in front of their name
pawn Код:
public OnPlayerText(playerid, text[])
{
    GetPlayerName(playerid,Nam,sizeof(Nam));
    if(PlayerData[playerid][Member] == -255)
    {
        format(query,sizeof(query),"%s[%d]: %s",Nam,playerid,text);
        SendClientMessageToAll(-1,query);
    }
    if(PlayerData[playerid][Member] > 0)
    {
        format(query,sizeof(query),"%s[%d]:{FFFFFF} %s",Nam,playerid,text);
        SendClientMessageToAll(HexToInt(OrgInfo[PlayerData[playerid][Member]][Color]),query);
    }
it sends the message 2 times
"%s[%d]: %s"
"%s: %s"
Reply
#2

You should use 'else' if I'm right, and not twice 'if' on the way how you've done it.
Reply
#3

but at the same time there cant be someone with -255 and over 0
Reply
#4

Return 0 at the end of OnPlayerText
Reply
#5

return 0 at the end so it never sends the original message. Or return 0 whenever your if has sent what it needs to send.
Reply
#6

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(PlayerData[playerid][Member] == -255)
    {
        format(string, sizeof(string), "[%d]%s:%s",playerid, pName, text);
        SCMTA(COLOR_WHITE, string);
        return 0;
    }
    else if(PlayerData[playerid][Member] > 0)
    {
        format(query,sizeof(query),"%s[%d]:{FFFFFF} %s",Nam,playerid,text);
        SCMTA(HexToInt(OrgInfo[PlayerData[playerid][Member]][Color]),query);
        return 0;
    }
    return 0;
}
Might work, Not sure though.
Reply
#7

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)