[Help] Street Sweeper job errors. -
Minio1822 - 14.05.2010
I added Street Sweeper job to penls script edit and i get those errors :
Code:
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21256) : error 014: invalid statement; not in switch
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21256) : warning 215: expression has no effect
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21256) : error 001: expected token: ";", but found ":"
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21256) : error 029: invalid expression, assumed zero
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21256) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
and it's code with this line :
pawn Code:
case 5: //Street Sweeper
{
GameTextForPlayer(playerid, "You are now a Street Sweeper!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 7;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsASS(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
}
}
How to fix these errors ?
Re: [Help] Street Sweeper job errors. -
juice.j - 14.05.2010
Which is exactly line 21256?
Edit: Nevermind, you exclude your "case 5:" line from switch, meaning you close the switch bracket (}) somewhere before "case 5:".
Re: [Help] Street Sweeper job errors. -
Minio1822 - 14.05.2010
5 cases :
pawn Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
new string[256];
if (CurrentMenu == Jobmenu)
{
switch(row)
{
case 0: //Taxi Driver
{
GameTextForPlayer(playerid, "You are now a Taxi Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 1;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
return 1;
}
case 1: //Truck Driver
{
GameTextForPlayer(playerid, "You are now a Truck Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 3;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsATR(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
case 2: //Grave Digger
{
GameTextForPlayer(playerid, "You are now a Grave Digger!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 4;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsADC(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
}
case 3: //Pizza Boy
{
GameTextForPlayer(playerid, "You are now a Pizza Boy!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 5;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsAPizza(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
}
case 4: //Garbage Man
{
GameTextForPlayer(playerid, "You are now a Garbage Man!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 6;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsAGC(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
}
}
case 5: //Street Sweeper line 21256
{
GameTextForPlayer(playerid, "You are now a Street Sweeper!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 7;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i[MAX_VEHICLES];i++)
{
if(IsASS(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
}
}
Re: [Help] Street Sweeper job errors. -
juice.j - 14.05.2010
As I told you, you close the switch-case statement before the line "case 5:" with a closing bracket -> }.
Compare the brackets, you'll see it. I strongly recommend to use proper intendation and to read from the errors because this error can be taken literally - there is no need to open an extra thread for that.
Re: [Help] Street Sweeper job errors. -
Minio1822 - 14.05.2010
I guess it should be fixed now
pawn Code:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
new string[256];
if (CurrentMenu == Jobmenu)
{
switch(row)
{
case 0: //Taxi Driver
{
GameTextForPlayer(playerid, "You are now a Taxi Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 1;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
return 1;
}
case 1: //Truck Driver
{
GameTextForPlayer(playerid, "You are now a Truck Driver!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 3;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsATR(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
case 2: //Grave Digger
{
GameTextForPlayer(playerid, "You are now a Grave Digger!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 4;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsADC(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
case 3: //Pizza Boy
{
GameTextForPlayer(playerid, "You are now a Pizza Boy!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 5;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsAPizza(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
case 4: //Garbage Man
{
GameTextForPlayer(playerid, "You are now a Garbage Man!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 6;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsAGC(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
case 5: //Street Sweeper line 21256
{
GameTextForPlayer(playerid, "You are now a Street Sweeper!~N~Type ~R~/job ~W~for more information", 5000, 3);
PlayerInfo[playerid][pJob] = 7;
TogglePlayerControllable(playerid, 1);
DisablePlayerCheckpoint(playerid);
gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
for(new i=0;i[MAX_VEHICLES];i++)
{
if(IsASS(i))
{
SetVehicleParamsForPlayer(i,playerid,0,0);
}
}
return 1;
}
But i get new errors:
Code:
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : error 028: invalid subscript (not an array or too many subscripts): "i"
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : error 029: invalid expression, assumed zero
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : warning 215: expression has no effect
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : warning 204: symbol is assigned a value that is never used: "i"
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : error 017: undefined symbol "i"
E:\samp03asvr_R4_win32_2_\samp03asvr_R4_win32\gamemodes\SRP.pwn(21263) : fatal error 107: too many error messages on one line