[Include] Vehicle Extended Functions
#21

Update v3.0.0:


- Merged includes EVF.inc and vehicleplus.inc -> EVF.inc


- Minor code optimizations


- Added update checker


- Added support for STREAMER_ENABLE_TAGS


- Added support for FoxForeach.inc and foreach.inc


- Added support for 3DTryg.inc (some improvements)


- Added support for StreamerFunction.inc (some improvements)


- Update compatibility for YSF.inc


- Update callbacks type CallLocalFunction -> CallRemoteFunction


- Imported functions (from vehicleplus.inc)
PHP Code:
Float:EVF::GetVehicleSpeed(vehicleid,bool:kmh true,Float:velx 0.0,Float:vely 0.0,Float:velz 0.0);

GetVehicleSpawnInfo(vehicleid,&Float:x,&Float:y,&Float:z,&Float:rotation,&worldid,&interiorid);
SetVehicleSpawnInfo(vehicleid,Float:x,Float:y,Float:z,Float:rotation,worldid,interiorid);

RemoveVehiclePaintjob(vehicleid);
Float:GetVehicleSpeedCap(vehicleid);
SetVehicleSpeedCap(vehicleid,Float:maxspeed);
DisableVehicleSpeedCap(vehicleid);
IsVehicleOccupied(vehicleid);
IsVehicleFuelToggled(vehicleid);
ToggleVehicleFuel(vehicleid,bool:toggle);
IsVehicleSticky(vehicleid);
ToggleVehicleSticky(vehicleid,bool:toggle);
IsUnoccupiedDamageToggled(vehicleid);
ToggleUnoccupiedVehicleDamage(vehicleid,bool:toggle);
IsPetrolCapDestroyToggled(vehicleid);
ToggleVehiclePetrolCapDestroy(vehicleid,bool:toggle);
RestoreVehicleHorn(vehicleid);
GetVehicleHorn(vehicleid);
SetVehicleHorn(vehicleid,soundid);
GetVehicleFuel(vehicleid);
SetVehicleFuel(vehicleid,fuel);
GetVehicleBomb(vehicleid);
IsVehicleBombed(vehicleid);
RemoveVehicleBomb(vehicleid);
SetVehicleBomb(vehicleid,time 1000);
IsVehicleBombActivated(vehicleid);

IsVehicleDamageToggled(vehicleid,type);
ToggleVehicleDamageUpdate(vehicleid,type,toggle);

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);

EditVehicle(playerid,vehicleid);
EditVehicleObject(playerid,vehicleid,STREAMER_TAG_OBJECT objectid); 
- Imported callbacks (from vehicleplus.inc)
PHP Code:
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);
OnPlayerShotVehicle(playerid,vehicleid,weaponid,Float:amount,bodypart);
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); 
- Added functions:
PHP Code:
Float:GetVehicleModelTopSpeed(modelid);

GetVehicleModelName(modelid);
GetVehicleName(vehicleid); 
- Renamed function:
PHP Code:
GetVehicleDoorAmountByModelid -> GetVehicleModelDoorAmount 
- Updated function:
Code:
CreateVehicle(modelid,Float:x,Float:y,Float:z,Float:rotation,color1 = -1,color2 = -1,respawn_delay = -1,addsiren = 0,worldid = 0,interiorid = 0,bool:unoccupied_damage = false);
AddStaticVehicle -> CreateVehicle
AddStaticVehicleEx -> CreateVehicle
- Updated callback:
Code:
OnPlayerShotVehicle(playerid,vehicleid,weaponid,Float:amount,bodypart);
- Added definitions:
PHP Code:
RESET_PAINTJOB_ID
MAX_VEHICLE_PARAMS
VEHICLE_UPDATE_INTERVAL
MAX_VEHICLE_ATTACHED_OBJECTS

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

VEHICLE_DAMAGE_PANELS
VEHICLE_DAMAGE_DOORS
VEHICLE_DAMAGE_LIGHTS
VEHICLE_DAMAGE_TIRES 
- Added option for change vehicle names (default English):
PHP Code:
new const EVF_VehicleName[MAX_VEHICLE_MODELS][] = {
    
"Landstalker""Bravura""Buffalo", ...
}

#include <SAM/EVF> 
Notice:
- Some vehiclesplus.inc definitions has been changed, please read include head for get actual functions/definitions

