Label problem
#1

Hello,i've added a textlabel to the players with wanted level.From 1 to 3 it shows the label "Ticketable",from 4 to 10 it's "Arrestable",but seems not work:

1989 : error 002: only a single statement (or expression) can follow each "case"
1989 : warning 215: expression has no effect
1991 : error 014: invalid statement; not in switch
1991 : warning 215: expression has no effect
1991 : error 001: expected token: ";", but found ".."
1991 : error 029: invalid expression, assumed zero
1991 : fatal error 107: too many error messages on one line

This is the new for labels:

pawn Код:
new Text3D:Ticketable[MAX_PLAYERS];
new Text3D:Arrestable[MAX_PLAYERS];
And this is where they are applied:

pawn Код:
public WantedColor()
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        switch(GetPlayerWantedLevel(i))
        {
            case 1..3:
            Ticketable[i] = Create3DTextLabel("Suspect - Ticketable",yellow,30.0,40.0,50.0,40.0,0);
            Attach3DTextLabelToPlayer(Ticketable[i], i, 0.0, 0.0, 0.7);
            SetPlayerColor(i,yellow);

            case 4..10:
            Arrestable[i] = Create3DTextLabel("Suspect - Arrestable",red,30.0,40.0,50.0,40.0,0);
            Attach3DTextLabelToPlayer(Arrestable[i], i, 0.0, 0.0, 0.7);
            SetPlayerColor(i,red);
        }
    }
}
Thanks for help
Reply
#2

pawn Код:
public WantedColor()
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        switch(GetPlayerWantedLevel(i))
        {
            case 1..3:
            {
                Ticketable[i] = Create3DTextLabel("Suspect - Ticketable",yellow,30.0,40.0,50.0,40.0,0);
                Attach3DTextLabelToPlayer(Ticketable[i], i, 0.0, 0.0, 0.7);
                SetPlayerColor(i,yellow);
            }
            case 4..10:
            {
                Arrestable[i] = Create3DTextLabel("Suspect - Arrestable",red,30.0,40.0,50.0,40.0,0);
                Attach3DTextLabelToPlayer(Arrestable[i], i, 0.0, 0.0, 0.7);
                SetPlayerColor(i,red);
            }
        }
    }
}
Reply
#3

Now i got lots of general errors.
Reply
#4

I put this in my GM. No errros.

pawn Код:
new Text3D:Ticketable[MAX_PLAYERS],Text3D:Arrestable[MAX_PLAYERS];
forward WantedColor();
public WantedColor()
{
    for (new i; i < MAX_PLAYERS; i++)
    {
        switch(GetPlayerWantedLevel(i))
        {
            case 1..3:
            {
                Ticketable[i] = Create3DTextLabel("Suspect - Ticketable",-1,30.0,40.0,50.0,40.0,0);
                Attach3DTextLabelToPlayer(Ticketable[i], i, 0.0, 0.0, 0.7);
                SetPlayerColor(i,-1);
            }
            case 4..10:
            {
                Arrestable[i] = Create3DTextLabel("Suspect - Arrestable",-2,30.0,40.0,50.0,40.0,0);
                Attach3DTextLabelToPlayer(Arrestable[i], i, 0.0, 0.0, 0.7);
                SetPlayerColor(i,-2);
            }
        }
    }
}
Reply
#5

Nope,still lot of general errors.
Reply
#6

EDIT: oops. sorry
Reply
#7

Bump.
Reply
#8

well post the new errors
clearly you did not use brackets in the first code's switch statement

that was fixed, post the other errors.
and STOP BUMPING
read the forum rules,

if your not gonna provide anymore useful then no one can help you.
Reply
#9

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
well post the new errors
clearly you did not use brackets in the first code's switch statement

that was fixed, post the other errors.
and STOP BUMPING
read the forum rules,

if your not gonna provide anymore useful then no one can help you.
ikr,sorry for bumping,the errors i get after using Viniborn's code,are not releated to the code it self,but are the other defines/functions.

If i remove that code,i dont get any errors,so that code is the problem.If i use my original code,i get only that 7 errors i posted in the first post.
Reply
#10

Post these and the code... You know, if you remove code everytime it shows an error on it, you will find out there are things which wont work in-game. Hehehe.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)