[Include] VCF - Vehicle Component Functions
#1

Introduction

This include was made in order to facilitate the manipulation of the state of the vehicle components in the use of the GetVehicleDamageStatus, because the function uses bits to manipulate the states and as this is not a well-known subject in Pawn, I decided to develop this include to do the "heavy" work

BUGS

The include is still in a BETA version and may contain bugs, in the tests that I did, there were none, but there may be some that I have not seen in the tests, if any, et me know as soon as possible to update.

Functions

Include now has the following functions:

PHP Code:
// Check this light is on or off 
IsLightEnabled(vehicleidlightlightSide)
// Changes the light status 
ToogleLightState(vehicleidlightlightSide)
// Get the current state of one of the vehicle doors 
// Note: Hood and trunk are considered doors in SA-MP 
GetDoorState(vehicleiddoor)
// Changes the state of one of the vehicle doors 
SetDoorState(vehicleiddoordoorState)
// Check that the tire is inflated
IsTireInflated(vehicleidtire)
// Change tire condition 
ToogleTireState(vehicleidtire
Download

GitHub
Reply
#2

Useful, but why did you upload an amx file in GitHub?
Reply
#3

an FS showing the operation of include, for who wants to see it working without having to develop a system just to see what she does

/car [ modelid ] - create a vehicle
/door [ vehicleid ] - command to fix doors
/light [ vehicleid ] - command to change the state of the lights
Note: The lights only works if the game time is at night
Reply
#4

Just going to point out it doesn't make sense to use "Alter" instead of "Set" that is rather confusing.
Reply
#5

Quote:
Originally Posted by Pottus
View Post
Just going to point out it doesn't make sense to use "Alter" instead of "Set" that is rather confusing.
Exactly.
Reply
#6

@Updated
  • removed tags
  • renamed functions
  • add hook OnVehicleDamageStatusUpdate
Reply
#7

Well it’s clean code unlike most of the stuff being released nowadays so props on that, i also made a quick PR make sure u check it out, gj.

Here’s a file containing the BBcode converted by Y_Less’s forum enhancer (File is attached).


It would look like this:

VCF



Installation

Simply install to your project:

Code:
sampctl package install MrKnockout/VCF
Include in your code and begin using the library:

Code:
#include <VCF>
Usage

Code:
// Check this light is on or off  
IsLightEnabled(vehicleid, light, lightSide); 

// Changes the light status  
ToogleLightState(vehicleid, light, lightSide); 

/* Get the current state of one of the vehicle doors  
Note: Hood and trunk are considered doors in SA-MP */  
GetDoorState(vehicleid, door); 

// Changes the state of one of the vehicle doors  
SetDoorState(vehicleid, door, doorState); 

// Check that the tire is inflated 
IsTireInflated(vehicleid, tire); 

// Change tire condition  
ToogleTireState(vehicleid, tire);
Testing

To test, simply run the package:

Code:
sampctl package run
Reply
#8

Extremely useful for RP scripts, and just about anything in between, honestly! Nice work, I've been waiting to see something like this released.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)