- If you see any bug of this release, send report to me, or post here.


More functions next time.
Reply
#22

This is really useful, good job.
Reply
#23

Update v3.0.1:

- Fix Vehicle "Jumping" bug.
Reply
#24

Hello, really nice job bud, i was working on EVF like this, but i gunna merge em and use this instead!
I might have some suggestions, but first i have to test it.
Reply
#25

Update EVF v3.0.2:


- Merged includes EVF.inc and SetVehicleNeonLights.inc -> EVF.inc


- Imported functions (from SetVehicleNeonLights.inc)
PHP Code:
SetVehicleNeonLights(vehicleid,bool:enable true,color RED_NEON);
VehicleSupportsNeonLights(modelid);
GetVehicleNeonLightsState(vehicleid); 
- Added definitions:
PHP Code:
RED_NEON
BLUE_NEON
GREEN_NEON
YELLOW_NEON
PINK_NEON
WHITE_NEON 
Reply
#26

Update v3.0.3:


- Fix vehicle black color bug


- Removed deprecated functions (Use GetVehiclePartPos):
PHP Code:
GetVehicleOffset
GetVehicleBoot
GetVehicleHood
GetVehicleRoof 
- Added functions:
PHP Code:
IsToggledVehicleBulletproof(vehicleid);
ToggleVehicleBulletproof(vehicleid,bool:toggle); //default is 0 
Reply
#27

How about adding an object editing module next so users have some overhead already completed to accomplish editing objects on vehicles. They would need to do all their own saving, map editor etc.


I did make a generic prototype for my own purposes on 420DayZ check this out it is used for the vehicle editing system in the RP system which is unfinished. However it could be used to edit anything you want that does not have an editing feature.

Code:
#include <YSI\y_hooks>

enum EDITPOINTDATA
{
	pEditObject,
	Float:pEditX,
	Float:pEditY,
	Float:pEditZ,
	Float:pEditRX,
	Float:pEditRY,
	Float:pEditRZ,
	
	Float:pSaveX,
	Float:pSaveY,
	Float:pSaveZ,
	Float:pSaveRX,
	Float:pSaveRY,
	Float:pSaveRZ,
	
	pEditObjectSel,
	pEditCallBack[32],
}

static pEditPoint[MAX_PLAYERS][EDITPOINTDATA];

stock PlayerEditPoint(playerid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, callback[], objectid = -1)
{
	if(pEditPoint[playerid][pEditObject] > -1)
		DestroyDynamicObject(pEditPoint[playerid][pEditObject]);

	if(objectid == -1)
	{
		pEditPoint[playerid][pEditObject] = CreateDynamicObject(1974,
					x,
					y,
					z,
					rx,
					ry,
					rz,
					-1, -1, playerid, .priority = 1);
	    SetDynamicObjectMaterial(pEditPoint[playerid][pEditObject], 0, 10765, "airportgnd_sfse", "white", -256);
	    format(pEditPoint[playerid][pEditCallBack], 32, "%s", callback);

	    pEditPoint[playerid][pEditX] = x;
	    pEditPoint[playerid][pEditY] = y;
	    pEditPoint[playerid][pEditZ] = z;
	    pEditPoint[playerid][pEditRX] = rx;
	    pEditPoint[playerid][pEditRY] = ry;
	    pEditPoint[playerid][pEditRZ] = rz;

	    pEditPoint[playerid][pSaveX] = x;
	    pEditPoint[playerid][pSaveY] = y;
	    pEditPoint[playerid][pSaveZ] = z;
	    pEditPoint[playerid][pSaveRX] = rx;
	    pEditPoint[playerid][pSaveRY] = ry;
	    pEditPoint[playerid][pSaveRZ] = rz;

		Streamer_Update(playerid);

		EditDynamicObject(playerid, pEditPoint[playerid][pEditObject]);
	}
	else
	{
		pEditPoint[playerid][pEditObjectSel] = objectid;
        EditDynamicObject(playerid, pEditPoint[playerid][pEditObjectSel]);
	}
	
	return 1;
}

stock DestroyEditPoint(playerid)
{
	if(pEditPoint[playerid][pEditObject] != -1)
	{
		DestroyDynamicObject(pEditPoint[playerid][pEditObject]);
		pEditPoint[playerid][pEditObject] = -1;
	}
	return 1;
}

