Loop & Enumerators
#1

Hello guys, I'm trying to use loop to shorten my code so it would be much more shorter and it would save some space, I'm try to loop my enumarator Robbing, check the code below for more information

My Enum
pawn Код:
enum robbingshop
{
    RobbingTatoo
}
new Robbing[MAX_PLAYERS][robbingshop];
OnPlayerLeaveDynamicCP Callback
pawn Код:
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
    for(new i = 0; i < sizeof(rCheckpoints); i++)
    {
        if(checkpointid == rCheckpoints[i])
        {
            for(new s = 0; s < sizeof(Robbing); s++)
            {
                if(Robbing[playerid][s] >= 1)
                {
                    SendClientMessage(playerid, COLOR_DARKYELLOW, "[ROBBERY FAILED]"COL_WHITE": You left the checkpoint while robbing the store!");
                    Robbing[playerid][s] =0;
                }
            }
        }
    }
    return 1;
}
Warning/Error Code
pawn Код:
: warning 213: tag mismatch
Reply
#2

Which line are you getting this error on?
Reply
#3

This Line
pawn Код:
if(Robbing[playerid][s] >= 1)
And

This Line
pawn Код:
Robbing[playerid][s] =0;
Reply
#4

sizeof(robbingshop)
Or
_:robbingshop
At the for(blabla) loop, replace the sizeof(Robbing) with one of these.

Also at the error lines replace the "s" with "robbingshop : s"

Edit: Forget about sizeof, use _:robbingshop and the above line's advice may work.
Edit2: You are welcome
Reply
#5

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
sizeof(robbingshop)
Or
_:robbingshop
At the for(blabla) loop, replace the sizeof(Robbing) with one of these.

Also at the error lines replace the "s" with "robbingshop : s"

Edit: Forget about sizeof, use _:robbingshop and the above line's advice may work.
Cheers, bro. much appreciated, I just learnt something new :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)