Need Help With this Unreachable Code
#6

Quote:
Originally Posted by ihatetn931
Quote:
Originally Posted by Calon
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[256];
    new plname[MAX_PLAYER_NAME];
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new veh = GetPlayerVehicleID(playerid);
        if(Engine[veh] == 0)
        {
          TogglePlayerControllable(playerid, 1);
          SendClientMessage(playerid, COLOR_GREY, "The engine is off, use /engine or press SHIFT to start it.");
            if(VehicleInfo[veh][vRentPrice] > 0)
            {
                GetPlayerName(playerid, plname, sizeof(plname));
                if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
                {
                format(string, sizeof(string), "--|Welcome to a %s|--", VehicleNames[GetVehicleModel(veh)-400]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
              }
              else
                {
                    if(vRented[veh] != 255)
                    {
                        TogglePlayerControllable(playerid, );
                    format(string, sizeof(string), "~w~This %s if for rent ~n~Price: ~b~$%d ~n~~w~Owner: ~b~%s ~n~~w~use /rent vehicle to rent it.", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vRentPrice], VehicleInfo[veh][vOwner]);
                    GameTextForPlayer(playerid, string, 12000, 5);
                    return 1;
                    }
            }
            else
            {
                    if(VehicleInfo[veh][vAlarm] > 0)
                    {
                        format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
                        PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
                        return 1;
                    }
                    else
                    {
                        format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    return 1;
                    }
              }
            }
           
            if(VehicleInfo[veh][vOwned] == 1)
        {
                GetPlayerName(playerid, plname, sizeof(plname));
                if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
                {
                format(string, sizeof(string), "--|Welcome back to your %s|--", VehicleNames[GetVehicleModel(veh)-400]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
                }
                else
                {
                    if(VehicleInfo[veh][vAlarm] > 0)
                    {
                        format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    SendClientMessage(playerid, COLOR_LIGHTRED, "Info: The Alarm Is On.");
                        PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
                        return 1;
                    }
                    else
                    {
                        format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    return 1;
                }
                }
            }
        }
        else
        {
            if(VehicleInfo[veh][vOwned] == 1)
        {
                GetPlayerName(playerid, plname, sizeof(plname));
                if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0)
                {
                format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
                }
                else
                {
                    if(VehicleInfo[veh][vAlarm] > 0)
                    {
                        format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
                        PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
                        return 1;
                    }
                    else
                    {
                        format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    return 1;
                }
                }
            }
        }
    }
    return 1;
}
all the stuff i have quoted out is stuff i've disabled in the scirpt. Is there a way to leave them quoted out and make that code reachable?
Use your brain, I've corrected most of your code. I'm pretty sure it's fine.
Reply


Messages In This Thread
Need Help With this Unreachable Code - by ihatetn931 - 05.01.2010, 06:58
Re: Need Help With this Unreachable Code - by Striker_Moe - 05.01.2010, 07:04
Re: Need Help With this Unreachable Code - by ihatetn931 - 05.01.2010, 07:08
Re: Need Help With this Unreachable Code - by Calon - 05.01.2010, 07:38
Re: Need Help With this Unreachable Code - by ihatetn931 - 05.01.2010, 17:21
Re: Need Help With this Unreachable Code - by Calon - 06.01.2010, 07:17
Re: Need Help With this Unreachable Code - by adsy - 06.01.2010, 13:15

Forum Jump:


Users browsing this thread: 2 Guest(s)