/hbadge
#1

What I want to do is create my /hbadge to a string so that I can place the values in it.

pawn Код:
CMD:hbadge(playerid, params[])
{
    if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
    {
        if(IsPlayerConnected(playerid))
        {
            if(isnull(params)) {
                SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hbadge [factionid]");
                SendClientMessageEx(playerid, COLOR_WHITE, string);
                format(string, sizeof(string), "|1 %s |2 %s |3 %s |4 %s |5 %s", faction1name, faction2name, faction3name, faction4name, faction5name);
                SendClientMessageEx(playerid, COLOR_GRAD3, string);
                format(string, sizeof(string), "|6 %s |7 %s |8 %s |9 %s", faction6name, faction7name, faction8name, faction9name);
                SendClientMessageEx(playerid, COLOR_GRAD2, string);
                format(string, sizeof(string), "|10 %s |11 %s |12 %s", faction10name, faction11name, faction12name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
                format(string, sizeof(string), "|13 %s | 0 Badge off", faction13name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
                return 1;
            }
            if(strcmp(params,"1",true) == 0)
            {
                SetPlayerColor(playerid, faction1badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction1name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"2",true) == 0)
            {
                SetPlayerColor(playerid, faction2badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction2name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"3",true) == 0)
            {
                SetPlayerColor(playerid, faction3badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction3name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"4",true) == 0)
            {
                SetPlayerColor(playerid, faction4badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction4name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"5",true) == 0)
            {
                SetPlayerColor(playerid, faction5badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction5name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"6",true) == 0)
            {
                SetPlayerColor(playerid, faction6badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction6name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"7",true) == 0)
            {
                SetPlayerColor(playerid, faction7badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction7name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"9",true) == 0)
            {
                SetPlayerColor(playerid, faction9badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction9name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"10",true) == 0)
            {
                SetPlayerColor(playerid, faction10badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction10name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"11",true) == 0)
            {
                SetPlayerColor(playerid, faction11badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction11name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"12",true) == 0)
            {
                SetPlayerColor(playerid, faction12badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction12name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"13",true) == 0)
            {
                SetPlayerColor(playerid,COLOR_NOOSE);
                SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
            }
            else if(strcmp(params,"0",true) == 0)
            {
                SetPlayerColor(playerid,TEAM_HIT_COLOR);
                SendClientMessageEx(playerid, COLOR_WHITE, "You're badge has been removed");
            }
        }
    }
    return 1;
}
BOOSH! Warning.

Код:
C:\Users\Randy\Desktop\Jacob's Server (Mine)\gamemodes\KG.pwn(34105) : error 017: undefined symbol "string"
C:\Users\Randy\Desktop\Jacob's Server (Mine)\gamemodes\KG.pwn(34106) : error 017: undefined symbol "string"
C:\Users\Randy\Desktop\Jacob's Server (Mine)\gamemodes\KG.pwn(34106) : error 017: undefined symbol "string"
C:\Users\Randy\Desktop\Jacob's Server (Mine)\gamemodes\KG.pwn(34106) : error 029: invalid expression, assumed zero
C:\Users\Randy\Desktop\Jacob's Server (Mine)\gamemodes\KG.pwn(34106) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Try this:

pawn Код:
CMD:hbadge(playerid, params[])
{
    new string[255];
    if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
    {
        if(IsPlayerConnected(playerid))
        {
            if(isnull(params)) {
                SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hbadge [factionid]");
                SendClientMessageEx(playerid, COLOR_WHITE, string);
                format(string, sizeof(string), "|1 %s |2 %s |3 %s |4 %s |5 %s", faction1name, faction2name, faction3name, faction4name, faction5name);
                SendClientMessageEx(playerid, COLOR_GRAD3, string);
                format(string, sizeof(string), "|6 %s |7 %s |8 %s |9 %s", faction6name, faction7name, faction8name, faction9name);
                SendClientMessageEx(playerid, COLOR_GRAD2, string);
                format(string, sizeof(string), "|10 %s |11 %s |12 %s", faction10name, faction11name, faction12name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
                format(string, sizeof(string), "|13 %s | 0 Badge off", faction13name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
                return 1;
            }
            if(strcmp(params,"1",true) == 0)
            {
                SetPlayerColor(playerid, faction1badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction1name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"2",true) == 0)
            {
                SetPlayerColor(playerid, faction2badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction2name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"3",true) == 0)
            {
                SetPlayerColor(playerid, faction3badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction3name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"4",true) == 0)
            {
                SetPlayerColor(playerid, faction4badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction4name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"5",true) == 0)
            {
                SetPlayerColor(playerid, faction5badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction5name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"6",true) == 0)
            {
                SetPlayerColor(playerid, faction6badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction6name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"7",true) == 0)
            {
                SetPlayerColor(playerid, faction7badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction7name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"9",true) == 0)
            {
                SetPlayerColor(playerid, faction9badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction9name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"10",true) == 0)
            {
                SetPlayerColor(playerid, faction10badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction10name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"11",true) == 0)
            {
                SetPlayerColor(playerid, faction11badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction11name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"12",true) == 0)
            {
                SetPlayerColor(playerid, faction12badge);
                format(string, sizeof(string), "You've put your fake %s badge on", faction12name);
                SendClientMessageEx(playerid, COLOR_GRAD1, string);
            }
            else if(strcmp(params,"13",true) == 0)
            {
                SetPlayerColor(playerid,COLOR_NOOSE);
                SendClientMessageEx(playerid, COLOR_WHITE, "Badge on.");
            }
            else if(strcmp(params,"0",true) == 0)
            {
                SetPlayerColor(playerid,TEAM_HIT_COLOR);
                SendClientMessageEx(playerid, COLOR_WHITE, "You're badge has been removed");
            }
        }
    }
    return 1;
}
Reply
#3

Try this one


pawn Код:
CMD:hbadge(playerid, params[]) {
    if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4) {
        if(isnull(params)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hbadge [faction]");
            SendClientMessage(playerid, COLOR_GRAD3, "|0 Normal |1 LSPD |2 FBI |3 LSFMD ");
        }
        else switch(strval(params)) {
            case 0: {
                SendClientMessage(playerid, COLOR_WHITE, "You have set your badge back to normal.");
                SetPlayerColor(playerid,TEAM_HIT_COLOR);
            }
            case 1: {
                SendClientMessage(playerid, COLOR_WHITE, "You have set your badge to LSPD.");
                SetPlayerColor(playerid,TEAM_BLUE_COLOR);
            }
            case 2: {
                SendClientMessage(playerid, COLOR_WHITE, "You have set your badge to FBI.");
                SetPlayerColor(playerid,TEAM_FBI_COLOR);
            }
            case 3: {
                SendClientMessage(playerid, COLOR_WHITE, "You have set your badge to LSFMD.");
                SetPlayerColor(playerid, TEAM_MED_COLOR);
            }
            default: SendClientMessage(playerid, COLOR_GREY, "Invalid faction specified.");
        }
    }
    return 1;
}
Reply
#4

Lloyde, I think the only problem was he didn't had "string[xxx]" when he started to script the command. Spydah posted that code, try that one.
Reply
#5

pawn Код:
new string[255];
Why make it a 255 celled string? It's a 100 celled string at the most.
Reply
#6

@BenJackster my /hbadge is Working if they want my script go if they dont its okay no problem for me motherfucker
Reply
#7

Lol, why are you going mad? I just said something and you started to swear me. Anyways, let's just shut up.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)