OnPlayerText
#1

pawn Code:
format(string, sizeof(string), "[%d]: {ffffff}%s",playerid,text);
SendPlayerMessageToAll(playerid,string);
If i use this,when i put numbers after the sentence ,example "hi 12" the player id doesn't show up anymore.
If i use numbers in front of the word it shows up. Why is that?
Same happens on IRC.
Reply
#2

Can you show more code from the OnPlayerText callback? Maybe the string is too small?
Reply
#3

pawn Code:
public OnPlayerText(playerid, text[])
{
    new pname[24];
    new string[256];
    GetPlayerName(playerid,pname,sizeof(pname));


    if(stringContainsIP(text))
    {
        GetPlayerName(playerid, pname, 24);
        format(string, sizeof string, "{F20056}[GUARDIAN]: {ffffff}%s[%d] has been banned from the server. {F20056}Reason: {ffffff}Server Advertise", pname,playerid);
        SendClientMessageToAll(COLOR_RED, string);
        Ban(playerid);
        return 0;
    }
    //SPAM
    SpamStrings[playerid] +=2;

    //If Muted
    if(IsMuted[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_YELLOW,"{990033}[SERVER]{808080}: You are muted by a Server Administrator. You cannot speak.");
        return 0;
    }
    //If Spamming
    else if(SpamStrings[playerid] >= MAX_SPAM)
    {
        SendClientMessage(playerid, COLOR_ERROR,"{990033}[SERVER]{808080}: Please do not spam. Please wait before typing again.");
        return 0;
    }
    else if (text[0] == '@')
    {
        if(HasLawEnforcementRadio[playerid] != 1)
        {
            SendClientMessage(playerid,COLOR_YELLOW,"{990033}[SERVER]{808080}: You need to have a Law Enforcement radio in order to send a message down the police radio.");
            return 0;
        }
        format(string,sizeof(string),"[POLICE RADIO]: {6699CC}%s[%d]: %s, over.",pname,playerid,text[1]);
        SendClientMessageToAllCops(string);
        format(string,sizeof(string),"12[POLICE RADIO] %s[%d]: %s, over.",pname,playerid,text[1]);
        IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
        return 0;
    }
    else if(text[0] == '!')
    {
        if(InGroup[playerid] != -1)
        {
            format(string,sizeof(string),"%s %s[%d]{FFFFFF}: %s",GetPlayerRankName(playerid),pname,playerid,text[1]);
            SendGroupMessage(InGroup[playerid],string);
            format(string,sizeof(string),"12[%s Chat] %s[%d]: %s",GroupInfo[InGroup[playerid]][GroupName],pname,playerid,text[1]);
            IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
            return 0;
        }
    }
    else if(text[0] == '#')
    {
        if(AdminLevel[playerid] < 1) return SendClientMessage(playerid,COLOR_YELLOW,"{990033}[SERVER]{808080}: You are not allowed to use this command");
        format(string,sizeof(string),"4[ADMIN CHAT] %s[%d]: %s",PlayerName(playerid),playerid,text[1]);
        IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(AdminLevel[i] >= 1)
            {
                format(string,sizeof(string),"{F20056}[ADMIN CHAT]{FFFFFF}: %s[%d]: %s",PlayerName(playerid),playerid,text[1]);
                SendClientMessage(i,COLOR_ADMIN,string);
            }
        }
        return 0;
    }
    else if(text[0] == '$')
    {
        if(playerInfo[playerid][VIP] < 1) return SendClientMessage(playerid,COLOR_YELLOW,"{990033}[SERVER]{808080}: You are not allowed to use this command");
        format(string,sizeof(string),"4[VIP CHAT] %s[%d]: %s",PlayerName(playerid),playerid,text[1]);
        IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(playerInfo[playerid][VIP] >= 1)
            {
                format(string,sizeof(string),"{F20056}[VIP CHAT]: {FFFFFF}%s[%d]: %s",PlayerName(playerid),playerid,text[1]);
                SendClientMessage(i,COLOR_ADMIN,string);
            }
        }
        return 0;
    }
    else {
        format(string, sizeof(string), "[%d]: {ffffff}%s",playerid,text);
        SendPlayerMessageToAll(playerid,string);
        //format(string, sizeof(string), "%s[%d]: {FFFFFF}%s",pname,playerid,text);
        //SendPlayerMessageToAll(playerid,string);
        //IRC Message
        format(string,sizeof(string),"3[CHAT] %d %s[%d]:1 %s",IrcColor[playerid],pname,playerid,text);
        IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    }
    return 0;
}
Reply
#4

Try using Client Messages as a pose to Player Messages.
Reply
#5

It's the same.
Reply
#6

Show a screenshot of the output in-game so I can see what actually is showing.
Reply
#7

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)