SA-MP Forums Archive
Vehicle stuff - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle stuff (/showthread.php?tid=599393)



Vehicle stuff - JamalMaddox - 25.01.2016

Well I'm looking for a filterscript about vehicles
/engine(ON/OFF) /trunk(OPEN/CLOSE) /lights(ON/OFF) /lockv


Re: Vehicle stuff - valych - 25.01.2016

Try this one: https://sampforum.blast.hk/showthread.php?tid=197115. At least you can extract some pieces of code if it's not what you are actually looking for.


Re: Vehicle stuff - JamalMaddox - 25.01.2016

Nice one but i will still look for smth else anyways repped


Re: Vehicle stuff - TwinkiDaBoss - 25.01.2016

Engine
PHP код:
new
    
EngineStatus[MAX_VEHICLES]; //top of the script
CMD:engineon(playerid,params[]) {
    if(!
IsPlayerInAnyVehicle(playerid)) return Msg(playerid,COLOR_RED,"You are not inside any vehicles");
    new 
vid GetPlayerVehicleID(playerid);
    if(
EngineStatus[vid] == 1) return Msg(playerid,COLOR_RED,"This vehicles engine is already running");
    new 
enginelightsalarmdoorsbonnetbootobjective,vid GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(vid1lightsalarmdoorsbonnetbootobjective);
    
EngineStatus[vid] = 1;
    return 
true;
}
CMD:engineoff(playerid,params[]) {
    if(!
IsPlayerInAnyVehicle(playerid)) return Msg(playerid,COLOR_RED,"You are not inside any vehicles");
    new 
vid GetPlayerVehicleID(playerid);
    if(
EngineStatus[vid] == 0) return Msg(playerid,COLOR_RED,"This vehicles engine is already turned off");
    new 
enginelightsalarmdoorsbonnetbootobjective,vid GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(vid0lightsalarmdoorsbonnetbootobjective);
    
EngineStatus[vid] = 0;
    return 
true;

lights
PHP код:
new VehicleLights[MAX_VEHICLES];
CMD:lightson(playerid,params[]) {
    if(!
IsPlayerInAnyVehicle(playerid)) return Msg(playerid,COLOR_RED,"You are not inside any vehicles");
    new 
vid GetPlayerVehicleID(playerid);
    if(
VehicleLights[vid] == 1) return Msg(playerid,COLOR_RED,"This vehicle lights are already on");
    new 
enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(videngine1alarmdoorsbonnetbootobjective);
    
VehicleLights[vid] = 1;
    return 
true;
}
CMD:lightsoff(playerid,params[]) {
    if(!
IsPlayerInAnyVehicle(playerid)) return Msg(playerid,COLOR_RED,"You are not inside any vehicles");
    new 
vid GetPlayerVehicleID(playerid);
    if(
VehicleLights[vid] == 0) return Msg(playerid,COLOR_RED,"This vehicle lights are already off");
    new 
enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(videngine0alarmdoorsbonnetbootobjective);
    
VehicleLights[vid] = 0;
    return 
true;

You get my point. Just change the variables and you can change what you want. For locks, add
PHP код:
GetVehicleParamsEx(videnginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(videnginelightsalarm1bonnetbootobjective); //to lock doors 
etc etc. Code untested, let me know if there are errors or shit