error 008 problem with switch(playerid)
#1

hey everyone,

i made this switch for my GM but somehow it gives me errors and i dont know why...

pawn Код:
WaitForBot( playerid, menu, action[] )
{
    PlayerInfo[playerid][botready] = false;
    switch(playerid)
    {
        case FirstRaceBot:
        {
            SendClientMessage(FirstRaceBot, COLOR_GREEN, action );
        }
        case FirstFightBot:
        {
            SendClientMessage(FirstFightBot, COLOR_GREEN, action );
        }
        case SecondFightBot:
        {
            SendClientMessage(SecondFightBot, COLOR_GREEN, action );
        }
    }
    PlayerInfo[playerid][waitingforbot] = SetTimerEx("WaitForBotTimer",250,true,"dd",playerid,menu );
    return 1;
}
i get these errors:
pawn Код:
D:\Program Files\High Speed Drivers\gamemodes\HighSpeedDrivers.pwn(721) : error 008: must be a constant expression; assumed zero
D:\Program Files\High Speed Drivers\gamemodes\HighSpeedDrivers.pwn(725) : error 008: must be a constant expression; assumed zero
D:\Program Files\High Speed Drivers\gamemodes\HighSpeedDrivers.pwn(729) : error 008: must be a constant expression; assumed zero
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
any idea of how it is possible those errors? and the lines of the errors are:
pawn Код:
case FirstRaceBot:
case FirstFightBot:
case SecondFightBot:
thats my code and errors, but does anybody sees wut im doing wrong?

greets niels
Reply
#2

Try to use "if" statements. Because you can't use variables with switch. So use else if.
Reply
#3

Try to use if or else
Reply
#4

hmm ye i did that before, and it worked, but i didnt knew this couldnt be used with variables, anyways thnx
Reply
#5

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Try to use "if" statements. Because you can't use variables with switch. So use else if.
oh my god.

switch works with variables..
Reply
#6

Thanks for the info then I read on some site that you can't use them with variables
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)