Can anyone help me with some small thing?
#1

Is there possible to make a funtion that if i type /car engine
on vehicle engine start it says: playername turns the key on ignition, starting the engine
on vehicle engine stop it says playername turns the key on ignition, shutting down the engine

/CAR ENGINE
pawn Код:
CMD:car(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
        return 1;
    }
    if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON)
        {
            SetVehicleEngine(vehicleid, playerid);
        }
        else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
            SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
        }
    }
pawn Код:
forward SetVehicleEngine(vehicleid, playerid);
public SetVehicleEngine(vehicleid, playerid)
{
    new string[128];
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(engine == VEHICLE_PARAMS_ON)
    {
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine stopped successfully.");
        DeletePVar(playerid, "fuelonoff");
        DestroyProgressBar(FuelBar[playerid]);
        textdrawscount--;
        FuelBar[playerid] = INVALID_BAR_ID;
        arr_Engine{vehicleid} = 0;
    }
    else if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
    {
        new
            Float: f_vHealth;

        GetVehicleHealth(vehicleid, f_vHealth);
        if(f_vHealth < 350.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - it's totalled!");
        if(VehicleFuel[vehicleid] <= 0.0) return SendClientMessageEx(playerid, COLOR_RED, "The car won't start - there's no fuel in the tank!");
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine started successfully (/car engine to turn the engine off).");
        arr_Engine{vehicleid} = 1;
        if(GetChased[playerid] < 999 && VehicleBomb[vehicleid] == 1)

Reply


Messages In This Thread
Can anyone help me with some small thing? - by Lunixx - 07.08.2015, 13:01
Re: Can anyone help me with some small thing? - by muhsah007 - 07.08.2015, 14:12

Forum Jump:


Users browsing this thread: 1 Guest(s)