Argument type mismatch
#1

pawn Код:
PlayerData[i][pPlayTime]++;
            if(PlayerData[i][pPlayTime] >= 3600){
                PlayerData[i][pPlayTime] = 0;

                switch(PlayerData[i][pDonator])
                {
                    if(DXP == false) {
                    case 2: PlayerData[i][pExp]+= 2;
                    case 3: PlayerData[i][pExp]+= 3;
                    case 4: PlayerData[i][pExp]+= 4;
                    case 0, 1: PlayerData[i][pExp]++;
                                     }
                    else {
                    case 2: PlayerData[i][pExp]+= 4;
                    case 3: PlayerData[i][pExp]+= 6;
                    case 4: PlayerData[i][pExp]+= 8;
                    case 0, 1: PlayerData[i][pExp]+= 2;
                         }
                }

                PlayerData[i][pHoursPlayed]++;
            }
Код:
C:\Users\James\Desktop\SA-MP Roleplay Server\gamemodes\ScriptRel.pwn(31714) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\James\Desktop\SA-MP Roleplay Server\gamemodes\ScriptRel.pwn(31714) : error 028: invalid subscript (not an array or too many subscripts): "false"
C:\Users\James\Desktop\SA-MP Roleplay Server\gamemodes\ScriptRel.pwn(31714 -- 31715) : error 001: expected token: "}", but found "case"
C:\Users\James\Desktop\SA-MP Roleplay Server\gamemodes\ScriptRel.pwn(31714 -- 31715) : fatal error 107: too many error messages on one line

Compilation aborted.

Pawn compiler 3.10.3	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
whats up w this
Reply
#2

only case statements are allowed in switch structure.
what is DXP? Is it an array?
Reply
#3

You are making an if statement inside a switch.
That's not correct.
And the "false" thing, DXP is a bool or a normal array? Try to change "false" with "0"
Reply
#4

Quote:
Originally Posted by Lucases
Посмотреть сообщение
You are making an if statement inside a switch.
That's not correct.
And the "false" thing, DXP is a bool or a normal array? Try to change "false" with "0"
switching false with 0 creates even more errors, DXP is a bool

Код:
//Double XP
new bool:DXP;
Reply
#5

Anyway, the problem is that you put an 'if' statement inside a switch

pawn Код:
PlayerData[i][pPlayTime]++;
            if(PlayerData[i][pPlayTime] >= 3600){
                PlayerData[i][pPlayTime] = 0;

                if(DXP == false) {
                                switch(PlayerData[i][pDonator])
                                {
                        case 2: PlayerData[i][pExp]+= 2;
                        case 3: PlayerData[i][pExp]+= 3;
                        case 4: PlayerData[i][pExp]+= 4;
                        case 0, 1: PlayerData[i][pExp]++;
                }
                                }
                else {
                                switch(PlayerData[i][pDonator])
                {  
                                        case 2: PlayerData[i][pExp]+= 4;
                    case 3: PlayerData[i][pExp]+= 6;
                    case 4: PlayerData[i][pExp]+= 8;
                    case 0, 1: PlayerData[i][pExp]+= 2;
                }
                }

                PlayerData[i][pHoursPlayed]++;
            }

Try this code
Reply
#6

Quote:
Originally Posted by Lucases
Посмотреть сообщение
Anyway, the problem is that you put an 'if' statement inside a switch

pawn Код:
PlayerData[i][pPlayTime]++;
            if(PlayerData[i][pPlayTime] >= 3600){
                PlayerData[i][pPlayTime] = 0;

                if(DXP == false) {
                                switch(PlayerData[i][pDonator])
                                {
                        case 2: PlayerData[i][pExp]+= 2;
                        case 3: PlayerData[i][pExp]+= 3;
                        case 4: PlayerData[i][pExp]+= 4;
                        case 0, 1: PlayerData[i][pExp]++;
                }
                                }
                else {
                                switch(PlayerData[i][pDonator])
                {  
                                        case 2: PlayerData[i][pExp]+= 4;
                    case 3: PlayerData[i][pExp]+= 6;
                    case 4: PlayerData[i][pExp]+= 8;
                    case 0, 1: PlayerData[i][pExp]+= 2;
                }
                }

                PlayerData[i][pHoursPlayed]++;
            }

Try this code
thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)