PDA

View Full Version : How to fix these warnings?


Rohan_Ubhare
12/05/2012, 11:25 AM
When I try to compile my script I get these warnings:

C:\Users\rohan\Desktop\Xtreme Roleplay 0.3e\gamemodes\x-rp.pwn(64019) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.


Here is Line 64019:

if (IsPlayerInRangeOfPoint(playerid, 10.0, 2102.71, -103.97, 2.28))

Please tel me the solution as soon as possible.
Thanks in Advance,
Rohan Ubhare

D-12
12/05/2012, 11:28 AM
Show me the command, there's a problem with the indentations probably.

iGetty
12/05/2012, 11:30 AM
Please show 3 lines above and below that line too.

Rohan_Ubhare
12/05/2012, 11:35 AM
Here is that whole thing:

if (IsPlayerInRangeOfPoint(playerid, 10.0, 2102.71, -103.97, 2.28)) // Matrun 3
{
new vehicle = GetPlayerVehicleID(playerid);
if(IsABoat(vehicle))
{
if(GetPVarInt(playerid, "Packages") >= 10) return SendClientMessageEx(playerid, COLOR_GRAD2, "something

if(PlayerInfo[playerid][pDonateRank] == 1)
{
if(GetPlayerCash(playerid) > 1124)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1125);
SetPVarInt(playerid, "Packages", 23);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"something");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
{
if(GetPlayerCash(playerid) > 1499)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1500);
SetPVarInt(playerid, "Packages", 30);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* something.");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else if(PlayerInfo[playerid][pDonateRank] >= 4)
{
if(GetPlayerCash(playerid) < 1875)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1875);
SetPVarInt(playerid, "Packages", 38);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"somethin.");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else
{
if(GetPlayerCash(playerid) < 750)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -750);
SetPVarInt(playerid, "Packages", 15);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"something");
}

SendClientMessageEx(playerid, COLOR_WHITE, "something.");
SetPVarInt(playerid, "MatDeliver", 333);
SetPVarInt(playerid, "tpMatRunTimer", 15);
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
SetPlayerCheckpoint(playerid, -330.44, -467.54, 0.85, 5);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY," something");
}
return 1;
}

Pinguinn
12/05/2012, 11:37 AM
You forgot to close a line.


if (IsPlayerInRangeOfPoint(playerid, 10.0, 2102.71, -103.97, 2.28)) // Matrun 3
{
new vehicle = GetPlayerVehicleID(playerid);
if(IsABoat(vehicle))
{
if(GetPVarInt(playerid, "Packages") >= 10) return SendClientMessageEx(playerid, COLOR_GRAD2, "something"); // this line

if(PlayerInfo[playerid][pDonateRank] == 1)
{
if(GetPlayerCash(playerid) > 1124)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1125);
SetPVarInt(playerid, "Packages", 23);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"something");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else if(PlayerInfo[playerid][pDonateRank] == 2 || PlayerInfo[playerid][pDonateRank] == 3)
{
if(GetPlayerCash(playerid) > 1499)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1500);
SetPVarInt(playerid, "Packages", 30);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* something.");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else if(PlayerInfo[playerid][pDonateRank] >= 4)
{
if(GetPlayerCash(playerid) < 1875)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -1875);
SetPVarInt(playerid, "Packages", 38);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"somethin.");
SendClientMessageEx(playerid, COLOR_YELLOW,"something.");
}
else
{
if(GetPlayerCash(playerid) < 750)
{
SendClientMessageEx(playerid, COLOR_GREY," something!");
return 1;
}
GivePlayerCash(playerid, -750);
SetPVarInt(playerid, "Packages", 15);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"something");
}

SendClientMessageEx(playerid, COLOR_WHITE, "something.");
SetPVarInt(playerid, "MatDeliver", 333);
SetPVarInt(playerid, "tpMatRunTimer", 15);
SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPMATRUNTIMER);
SetPlayerCheckpoint(playerid, -330.44, -467.54, 0.85, 5);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY," something");
}
return 1;
}

Rohan_Ubhare
12/05/2012, 11:40 AM
Sorry I forgot to put tht but including those brackets i get that warning

AndreT
12/05/2012, 11:53 AM
You probably need to show the code that comes before the code block you just posted as well. Unreachable code is often caused by code like this:

stock function()
{
if(conditional == 1)
return 1;
else
return 0;

// code which will never be reached, and it makes sense
}

RedWingz
12/05/2012, 01:07 PM
Yea, I think he has a Loose Indention somewhere in the code. :/

Rohan_Ubhare
13/05/2012, 06:34 AM
The code before this is:

{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 9 && PlayerInfo[playerid][pDonateRank] <= 1)
{
SendClientMessage(playerid,COLOR_GREY," something!");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1423.6151, -1320.5438, 13.5546)) {
if(Packages[playerid] >= 10) { SendClientMessage(playerid, COLOR_GREY, " something!"); return 1; }
if(CP[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " something !"); return 1; }
if(Crates[playerid] > 0) { SendClientMessage(playerid, COLOR_GREY," something!"); return 1; }
if(GetPlayerVirtualWorld(playerid) != 0) { SendClientMessage(playerid, COLOR_GREY, " something !"); SetPlayerHealth(playerid, 0.0); return 1; }
if(PlayerInfo[playerid][pCash] > 499) { SendClientMessageEx(playerid, COLOR_GREY," something !"); return 1;}
{
GotMats[playerid] = 1;
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-500;
GivePlayerMoney(playerid, -500);
Packages[playerid] = 10;
CP[playerid] = 2;
SetPlayerCheckpoint(playerid, 3.0, 2172.21, -2263.25, 13.32);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* something.");
GameTextForPlayer(playerid, something", 5000, 1);
PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
return 1;
}
}
else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2390.4053, -2008.2618, 13.5537))
{
if(Packages[playerid] >= 10) { SendClientMessage(playerid, COLOR_GREY, " something!"); return 1; }
if(CP[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " something !"); return 1; }
if(Crates[playerid] > 0) { SendClientMessage(playerid, COLOR_GREY," something!"); return 1; }
if(GetPlayerVirtualWorld(playerid) != 0) { SendClientMessage(playerid, COLOR_GREY, " something !"); SetPlayerHealth(playerid, 0.0); return 1; }
if(PlayerInfo[playerid][pCash] > 499) { SendClientMessageEx(playerid, COLOR_GREY," something !"); return 1;}
{
GotMats[playerid] = 1;
GivePlayerMoney(playerid, -500);
Packages[playerid] = 10;
CP[playerid] = 3;
SetPlayerCheckpoint(playerid, 2288.0730, -1105.4535, 37.9766, 3.0);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* something");
GameTextForPlayer(playerid, something", 5000, 1);
PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " something!");
}
}
return 1;
}

Faisal_khan
13/05/2012, 06:52 AM
Boy please post the exact lines.