Engine script issue
#1

Ok guys when i enter my car the engine is allready on but i want it OFF when first enter and stay on when they get out/ back in....
Please help me!
If you can copy/past the corrections to this with a qoute that would help ALOT

I posted in pastebin for such large code http://pastebin.com/HwWf5emX
Reply
#2

inser this
pawn Код:
//at the top
new VehEngineStat[MAX_VEHICLES];


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 bottome
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);
    }
}
Reply
#3

Ok thanks I will try this
Reply
#4

Tried it it didnt work.....
Reply
#5

Quote:
Originally Posted by Cole_Trethewey
Посмотреть сообщение
Tried it it didnt work.....
what exactly u get errors or ?
Reply
#6

I got ALOT of errors this might helpp: This is vortex.......Edit.... Like idk were i should paste it if you can tell me it would help
Reply
#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
#8

For the Public do i post it over the old or just paste under?
Reply
#9

Screw it xD
Reply
#10

If i under stand right you have problem with this code(engine command and engine)?
pawn Код:
public OnGameModeInit() {
// Do you have there next line:
    ManualVehicleEngineAndLights();
}
fix of engine command you can find:
http://pastebin.com/1knxYvkX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)