SA-MP Forums Archive
Custom Text Sending Error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Custom Text Sending Error (/showthread.php?tid=204916)



Custom Text Sending Error - jameskmonger - 30.12.2010

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128];
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    if(!hasDied[playerid]) {
        if(gTeam[playerid] == TEAM_GROVE) {
            format(string, sizeof(string), "{00FF00}%s: {FFFFFF}%s", GetPlayerColor(playerid), name,COLOR_WHITE, text);
            for(new i; i>playersOnlineCount; i++) {
                if(gTeam[playerid] == gTeam[i])
                {
                    format(string, sizeof(string), "{00FF00}%s: {FFFFFF}%s", GetPlayerColor(playerid), name,COLOR_WHITE, text);
                    SendClientMessage(i, 0xFFFFFFFF, string);
                }
            }
            SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
        else if(gTeam[playerid] == TEAM_BALLA) {
            format(string, sizeof(string), "{FF00FF}%s: {FFFFFF}%s", GetPlayerColor(playerid), name,COLOR_WHITE, text);
            for(new i; i>playersOnlineCount; i++) {
                if(gTeam[playerid] == gTeam[i])
                {
                    format(string, sizeof(string), "{FF00FF}%s: {FFFFFF}%s", GetPlayerColor(playerid), name,COLOR_WHITE, text);
                    SendClientMessage(i, 0xFFFFFFFF, string);
                }
            }
            SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
    } else {
        format(string, sizeof(string), "{808080}%s: {FFFFFF}%s", COLOR_GREY,name,COLOR_WHITE, text);
        for(new i; i>playersOnlineCount; i++) {
            if(hasDied[i]) {
                format(string, sizeof(string), "{808080}%s: {FFFFFF}%s", COLOR_GREY,name,COLOR_WHITE, text);
                SendClientMessage(i, 0xFFFFFFFF, string);
            }
        }
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    return 0;
}
That is my code, and theoretically, if I join the server under the name of "James" and say "Hello!", and join under the Grove team, I should get this message:
Quote:
James: Hello!
But for some reason, it says this:



Re: Custom Text Sending Error - legodude - 30.12.2010

it is because you only have two placeholders and four vars at the end of the format. change the colours etween curly brackets to the hexx placeholder... i dont have a fucking percent key on ma phone...


Re: Custom Text Sending Error - jameskmonger - 30.12.2010

Ah crap, I'm stupid. Sorry, lock this please.