Little problem with random..
#2

What if the number was 0? It does nothing.

Change to:
pawn Код:
public EngStart(playerid)
{
    new Float:vehHP, vehicle = GetPlayerVehicleID(playerid);
    GetVehicleHealth(vehicle, vehHP);
    if(vehHP >= 500)
    {
        Eng[playerid] = 1;
        SendClientMessage(playerid, COLOR_YELLOW,"Engine is succesfully started");
        TogglePlayerControllable(playerid, 1);
    }
    else
    {
        switch(random(2))
        {
            case 0:
            {
                Eng[playerid] = 1;
                SendClientMessage(playerid, COLOR_YELLOW,"Engine is succesfully started");
                TogglePlayerControllable(playerid, 1);
            }
            case 1:
            {
                Eng[playerid] = 0;
                SendClientMessage(playerid, COLOR_YELLOW,"Engine failed to start, please try again");
                TogglePlayerControllable(playerid, 0);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Little problem with random.. - by Lajko1 - 07.11.2013, 16:51
Re: Little problem with random.. - by Konstantinos - 07.11.2013, 16:55
Re: Little problem with random.. - by Lajko1 - 07.11.2013, 16:59
Re: Little problem with random.. - by Lajko1 - 07.11.2013, 17:25
Re: Little problem with random.. - by TouR - 07.11.2013, 17:28
Re: Little problem with random.. - by Lajko1 - 07.11.2013, 17:37

Forum Jump:


Users browsing this thread: 2 Guest(s)