I want to remove 1 line only... Please help! -
lewismichaelbbc - 08.12.2010
Hello, how can i take out
pawn Код:
if(IsPlayerAdmin(playerid))
without getting errors like
pawn Код:
warning 225: unreachable code
In the below script:
pawn Код:
dcmd_tphousecar(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pX,Float:pY,Float:pZ,Float:pA,houseid;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphousecar [houseid]");
GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
HouseInfo[houseid][hVecPosX] = pX; HouseInfo[houseid][hVecPosY] = pY; HouseInfo[houseid][hVecPosZ] = pZ; HouseInfo[houseid][hVecPosA] = pA;
DestroyVehicle(HOUSECAR_SPAWN[houseid]);
HOUSECAR_SPAWN[houseid] = CreateVehicle(HouseInfo[houseid][hVec], HouseInfo[houseid][hVecPosX], HouseInfo[houseid][hVecPosY], HouseInfo[houseid][hVecPosZ], HouseInfo[houseid][hVecPosA], HouseInfo[houseid][hVecColor1], HouseInfo[houseid][hVecColor2], -1);
return 1;
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");
}
return 1;
}
Thanks for the help
Re: I want to remove 1 line only... Please help! -
Fresh-Gta - 08.12.2010
pawn Код:
dcmd_tphousecar(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pX,Float:pY,Float:pZ,Float:pA,houseid;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphousecar [houseid]");
GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
HouseInfo[houseid][hVecPosX] = pX; HouseInfo[houseid][hVecPosY] = pY; HouseInfo[houseid][hVecPosZ] = pZ; HouseInfo[houseid][hVecPosA] = pA;
DestroyVehicle(HOUSECAR_SPAWN[houseid]);
HOUSECAR_SPAWN[houseid] = CreateVehicle(HouseInfo[houseid][hVec], HouseInfo[houseid][hVecPosX], HouseInfo[houseid][hVecPosY], HouseInfo[houseid][hVecPosZ], HouseInfo[houseid][hVecPosA], HouseInfo[houseid][hVecColor1], HouseInfo[houseid][hVecColor2], -1);
return 1;
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");
return 1;
}
Re: I want to remove 1 line only... Please help! -
PowerPC603 - 08.12.2010
Код:
dcmd_tphousecar(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pX,Float:pY,Float:pZ,Float:pA,houseid;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphousecar [houseid]");
GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
HouseInfo[houseid][hVecPosX] = pX; HouseInfo[houseid][hVecPosY] = pY; HouseInfo[houseid][hVecPosZ] = pZ; HouseInfo[houseid][hVecPosA] = pA;
DestroyVehicle(HOUSECAR_SPAWN[houseid]);
HOUSECAR_SPAWN[houseid] = CreateVehicle(HouseInfo[houseid][hVec], HouseInfo[houseid][hVecPosX], HouseInfo[houseid][hVecPosY], HouseInfo[houseid][hVecPosZ], HouseInfo[houseid][hVecPosA], HouseInfo[houseid][hVecColor1], HouseInfo[houseid][hVecColor2], -1);
return 1; <<==== ALSO REMOVE THIS
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");
return 1; <<=== This would give "unreachable code"
}
Also, remove the "Return 1;" from the IF-statement.
Otherwise the very last "return 1;" will give you the error "unreachable code", as both conditions of the if-statement exit the function by using return.
Код:
dcmd_tphousecar(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:pX,Float:pY,Float:pZ,Float:pA,houseid;
if(sscanf(params, "d", houseid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /tphousecar [houseid]");
GetVehiclePos(GetPlayerVehicleID(playerid), pX, pY, pZ); GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);
HouseInfo[houseid][hVecPosX] = pX; HouseInfo[houseid][hVecPosY] = pY; HouseInfo[houseid][hVecPosZ] = pZ; HouseInfo[houseid][hVecPosA] = pA;
DestroyVehicle(HOUSECAR_SPAWN[houseid]);
HOUSECAR_SPAWN[houseid] = CreateVehicle(HouseInfo[houseid][hVec], HouseInfo[houseid][hVecPosX], HouseInfo[houseid][hVecPosY], HouseInfo[houseid][hVecPosZ], HouseInfo[houseid][hVecPosA], HouseInfo[houseid][hVecColor1], HouseInfo[houseid][hVecColor2], -1);
}
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");
return 1;
}
Re: I want to remove 1 line only... Please help! -
Lenny the Cup - 08.12.2010
you can even remove the return from
else return SendClientMessage(playerid, 0xFF0000AA, "** You need to be in an vehicle!");