12.10.2015, 14:49
Can anyone tell me what's wrong?
i get these error:
This is the code:
This is the error line:
i get these error:
pawn Код:
C:\Users\Mikkel\Desktop\gf_oct15_2015.pwn(41953) : error 014: invalid statement; not in switch
C:\Users\Mikkel\Desktop\gf_oct15_2015.pwn(41953) : error 029: invalid expression, assumed zero
This is the code:
pawn Код:
if(strcmp(cmd, "/frisktrunk", true) == 0 || strcmp(cmd, "/trunkfrisk", true) == 0 || strcmp(cmd, "/friskt", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 3)
{
SendClientMessage(playerid, COLOR_GREY, "You are not in law enforcement.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /frisktrunk [playerid/PartOfName]");
return 1;
}
new result;
new vehicleid=GetClosestCar(playerid);
new counter = 0;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, COLOR_GREY, " No cars with trunk near you");
}
case 1:
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " You can't frisk the trunk while your in the car");
return 1;
}
if(Trunk[vehicleid] == 0)
return SendClientMessage(playerid, COLOR_GREY, "You must open the trunk before you can see what's in it.");
if(IsAnOwnableCar(result))
{
giveplayerid = ReturnUser(tmp);
if(VehicleOwned[result] == PlayerInfo[giveplayerid][pCarkey]) { }
else if(VehicleOwned[result] == PlayerInfo[giveplayerid][pCarkey2]) { }
else if(VehicleOwned[result] == PlayerInfo[giveplayerid][pCarkey3]) { }
else if(VehicleOwned[result] == PlayerInfo[giveplayerid][pCarkey4]) { }
else if(VehicleOwned[result] == PlayerInfo[giveplayerid][pCarkey5]) { }
}
if(!IsAnOwnableCar(result))
{
SendClientMessage(playerid, COLOR_GREY, "This vehicle doesnt have a trunk.");
return 1;
}
if(IsNotAEngineCar(result))
{
SendClientMessage(playerid, COLOR_GREY, " This vehicle doesn't have the trunk !");
return 1;
}
}
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid) || PlayerInfo[playerid][pAdmin])
{
SendClientMessage(playerid, 0xFFFFFFAA, "|-----------------Vehicle Trunk-----------------|");
if(VehicleOwned[result] != SCRIPT_CARS)
{
new key2 = VehicleOwned[result];
for(new slot = 1; slot != MAX_TRUNK_SLOTS; slot++)
{
new gunname[100];
if(CarInfo[key2][cTrunkWep][slot] != 0)
{
GetWeaponName(CarInfo[key2][cTrunkWep][slot], gunname, sizeof(gunname));
format(string, sizeof(string), "| slot %i: %s", slot, gunname);
SendClientMessage(playerid, 0xAFAFAFAA, string);
}
else
{
format(string, sizeof(string), "| slot %i: Empty", slot);
SendClientMessage(playerid, 0xAFAFAFAA, string);
}
}
format(string, sizeof(string), "| slot 5 | Pot: %i", CarInfo[key2][cTrunkPot]);
SendClientMessage(playerid, 0xAFAFAFAA, string);
format(string, sizeof(string), "| slot 6 | Crack: %i", CarInfo[key2][cTrunkCrack]);
SendClientMessage(playerid, 0xAFAFAFAA, string);
format(string, sizeof(string), "| slot 7 | A Mats: %i", CarInfo[key2][cTrunkMatsa]);
SendClientMessage(playerid, 0xAFAFAFAA, string);
format(string, sizeof(string), "| slot 8 | B Mats: %i", CarInfo[key2][cTrunkMatsb]);
SendClientMessage(playerid, 0xAFAFAFAA, string);
format(string, sizeof(string), "| slot 9 | C Mats: %i", CarInfo[key2][cTrunkMatsc]);
SendClientMessage(playerid, 0xAFAFAFAA, string);
SendClientMessage(playerid, 0xFFFFFFAA, "|-----------------------------------------------|");
}
}
default: // THIS IS THE ERROR LINE
{
SendClientMessage(playerid, COLOR_GREY, " Found more then one car in range");
return 1;
}
if (!PlayerInfo[playerid][pAdmin]) // silent admin frisk
{
format(string, sizeof(string), "* %s has frisked %s's trunk for any illegal items.", MaskOnOff(playerid) ,MaskOnOff(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
return SendClientMessage(playerid, COLOR_GREY, " That player is not near you!");
}
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
}
}
return 1;
}
This is the error line:
pawn Код:
default: