Engine script issue
#7

dont really know if vortex has this allredy :X
pawn Код:
//this goes at the top of your script/gamemode with all the other "new"
new VehEngineStat[MAX_VEHICLES];

//then add whats inside the callback into your current callback
//so do "CTRL + F" and type "OnPlayerKey" and it would show the "public" then just copy and past the callback bellow
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new playerState = GetPlayerState(playerid);
    if(newkeys & KEY_SUBMISSION && playerState == PLAYER_STATE_DRIVER)
    {
        if(VehLights[vehicleid] == 0) VehicleLights(vehicleid,true);
        else VehicleLights(vehicleid,false);
    }
}

//At the bottom , very bottom of the script just add this
stock VehicleEngine(vehicleid,VAR)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(VAR == 1)
    {
        VehEngineStat[vehicleid]=1;
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    }else{
        VehEngineStat[vehicleid]=0;
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    }
}
it has been tested and i use it in one of my gamemodes so yeah
just to let you know

VehicleEngine(vehicleid,VAR)
vehicled is the vehicle's engine you want to taggle ON/OFF
VAR is the the ON/OFF fucntion, "TRUE" = ON , "FALSE" = OFF
Reply


Messages In This Thread
Engine script issue - by Cole_William - 13.02.2012, 21:31
Re: Engine script issue - by park4bmx - 13.02.2012, 21:40
Re: Engine script issue - by Cole_William - 13.02.2012, 21:44
Re: Engine script issue - by Cole_William - 13.02.2012, 21:48
Re: Engine script issue - by park4bmx - 13.02.2012, 22:02
Re: Engine script issue - by Cole_William - 13.02.2012, 22:08
Re: Engine script issue - by park4bmx - 13.02.2012, 22:12
Re: Engine script issue - by Cole_William - 13.02.2012, 22:18
Re: Engine script issue - by Cole_William - 13.02.2012, 22:28
Re: Engine script issue - by BrandyPenguin - 13.02.2012, 22:31

Forum Jump:


Users browsing this thread: 1 Guest(s)