SA-MP Forums Archive
Why is this happening ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why is this happening ? (/showthread.php?tid=513344)



Why is this happening ? - Johnson_Brooks - 15.05.2014

pawn Код:
if(GetPlayerWantedLevel(ID) >=3)

Warning:
Код:
warning 225: unreachable code
Why is this happening ?


Re: Why is this happening ? - Konstantinos - 15.05.2014

Most of the times, this warning is given if you return something and at the next line there is code.

Quote:
Originally Posted by Pawn Language Guide
unreachable code

The indicated code will never run, because an instruction before
(above) it causes a jump out of the function, out of a loop
or elsewhere. Look for return, break, continue and goto
instructions above the indicated line. Unreachable code can also
be caused by an endless loop above the indicated line.



Re: Why is this happening ? - Johnson_Brooks - 15.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Most of the times, this warning is given if you return something and at the next line there is code.
This is another part of the code(the lines after the warning)
pawn Код:
if(GetPlayerWantedLevel(ID) >=3) //Warning line
    {
        format(string,sizeof(string),"[POLICE ACTION] Law Enforcement Officer %s(%d) has arrested %s(%d)",pName,playerid,aName,ID);
        SendClientMessageToAll(COLOR_ORANGE,string);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"You received 15,000$ and 2 score points for the arrest");
        GivePlayerMoney(playerid,15000);
        new rnd = random(sizeof(JailSpawnPoints));
        JailTime[ID] =180;
        SetPlayerInterior(ID,10);
        SetPlayerPos(ID,JailSpawnPoints[rnd][0],JailSpawnPoints[rnd][1],JailSpawnPoints[rnd][2]);
        SetPlayerFacingAngle(ID,JailSpawnPoints[rnd][3]);
        TogglePlayerControllable(ID,1);
        return 1;
    }
EDIT: I FIXEED IT. Thanks for your help once again Kwsta . Ελληνας ειμαι για να ξερεις .