hook OnGameModeInit()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    pEditPoint[i][pEditObject] = -1;
	    pEditPoint[i][pEditObjectSel] = -1;
	}
	return 1;
}

hook OnFilterScriptInit()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    pEditPoint[i][pEditObject] = -1;
	    pEditPoint[i][pEditObjectSel] = -1;
	}
	return 1;
}

public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
	if(objectid == pEditPoint[playerid][pEditObject] || objectid == pEditPoint[playerid][pEditObjectSel])
	{
		if(response == EDIT_RESPONSE_FINAL)
		{
		    if(pEditPoint[playerid][pEditObjectSel])
		    {
			    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
			        playerid, objectid, response,
					x,
					y,
					z,
					rx,
					ry,
					rz,
					x - pEditPoint[playerid][pSaveX],
					y - pEditPoint[playerid][pSaveY],
					z - pEditPoint[playerid][pSaveZ]);
	            DestroyEditPoint(playerid);
		    }
		    else
		    {
			    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
			        playerid, objectid, response,
					pEditPoint[playerid][pEditX],
					pEditPoint[playerid][pEditY],
					pEditPoint[playerid][pEditZ],
					pEditPoint[playerid][pEditRX],
					pEditPoint[playerid][pEditRY],
					pEditPoint[playerid][pEditRZ],
					pEditPoint[playerid][pEditX] - pEditPoint[playerid][pSaveX],
					pEditPoint[playerid][pEditY] - pEditPoint[playerid][pSaveY],
					pEditPoint[playerid][pEditZ] - pEditPoint[playerid][pSaveZ]);
	            DestroyEditPoint(playerid);
			}
		}
		else if(response == EDIT_RESPONSE_UPDATE)
		{
		    pEditPoint[playerid][pEditX] = x;
		    pEditPoint[playerid][pEditY] = y;
		    pEditPoint[playerid][pEditZ] = z;
		    pEditPoint[playerid][pEditRX] = rx;
		    pEditPoint[playerid][pEditRY] = ry;
		    pEditPoint[playerid][pEditRZ] = rz;

		    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
		        playerid, objectid, response, x, y, z, rx, ry, rz,
				pEditPoint[playerid][pEditX] - pEditPoint[playerid][pSaveX],
				pEditPoint[playerid][pEditY] - pEditPoint[playerid][pSaveY],
				pEditPoint[playerid][pEditZ] - pEditPoint[playerid][pSaveZ]);
		}
		else if(response == EDIT_RESPONSE_CANCEL)
		{
		    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
		        playerid, objectid, response,
				pEditPoint[playerid][pSaveX],
				pEditPoint[playerid][pSaveY],
				pEditPoint[playerid][pSaveZ],
				pEditPoint[playerid][pSaveRX],
				pEditPoint[playerid][pSaveRY],
				pEditPoint[playerid][pSaveRZ],
				0.0, 0.0, 0.0);
            DestroyEditPoint(playerid);
		}
	}
	return 1;
}


hook OnPlayerDisconnect(playerid, reason)
{
	DestroyEditPoint(playerid);
	return 1;
}
Reply
#28

Holy!, nice include man +rep
Reply
#29

Update v3.1.0:

- Fixed storing information (changed setproperty, getproperty -> array)

- Fixed vehicle meta

- Added check if vehicle is correct stored in memory

- Merged OnVehicleModEx by Emmet

- Added definitions:
PHP Code:
MIN_VEHICLE_COMPONENT_ID
MAX_VEHICLE_COMPONENT_ID 
- Added functions:
PHP Code:
GetComponentName(componentid,name[],len sizeof(name));
EVF::IsPlayerInModShop(playerid);
IsValidComponentForVehicle(vehicleid,componentid);
GetVehicleComponentPrice(componentid); 
- Added callback:
PHP Code:
OnVehicleModEx(playerid,vehicleid,componentid,price,illegal); 
- Added remote functions:
PHP Code:
EVF_ImportVehicle(vehicleid,modelid,Float:x,Float:y,Float:z,Float:angle,color1,color2,worldid,interiorid,unoccupied_damage);
EVF_RemoveVehicle(vehicleid); 
Reply
#30

Update v3.1.1:


- Fixed fuel system (thanks Unrea1 for Testing)


