Posts: 233
Threads: 82
Joined: Jan 2011
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
Posts: 1,939
Threads: 11
Joined: Oct 2015
Reputation:
0
only case statements are allowed in switch structure.
what is DXP? Is it an array?
Posts: 217
Threads: 1
Joined: Jul 2017
Reputation:
0
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"
Posts: 233
Threads: 82
Joined: Jan 2011
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;
Posts: 233
Threads: 82
Joined: Jan 2011
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.