Warning 225: Unreachable Code
#1

Код:
gamemodes\W_BVC.pwn(1013) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warning.
Код:
//----------------------------------[Enter]-------------------------------------
	{
    if(strcmp(cmdtext, "/enter", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, -1185.7140,24.0274,271.2557))
        {
            SetPlayerPos(playerid, 1802.6289,17.6406,21.9449);//AmmunationEntrance
            SetPlayerInterior(playerid, 1);
        }
    }
    if(strcmp(cmdtext, "/exit", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1802.6289,17.6406,21.9449))
        {
            SetPlayerPos(playerid, -1185.7140,24.0274,271.2557);//AmmunationExit
            SetPlayerInterior(playerid, 0);
        }
    }
    return 1;
	}
//---------------------------------[Buy Guns]-----------------------------------
	if (strcmp("/buyguns", cmdtext, true, 10) == 0)
	{
	if(IsPlayerInRangeOfPoint(playerid, 9.0, 1807.8071,17.6406,10.9720))//Buy Guns Location
			{
				SendClientMessage(playerid, COLOR_WHITE, "{FF0000}> {E5E5E5}Follow the {FF0000}Red {E5E5E5}marker on your Radar!");
				SetPlayerCheckpoint(playerid, 2123.2656,-1185.6619,24.0275,3.0);//Buy Guns Marker
				return 1;
			}
                ShowPlayerDialog(playerid,Dialog_BUYGUN,DIALOG_STYLE_LIST,"Illegal Gun Store","M4A1(150) ($5,000)\nRPG(1) ($10,000)\nSniper(50) ($7,000)\nMolotov(2) ($2,000)\nHealth ($1,000)\nArmour ($1,000)","Buy","Cancel");
                return 1;
    }
Reply
#2

PHP код:
if (strcmp("/buyguns"cmdtexttrue10) == 0
to

PHP код:
if (strcmp(cmd"/buyguns"true) == 0
Reply
#3

Move the whole /buyguns command to above the return 1 on line 1010.

Like this:
pawn Код:
//----------------------------------[Enter]-------------------------------------
    {
    if(strcmp(cmdtext, "/enter", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, -1185.7140,24.0274,271.2557))
        {
            SetPlayerPos(playerid, 1802.6289,17.6406,21.9449);//AmmunationEntrance
            SetPlayerInterior(playerid, 1);
            return 1;
        }
    }
    if(strcmp(cmdtext, "/exit", true))
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 1802.6289,17.6406,21.9449))
        {
            SetPlayerPos(playerid, -1185.7140,24.0274,271.2557);//AmmunationExit
            SetPlayerInterior(playerid, 0);
            return 1;
        }
    }
//---------------------------------[Buy Guns]-----------------------------------
    if (strcmp("/buyguns", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 9.0, 1807.8071,17.6406,10.9720))//Buy Guns Location
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FF0000}> {E5E5E5}Follow the {FF0000}Red {E5E5E5}marker on your Radar!");
            SetPlayerCheckpoint(playerid, 2123.2656,-1185.6619,24.0275,3.0);//Buy Guns Marker
            return 1;
        }
        ShowPlayerDialog(playerid,Dialog_BUYGUN,DIALOG_STYLE_LIST,"Illegal Gun Store","M4A1(150) ($5,000)\nRPG(1) ($10,000)\nSniper(50) ($7,000)\nMolotov(2) ($2,000)\nHealth ($1,000)\nArmour ($1,000)","Buy","Cancel");
        return 1;
    }
    return 0;
}
EDIT: use [PAWNN][/PAWN] (With a single 'N' in the first tag) to post your PAWN code.
Reply
#4

You need to return 0 in OnPlayerCommandText. After every command you must return 1.
https://sampwiki.blast.hk/wiki/OnPlayerCommandText
Reply
#5

DELETE THE RETURN 1 IN LINE #1010
AND BLACKET 1009

AND PUT RETURN 1;

EVERYAFTER COMMAND PROCESS

LIKES

BLAH BLA BLA /BLAHH == 0
{
GIVEGUN
GIVEAFUCK
RETURN 1; <<<< HERE
}
Reply
#6

The problem is actually on line 1009:

Delete the bracket.

Quote:
Originally Posted by StreetRP
Посмотреть сообщение
PHP код:
if (strcmp("/buyguns"cmdtexttrue10) == 0
to

PHP код:
if (strcmp(cmd"/buyguns"true) == 0

cmd should be cmdtext, and comparing "/buyguns" to cmdtext is the same as comparing cmdtext to "buyguns";

It's like if (a == 5) or if (5 == a).
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)