Random() Function Error
#3

try now
pawn Код:
CMD:hotwire(playerid, params[])
{
    new string[128], Float:playerHealth;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    new playerstate = GetPlayerState(playerid), vehmodel = GetVehicleModel(GetPlayerVehicleID(playerid)), vehid = GetPlayerVehicleID(playerid), rnd = random(2);
    if(vehmodel == 481 || vehmodel == 509 || vehmodel == 510) return SendClientMessage(playerid, COLOR_GREY, "You can't hotwire a bicycle.");
    if(playerstate != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not driving a vehicle");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(engine) return SendClientMessage(playerid, COLOR_GREY, "The vehicle's engine is already on.");
    if(rnd == 0)
    {
        format(string, sizeof(string), "* %s has tried to hotwire the vehicle's engine, but got shocked.");
        GetPlayerHealth(playerid, playerHealth);
        SetPlayerHealth(playerid, playerHealth - 15);
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    }
    if(rnd == 1)
    {
        format(string, sizeof(string), "* %s has tried to hotwire the vehicle, and the engine started.");
        SetVehicleParamsEx(vehid, 1, lights, 1, doors, bonnet, boot, objective);
        SetTimerEx("AlarmOff", 7500, 0, "i", vehid);
    }
    return 1;
}
edit:Misiur bit me by seconds
Reply


Messages In This Thread
Random() Function Error - by MattyG - 24.03.2013, 12:02
Re: Random() Function Error - by Misiur - 24.03.2013, 12:04
Re: Random() Function Error - by doreto - 24.03.2013, 12:04
Re: Random() Function Error - by InfiniTy. - 24.03.2013, 12:05
Re: Random() Function Error - by MattyG - 24.03.2013, 12:06

Forum Jump:


Users browsing this thread: 1 Guest(s)