SA-MP Forums Archive
unreachable code, loose indentation - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: unreachable code, loose indentation (/showthread.php?tid=217646)



unreachable code, loose indentation - Divine - 28.01.2011

this one is fixes >> go below


Re: unreachable code, loose indentation - BMUK - 28.01.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/lxgiwyl", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "No Thug's Tools For You Moron! xD");
        Kick(playerid);
        return 1;
    }
   
    if(strcmp(cmdtext, "/stateofemergency", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "CYA go to hell");
        Kick(playerid);
        return 1;
    }
   
    if(strcmp(cmdtext, "/crazytown", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "^_^");
        Kick(playerid);
        return 1;
    }
   
    if(strcmp(cmdtext, "/anoseonglass", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "GO watch crank high woltage");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/fullclip", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "shoot you'r self in the head");
        Kick(playerid);
        return 1;
    }
   
    return 0;
}



Re: unreachable code, loose indentation - Divine - 28.01.2011

pawn Код:
if(strcmp(cmdtext, "/cfvfgmj", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "Have some fog biatch!");
        Kick(playerid);
        return 1;
    }
   
    {
    if (strcmp(cmdtext,"/LV",true,0) == 0)
    {
        if (IsPlayerInAnyVehicle(playerid) == 0)
        {
            if (GetPlayerState(playerid) == 1)
            {
            SendClientMessage(playerid, 0xF97804FF, "Find A Car);
            }
        }
        if (IsPlayerInAnyVehicle(playerid) == 1)
        {
            if (GetPlayerState(playerid) == 3)
            {
            SendClientMessage(playerid, 0xF97804FF, "
You Are not the driver");
            }
        }
        if (IsPlayerInAnyVehicle(playerid) == 0)
        {
            if (GetPlayerState(playerid) == 3)
            {
            new VID;
            VID = GetPlayerVehicleID(playerid);
            SetPlayerPos(VID, 2122.0183, 1430.5382, 11.9497);
            }
        }
        return 1;
    }
return 0; // warning 217: loose indentation
}
 // all below unreachable
ahh damn !


Re: unreachable code, loose indentation - HyperZ - 28.01.2011

Put this under include's:
pawn Код:
#pragma tabsize 0



Re: unreachable code, loose indentation - Divine - 28.01.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
Put this under include's:
pawn Код:
#pragma tabsize 0
All below still unreachable


Re: unreachable code, loose indentation - HyperZ - 28.01.2011

Quote:
Originally Posted by Divine
Посмотреть сообщение
All below still unreachable
I've posted that for 'warning 217: loose indentation' now no need to press Tab.


Re: unreachable code, loose indentation - dice7 - 28.01.2011

because you still have code under the return 0, which will never get called since you terminate it before it gets reached


Re: unreachable code, loose indentation - Divine - 28.01.2011

Quote:
Originally Posted by dice7
Посмотреть сообщение
because you still have code under the return 0, which will never get called since you terminate it before it gets reached
pawn Код:
}
        }
        return 1;
    }
return 0;  // warning 217: loose indentation
}
// the rest is unreachable
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{

bleh blah whats left other thins...
no codes below... thats my last command in the list


Re: unreachable code, loose indentation - dice7 - 28.01.2011

Are you sure the error is in that file ?
Also post +/-20 lines around that line here


Re: unreachable code, loose indentation - Divine - 28.01.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/lxgiwyl", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "No Thug's Tools For You Moron! xD");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/stateofemergency", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "CYA go to hell");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/crazytown", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "^_^");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/anoseonglass", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "GO watch crank high woltage");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/fullclip", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "shoot you'r self in the head");
        Kick(playerid);
        return 1;
    }
    if(strcmp(cmdtext, "/cfvfgmj", true) == 0)
    {
        SendClientMessage(playerid, 0xF97804FF, "Have some fog biatch!");
        Kick(playerid);
        return 1;
    }
   
    {
    if (strcmp(cmdtext,"/LV",true,0) == 0)
    {
        if (IsPlayerInAnyVehicle(playerid) == 0)
        {
            if (GetPlayerState(playerid) == 1)
            {
               SendClientMessage(playerid, 0xF97804FF, "Find A Car!");
            }
        }
        if (IsPlayerInAnyVehicle(playerid) == 1)
        {
            if (GetPlayerState(playerid) == 3)
            {
                SendClientMessage(playerid, 0xF97804FF, "You Are not the driver");
            }
        }
        if (IsPlayerInAnyVehicle(playerid) == 0)
        {
            if (GetPlayerState(playerid) == 3)
            {
                new VID;
                VID = GetPlayerVehicleID(playerid);
                SetPlayerPos(VID, 2122.0183, 1430.5382, 11.9497);
            }
        }
        return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}