/**********************************************************************************************************************************
* *
* )( Extended Vehicle Functions )( *
* *
* Copyright © 2019 Abyss Morgan. All rights reserved. *
* Contributors: Emmet_, Pottus, kvann, Hanger, Freaksken, Gammix, Yashas, Admigo, RIDE2DAY, Unrea1, Katarina Calzaghe *
* *
* Website: adm.ct8.pl *
* Download: adm.ct8.pl/r/download *
* *
* Plugins: Streamer *
* Modules: None *
* *
* File Version: 3.3.1 *
* Streamer Version: 2.9.4 *
* *
* Functions: *
* IsValidVehicleModelID(modelid); *
* GetVehiclePanels(vehicleid,&front_left,&front_right,&rear_left,&rear_right,&windshield,&front_bumper,&rear_bumper); *
* SetVehiclePanels(vehicleid,front_left,front_right,rear_left,rear_right,windshield,front_bumper,rear_bumper); *
* GetVehicleLights(vehicleid,&front_left_light,&front_right_light,&back_lights); *
* SetVehicleLights(vehicleid,front_left_light,front_right_light,back_lights); *
* GetVehicleDoors(vehicleid,&bonnet,&boot,&driver_door,&passenger_door); *
* SetVehicleDoors(vehicleid,bonnet,boot,driver_door,passenger_door); *
* GetVehicleTires(vehicleid,&front_left,&front_right,&rear_left,&rear_right); *
* SetVehicleTires(vehicleid,front_left,front_right,rear_left,rear_right); *
* GetVehicleWindowState(vehicleid,doorid); *
* SetVehicleWindowState(vehicleid,doorid,window_state); *
* GetVehicleDoorState(vehicleid,doorid); *
* SetVehicleDoorState(vehicleid,doorid,door_state); *
* IsValidVehicleDoor(vehicleid,doorid); *
* GetVehicleModelDoorAmount(modelid); *
* GetVehicleDoorAmount(vehicleid); *
* SwitchVehicleEngine(vehicleid,bool:engine_status); *
* SwitchVehicleLight(vehicleid,bool:light_status); *
* SwitchVehicleAlarm(vehicleid,bool:alarm_status); *
* SwitchVehicleDoors(vehicleid,bool:doors_status); *
* SwitchVehicleBonnet(vehicleid,bool:bonnet_status); *
* SwitchVehicleBoot(vehicleid,bool:boot_status); *
* SwitchVehicleObjective(vehicleid,bool:objective_status); *
* GetVehicleParams(vehicleid,type); *
* SetVehicleParams(vehicleid,type,status,delay = 0); *
* GetVehicleRandomColors(modelid,&color1,&color2); *
* GetNearestVehicleToPos(Float:x,Float:y,Float:z,worldid=-1,interiorid=-1,Float:maxdist=0.0,bool:fast=true,except_vid=0); *
* GetNearestVehicleToPlayer(playerid,Float:maxdist=0.0,bool:fast=false); *
* GetVehicleDriver(vehicleid); *
* Float:GetVehicleModelTopSpeed(modelid); *
* Float:GetVehicleTopSpeed(vehicleid); *
* SetVehicleInterior(vehicleid,interiorid); *
* GetVehicleSeats(vehicleid); *
* GetVehicleModelSeats(modelid); *
* IsVehicleSeatOccupied(vehicleid,seatid); *
* IsValidVehicle(vehicleid); *
* RemoveVehiclePaintjob(vehicleid); *
* SetVehicleHorn(vehicleid,soundid); *
* GetVehicleHorn(vehicleid); *
* RestoreVehicleHorn(vehicleid); *
* GetVehicleBomb(vehicleid); *
* IsVehicleBombed(vehicleid); *
* RemoveVehicleBomb(vehicleid); *
* SetVehicleBomb(vehicleid,time = 1000); *
* IsVehicleBombActivated(vehicleid); *
* Float:EVF::GetVehicleSpeed(vehicleid); *
* SetVehicleSpeedCap(vehicleid,Float:maxspeed); *
* Float:GetVehicleSpeedCap(vehicleid); *
* DisableVehicleSpeedCap(vehicleid); *
* SetVehicleFuel(vehicleid,fuel); *
* GetVehicleFuel(vehicleid); *
* ToggleVehicleFuel(vehicleid,bool:toggle); *
* IsVehicleFuelToggled(vehicleid); *
* ToggleVehicleSticky(vehicleid,bool:toggle); *
* IsVehicleSticky(vehicleid); *
* ToggleUnoccupiedVehicleDamage(vehicleid,bool:toggle); *
* IsUnoccupiedDamageToggled(vehicleid); *
* ToggleVehiclePetrolCapDestroy(vehicleid,bool:toggle); *
* IsPetrolCapDestroyToggled(vehicleid); *
* IsVehicleDamageToggled(vehicleid,type); *
* ToggleVehicleDamageUpdate(vehicleid,type,toggle); *
* GetVehicleNextSeat(vehicleid,passenger = 1); *
* TeleportVehicle(vehicleid,Float:x,Float:y,Float:z,Float:angle,worldid = -1,interiorid = -1); *
* GetVehicleSlotAttachedObject(vehicleid,slot); *
* IsObjectAttachedToVehicle(objectid,vehicleid); *
* EVF::UpdateVehicleDamage(vehicleid,type); *
* EVF::UpdateVehicleDamageStatus(vehicleid,type,update); *
* EVF::GetVehicleDamageStatus(vehicleid,type); *
* SetVehicleNeonLights(vehicleid,bool:enable = true,color = RED_NEON,slotid = 0); *
* VehicleSupportsNeonLights(modelid); *
* GetVehicleNeonLightsState(vehicleid,slotid = 0); *
* IsToggledVehicleBulletproof(vehicleid); *
* ToggleVehicleBulletproof(vehicleid,bool:toggle); *
* GetComponentName(componentid,name[],len = sizeof(name)); *
* GetComponentTypeName(component); *
* EVF::IsPlayerInModShop(playerid); *
* IsValidComponentForVehicle(vehicleid,componentid); *
* GetVehicleComponentPrice(componentid); *
* GetVehicleName(vehicleid); *
* GetVehicleModelName(modelid); *
* EVF::IsTrailer(vehicleid); *
* EVF::IsCarBlinking(vehicleid); *
* EVF::DisableCarBlinking(vehicleid); *
* EVF::SetCarBlinking(vehicleid,side,bool:skip=false); *
* EVF::ToggleVehicleBlinking(bool:toggle); *
* EVF::IsToggledVehicleBlinking(); *
* *
* Remote functions: *
* EVF_ImportVehicle(vehicleid,modelid,Float:x,Float:y,Float:z,Float:angle,color1,color2,worldid,interiorid,unoccupied_damage); *
* EVF_RemoveVehicle(vehicleid); *
* *
* Compatible with YSF Functions: *
* GetVehicleColor(vehicleid,&color1,&color2); *
* GetVehiclePaintjob(vehicleid); *
* GetVehicleInterior(vehicleid); *
* EVF::GetVehicleSpawnInfo(vehicleid,&Float:x,&Float:y,&Float:z,&Float:rotation,&worldid,&interiorid); *
* EVF::SetVehicleSpawnInfo(vehicleid,Float:x,Float:y,Float:z,Float:rotation,worldid,interiorid); *
* IsVehicleOccupied(vehicleid); *
* *
* Callbacks: *
* OnVehicleCreated(vehicleid); //Called when a vehicle is created. *
* OnVehicleDestroyed(vehicleid); //Called when a vehicle is deleted. *
* OnTrailerHooked(playerid,vehicleid,trailerid); //Called when a trailer is hooked. *
* OnTrailerUnhooked(playerid,vehicleid,trailerid); //Called when a trailer is unhooked. *
* OnPlayerShotVehicle(playerid,vehicleid,weaponid,Float:amount,bodypart); //Called when a player shoots at a vehicle. *
* OnVehiclePosChange(vehicleid,Float:newx,Float:newy,Float:newz,Float:newangle,Float:oldx,Float:oldy,Float:oldz,Float:oldangle); *
* OnVehicleVelocityChange(vehicleid,Float:newx,Float:newy,Float:newz,Float:oldx,Float:oldy,Float:oldz); *
* OnVehicleHealthChange(vehicleid,Float:newhealth,Float:oldhealth); *
* OnVehicleFuelChange(vehicleid,newfuel,oldfuel); *
* OnVehicleBombDeactivate(vehicleid); *
* OnVehicleBombExplode(vehicleid); *
* OnPlayerEditVehicle(playerid,vehicleid,response,Float:fX,Float:fY,Float:fZ,Float:fRotZ); *
* OnPlayerEditVehicleObject(playerid,vehicleid,response,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz); *
* OnPlayerReachSpeedCapLimit(playerid,vehicleid,Float:speed); *
* OnVehicleBombActivate(vehicleid); *
* OnVehicleModEx(playerid,vehicleid,componentid,price,illegal); *
* *
* Definitions: *
* INVALID_SEAT_ID *
* INVALID_PAINTJOB_ID *
* VEHICLE_UPDATE_INTERVAL *
* MAX_VEHICLE_ATTACHED_OBJECTS *
* RESET_PAINTJOB_ID *
* MAX_VEHICLE_PARAMS *
* MAX_VEHICLE_MODELS *
* DEFAULT_VEHICLE_FUEL *
* VEHICLE_SPEED_MULTIPLIER *
* MULTIPLIER_FUEL_SYSTEM *
* *
* BONNET_HEALTHY_CLOSED *
* BONNET_HEALTHY_OPENED *
* BONNET_DAMAGED_CLOSED *
* BONNET_DAMAGED_OPENED *
* BONNET_MISSING *
* *
* BOOT_HEALTHY_CLOSED *
* BOOT_HEALTHY_OPENED *
* BOOT_DAMAGED_CLOSED *
* BOOT_DAMAGED_OPENED *
* BOOT_MISSING *
* *
* DOOR_HEALTHY_CLOSED *
* DOOR_HEALTHY_OPENED *
* DOOR_DAMAGED_CLOSED *
* DOOR_DAMAGED_OPENED *
* DOOR_MISSING *
* *
* BUMPER_HEALTHY *
* BUMPER_CRUSHED *
* BUMPER_HANGING *
* BUMPER_MISSING *
* *
* WINDSHIELD_HEALTHY *
* WINDSHIELD_DAMAGED *
* WINDSHIELD_MISSING *
* *
* LIGHT_ENABLE *
* LIGHT_DISABLE *
* *
* TIRE_HEALTHY *
* TIRE_DAMAGED *
* *
* DOOR_DRIVER *
* DOOR_PASSENGER *
* DOOR_BACKLEFF *
* DOOR_BACKRIGHT *
* *
* VEHICLE_DAMAGE_PANELS *
* VEHICLE_DAMAGE_DOORS *
* VEHICLE_DAMAGE_LIGHTS *
* VEHICLE_DAMAGE_TIRES *
* *
* RED_NEON *
* BLUE_NEON *
* GREEN_NEON *
* YELLOW_NEON *
* PINK_NEON *
* WHITE_NEON *
* *
* EVF_CAR_BLINK_NONE *
* EVF_CAR_BLINK_LEFT *
* EVF_CAR_BLINK_RIGHT *
* EVF_CAR_BLINK_EMERGENCY *
* *
* MIN_VEHICLE_COMPONENT_ID *
* MAX_VEHICLE_COMPONENT_ID *
* *
* Enums: *
* enum 'EVF::VehicleProperties' *
* # e_VEHICLE_PAINTJOB *
* # e_VEHICLE_INTERIOR *
* # e_VEHICLE_COLOR_1 *
* # e_VEHICLE_COLOR_2 *
* # e_VEHICLE_HORN *
* # e_VEHICLE_SPAWN_X *
* # e_VEHICLE_SPAWN_Y *
* # e_VEHICLE_SPAWN_Z *
* # e_VEHICLE_SPAWN_A *
* # e_VEHICLE_SPAWN_VW *
* # e_VEHICLE_SPAWN_INT *
* # e_VEHICLE_SPEED_CAP *
* # e_VEHICLE_FUEL_USE *
* # e_VEHICLE_FUEL *
* # e_VEHICLE_STICKY *
* # e_VEHICLE_UNO_DAMAGE *
* # e_VEHICLE_CAP_DAMAGE *
* # e_VEHICLE_EDITOR *
* # e_VEHICLE_DAMAGE_PANELS *
* # e_VEHICLE_DAMAGE_DOORS *
* # e_VEHICLE_DAMAGE_LIGHTS *
* # e_VEHICLE_DAMAGE_TIRES *
* # e_VEHICLE_BOMB *
* # e_VEHICLE_BOMB_TIMER *
* # e_VEHICLE_BULLETPROOF *
* # e_VEHICLE_STORED *
* *
* enum 'EVF::VehicleBodyPart' *
* # VEHICLE_BODYPART_UNKNOWN *
* # VEHICLE_BODYPART_FL_WHEEL - Front Left *
* # VEHICLE_BODYPART_FR_WHEEL - Front Right *
* # VEHICLE_BODYPART_BL_WHEEL - Back Left *
* # VEHICLE_BODYPART_BR_WHEEL - Back Right *
* # VEHICLE_BODYPART_PETROLCAP *
* *
* enum 'EVF::ParamTypes' *
* # VEHICLE_TYPE_ENGINE *
* # VEHICLE_TYPE_LIGHTS *
* # VEHICLE_TYPE_ALARM *
* # VEHICLE_TYPE_DOORS *
* # VEHICLE_TYPE_BONNET *
* # VEHICLE_TYPE_BOOT *
* # VEHICLE_TYPE_OBJECTIVE *
* *
**********************************************************************************************************************************/
//syntax has been changed
GetVehicleLights(vehicleid,&front_left_light,&front_right_light,&back_lights);
SetVehicleLights(vehicleid,front_left_light,front_right_light,back_lights);
GetVehicleParams(vehicleid,type);
SetVehicleParams(vehicleid,type,status,delay = 0);
GetVehicleBoot(vehicleid,&Float:x,&Float:y,&Float:z);
GetVehicleHood(vehicleid,&Float:x,&Float:y,&Float:z);
GetVehicleRoof(vehicleid,&Float:x,&Float:y,&Float:z);
GetVehicleRandomColors(modelid,&color1,&color2);
GetVehicleColor(vehicleid,&color1,&color2);
GetNearestVehicle(vehicleid);
GetVehiclePaintjob(vehicleid);
GetVehicleDriver(vehicleid);
GetVehicleTopSpeed(vehicleid);
GetVehicleInterior(vehicleid);
SetVehicleInterior(vehicleid,interiorid);
GetVehicleSeats(vehicleid);
GetVehicleModelSeats(modelid);
ResetVehiclePaintjob(vehicleid);
IsVehicleSeatOccupied(vehicleid,seatid);
IsValidVehicle(vehicleid);
OnVehicleCreated(vehicleid); //Called when a vehicle is created.
OnVehicleDestroyed(vehicleid); //Called when a vehicle is deleted.
OnTrailerHooked(playerid,vehicleid,trailerid); //Called when a trailer is hooked.
OnTrailerUnhooked(playerid,vehicleid,trailerid); //Called when a trailer is unhooked.
OnPlayerShootVehicle(playerid,vehicleid,weaponid); //Called when a player shoots at a vehicle.
//Param Types:
VEHICLE_TYPE_ENGINE
VEHICLE_TYPE_LIGHTS
VEHICLE_TYPE_ALARM
VEHICLE_TYPE_DOORS
VEHICLE_TYPE_BONNET
VEHICLE_TYPE_BOOT
VEHICLE_TYPE_OBJECTIVE
//Offset Types:
VEHICLE_OFFSET_BOOT
VEHICLE_OFFSET_HOOD
VEHICLE_OFFSET_ROOF
SetVehicleWindowState(vehicleid, window_id, bool:state); GetVehicleWindowState(vehicleid, window_id);
Window's id's:States:
- DRIVER
- PASSENGER
- BACKLEFF
- BACKRIGHT
- TRUE - opened.
- FALSE - closed.
new Windows[212][] = { {4}, // Landstalker {2}, // Bravura {2}, // Buffalo {2}, // Linerunner {4}, // Perenniel {4}, // Sentinel {2}, // Dumper {2}, // Firetruck {2}, // Trashmaster {4}, // Stretch {2}, // Manana {2}, // Infernus {2}, // Voodoo {2}, // Pony {2}, // Mule {2}, // Cheetah {2}, // Ambulance {2}, // Leviathan {4}, // Moonbeam {2}, // Esperanto {4}, // Taxi {4}, // Washington {2}, // Bobcat {2}, // Mr. Whoopee {0}, // BF Injection {1}, // Hunter {4}, // Premier {2}, // Enforcer {2}, // Securicar {0}, // Banshee {0}, // Predator {0}, // Bus {0}, // Rhino {2}, // Barracks {2}, // Hotknife {0}, // Article trailer {2}, // Previon {0}, // Coach {4}, // Cabbie {0}, // Stallion {2}, // Rumpo {0}, // RC Bandit {2}, // Romero {2}, // Packer {2}, // Monster {4}, // Admiral {0}, // Squallo {2}, // Seasparrow {0}, // Pizzaboy {0}, // Tram {0}, // Article Trailer 2 {2}, // Turismo {0}, // Speeder {0}, // Reefer {0}, // Tropic {2}, // Flatbed {2}, // Yankee {0}, // Caddy {4}, // Solair {2}, // Topfun Van (Berkley's RC) {0}, // Skimmer {0}, // PCJ-600 {0}, // Faggio {0}, // Freeway {0}, // RC Baron {0}, // RC Raider {4}, // Glendale {4}, // Oceanic {0}, // Sanchez {2}, // Sparrow {4}, // Patriot {0}, // Quad {0}, // Coastguard {0}, // Dinghy {2}, // Hermes {2}, // Sabre {1}, // Rustler {2}, // ZR-350 {2}, // Walton {4}, // Regina {0}, // Comet {0}, // BMX {2}, // Burrito {2}, // Camper {0}, // Marquis {0}, // Baggage {0}, // Dozer {4}, // Maverick {4}, // SAN News Maverick {2}, // Rancher {4}, // FBI Rancher {2}, // Virgo {4}, // Greenwood {0}, // Jetmax {0}, // Hotring Racer {2}, // Sandking {2}, // Blista Compact {4}, // Police Maverick {2}, // Boxville {2}, // Benson {2}, // Mesa {0}, // RC Goblin {0}, // Hotring Racer A {0}, // Hotring Racer B {0}, // Bloodring Banger {2}, // Rancher Lure {2}, // Super GT {4}, // Elegant {2}, // Journey {0}, // Bike {0}, // Mountain Bike {2}, // Beagle {0}, // Cropduster {0}, // Stuntplane {2}, // Tanker {2}, // Roadtrain {4}, // Nebula {2}, // Majestic {2}, // Buccaneer {0}, // Shamal {1}, // Hydra {0}, // FCR-900 {0}, // NRG-500 {0}, // HPV1000 {2}, // Cement Truck {2}, // Towtruck {2}, // Fortune {2}, // Cadrona {2}, // FBI Truck {4}, // Willard {0}, // Forklift {0}, // Tractor {0}, // Combine Harvester {0}, // Feltzer {2}, // Remington {2}, // Slamvan {0}, // Blade {0}, // Freight (Train) {0}, // Brownstreak (Train) {0}, // Vortex {4}, // Vincent {2}, // Bullet {2}, // Clover {2}, // Sadler {2}, // Firetruck LA {2}, // Hustler {4}, // Intruder {4}, // Primo {0}, // Cargobob {2}, // Tampa {4}, // Sunrise {4}, // Merit {2}, // Utility van {0}, // Nevada {2}, // Yosemite {0}, // Windsor {2}, // Monster "A" {2}, // Monster "B" {2}, // Uranus {2}, // Jester {4}, // Sultan {4}, // Stratum {2}, // Elegy {2}, // Raindance {0}, // RC Tiger {2}, // Flash {4}, // Tahoma {0}, // Savanna {0}, // Bandito {0}, // Freight Flat Trailer (Train) {0}, // Streak Trailer (Train) {0}, // Kart {0}, // Mower {2}, // Dune {2}, // Sweeper {0}, // Broadway {2}, // Tornado {0}, // AT400 {2}, // DFT-30 {4}, // Huntley {4}, // Stafford {0}, // BF-400 {2}, // Newsvan {2}, // Tug {0}, // Petrol Trailer {4}, // Emperor {0}, // Wayfarer {2}, // Euros {2}, // Hotdog {2}, // Club {0}, // Freight Box Trailer (Train) {0}, // Article Trailer 3 {0}, // Andromada {2}, // Dodo {0}, // RC Cam {0}, // Launch {4}, // Police Car (LSPD) {4}, // Police Car (SFPD) {4}, // Police Car (LVPD) {2}, // Police Ranger {2}, // Picador {0}, // S.W.A.T {2}, // Alpha {2}, // Phoenix {4}, // Glendale Shit {2}, // Sadler Shit {0}, // Baggage Trailer "A" {0}, // Baggage Trailer "B" {0}, // Tug Stairs Trailer {2}, // Boxville {0}, // Farm Trailer {0} // Utility Trailer };
GetVehicleWindowState(vehicleid,doorid);
SetVehicleWindowState(vehicleid,doorid,window_state);
GetVehicleDoorState(vehicleid,doorid);
SetVehicleDoorState(vehicleid,doorid,door_state);
bool:IsValidVehicleDoor(vehicleid,doorid);
GetVehicleDoorAmountByModelid(modelid);
GetVehicleDoorAmount(vehicleid);
//Door ID:
DOOR_DRIVER
DOOR_PASSENGER
DOOR_BACKLEFF
DOOR_BACKRIGHT
//Other:
MAX_VEHICLE_MODEL
Exactly what I needed, thanks man!
EDIT: After some figuring out why the provided light functions did not work correctely, I found that the lights used the wrong bits. I've updated the functions on this wiki page and added the documentation on this wiki page. |
bool:IsValidVehicleModelID(modelid);
SwitchVehicleEngine(vehicleid,bool:engine_status);
SwitchVehicleAlarm(vehicleid,bool:alarm_status);
SwitchVehicleDoors(vehicleid,bool:doors_status);
SwitchVehicleBonnet(vehicleid,bool:bonnet_status);
SwitchVehicleBoot(vehicleid,bool:boot_status);
SwitchVehicleObjective(vehicleid,bool:objective_status);
GetVehiclePaintjob(vehicleid); //return INVALID_PAINTJOB_ID if vehicle is invalid
Actually i can make colored windows if i get accurate window object ids, would be a hard working getting all offsets though.
@Crayder: I will add that with the new update. Next update could have following features:
|
I came from Gammix's thread.
Can you add features like this?is this possible ? |
1649,3034,3858,3859,
Try it,I'm on my phone right now,can't check it |
I came from Gammix's thread.
Can you add features like this?is this possible ? |
Hmm, after thinking, I find the only possible is the neon system.
|
A new custom vehicle extensions system (relevant to AddComponentToVehicle)
For example: pawn Code:
pawn Code:
|
Vehicle wheel spray system (like in GTA V, using key combinations, produce wheel smoke/spray)
|
Neon is regular neon. About smoke, there are lot of smoke objects you can use to attach at vehicle wheel or engine and so, just need to get the coordinates.
This one would be hard and not look good, so leave this. Similar case to smoke but only when a player does burnout. 'This already exist as a filterscript, just need to port or leave it! |