- Removed function:
PHP Code:
EVF::GetVehicleSpeed(vehicleid,bool:kmh true,Float:velx 0.0,Float:vely 0.0,Float:velz 0.0); 
- Added function:
PHP Code:
EVF::GetVehicleSpeed(vehicleid); 
- Added definition:
PHP Code:
VEHICLE_SPEED_MULTIPLIER //allow to redefine before 3DTryg.inc and EVF.inc
MULTIPLIER_FUEL_SYSTEM   //allow to redefine before EVF.inc 
- Fixed
PHP Code:
OnVehicleModEx call for all scripts 
- Added support for foreach (iter: Vehicles or Vehicle)


- Changed definition name:
PHP Code:
MAX_VEHICLE_FUEL -> DEFAULT_VEHICLE_FUEL 
Reply
#31

I was just updating from 'vehicleplus.inc' and updated it to the newest 'EVF.inc' and included it, but upon including it when I compile the compiler crashes.

I can't think of what I can provide you for help to solve the issue other than my other includes.

PHP код:
#include <a_samp>
#include <izcmd>
#include <a_mysql>
#include <streamer>
#include <foreach>
#include <sscanf2>
#include <ColAndreas>
#include <3DTryg>
#include <EVF> 
Thanks man.
Reply
#32

Quote:
Originally Posted by Blackboe
Посмотреть сообщение
I was just updating from 'vehicleplus.inc' and updated it to the newest 'EVF.inc' and included it, but upon including it when I compile the compiler crashes.

I can't think of what I can provide you for help to solve the issue other than my other includes.

PHP код:
#include <a_samp>
#include <izcmd>
#include <a_mysql>
#include <streamer>
#include <foreach>
#include <sscanf2>
#include <ColAndreas>
#include <3DTryg>
#include <EVF> 
Thanks man.
First check changelog for merge vehicleplus:
http://forum.sa-mp.com/showpost.php?...9&postcount=21
Reply
#33

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
.
Yessir.
I removed all of the 'vehicleplus functions that were used in my script previous to making the merge in hopes of making it much more smooth.
Still no luck.
Reply
#34

EVF_OnVehicleRespray is buggy? It does not get called at the right time, instead when selecting mod menu(components) it gets called but while selecting colors, it dosent.
Reply
#35

Quote:
Originally Posted by Debjit
Посмотреть сообщение
EVF_OnVehicleRespray is buggy? It does not get called at the right time, instead when selecting mod menu(components) it gets called but while selecting colors, it dosent.
EVF::OnVehicleRespray is a hook for OnVehicleRespray for save vehicle property, is called by OnVehicleRespray
Reply
#36

Update v3.2.0:

- Merged Vehicle blinks (v1.1) SYSTEM by Kubi.

- Added functions:
PHP код:
EVF::IsTrailer(vehicleid);
EVF::IsCarBlinking(vehicleid);
EVF::DisableCarBlinking(vehicleid);
EVF::SetCarBlinking(vehicleid,side,bool:skip=false);
EVF::ToggleVehicleBlinking(bool:toggle);
EVF::IsToggledVehicleBlinking(); 
- Added definitions:
PHP код:
EVF_CAR_BLINK_NONE
EVF_CAR_BLINK_LEFT
EVF_CAR_BLINK_RIGHT
EVF_CAR_BLINK_EMERGENCY 
Reply
#37

Update v3.2.1:

- Fixed support for STREAMER_ENABLE_TAGS

- Added functions:
PHP код:
GetComponentTypeName(component);
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); 
- Updated functions:
PHP код:
GetVehicleDoorState(vehicleid,doorid); //also return 0 if is unset
GetVehicleWindowState(vehicleid,doorid); //also return 0 if is unset 
Reply
#38

Quote:
Originally Posted by Switel12
Посмотреть сообщение
Update v3.2.1:

- Fixed support for STREAMER_ENABLE_TAGS

- Added functions:
PHP код:
GetComponentTypeName(component);
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); 
- Updated functions:
PHP код:
GetVehicleDoorState(vehicleid,doorid); //also return 0 if is unset
GetVehicleWindowState(vehicleid,doorid); //also return 0 if is unset 
Welcome back, I guess.
Reply
#39

Why did they ban you lol?
Reply
#40

I am from the team of Abyss Morgan, who got banned by TommyB without reason.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)