SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 14/06/2018, 11:11 PM   #1
MBJ
Big Clucker
 
Join Date: Jul 2016
Posts: 196
Reputation: 72
Default VCF - Vehicle Component Functions

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
__________________



Last edited by MBJ; 29/09/2018 at 11:03 PM.
MBJ is offline   Reply With Quote
Old 14/06/2018, 11:20 PM   #2
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 767
Reputation: 137
Default Re: VCF - Vehicle Component Functions

Useful, but why did you upload an amx file in GitHub?
cuber is offline   Reply With Quote
Old 14/06/2018, 11:26 PM   #3
MBJ
Big Clucker
 
Join Date: Jul 2016
Posts: 196
Reputation: 72
Default Re: VCF - Vehicle Component Functions

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
__________________


MBJ is offline   Reply With Quote
Old 15/06/2018, 02:59 AM   #4
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,420
Reputation: 1240
Default Re: VCF - Vehicle Component Functions

Just going to point out it doesn't make sense to use "Alter" instead of "Set" that is rather confusing.
Pottus is offline   Reply With Quote
Old 15/06/2018, 11:27 AM   #5
Sasino97
High-roller
 
Sasino97's Avatar
 
Join Date: Dec 2010
Location: Italy
Posts: 1,440
Reputation: 106
Default Re: VCF - Vehicle Component Functions

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.
__________________
Desktop, Web, Mobile and Game Developer
  • SA-MP Game Modes and Filter Scripts (PAWN, SQL) (8 years experience)
  • Windows Applications (WPF, UWP)
  • Android Applications (Java Android SDK, Xamarin)
  • Web Design and Development (Wordpress, ASP.NET MVC, PHP, SQL)
  • Game Development (Unity3D, GameMaker Studio, LibGDX)
sasinosoft@gmail.com
I hope I don't get banned for using gmail, lol
Sasino97 is offline   Reply With Quote
Old 29/09/2018, 11:07 PM   #6
MBJ
Big Clucker
 
Join Date: Jul 2016
Posts: 196
Reputation: 72
Default Re: VCF - Vehicle Component Functions

@Updated
  • removed tags
  • renamed functions
  • add hook OnVehicleDamageStatusUpdate
__________________


MBJ is offline   Reply With Quote
Old 30/09/2018, 12:04 AM   #7
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,147
Reputation: 345
Default Re: VCF - Vehicle Component Functions

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
Attached Files
File Type: txt Thread.txt (1.3 KB, 8 views)
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link



Last edited by RogueDrifter; 30/09/2018 at 03:19 PM.
RogueDrifter is offline   Reply With Quote
Old 02/10/2018, 05:03 PM   #8
NoahF
Gangsta
 
NoahF's Avatar
 
Join Date: Jul 2012
Location: USA
Posts: 892
Reputation: 38
Default Re: VCF - Vehicle Component Functions

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] VCF - Vehicle Component Functions MBJ Lançamentos/Releases 9 24/06/2018 09:32 PM
Camera Pos for each vehicle component Chipardeur Scripting Help 2 01/03/2016 05:21 PM
Vehicle Component devil shill Scripting Help 1 08/08/2014 08:49 PM
Vehicle Component help. RayPoda Help Archive 6 22/06/2009 08:56 AM
Vehicle Component Prices Norn Help Archive 7 01/04/2009 12:37 PM


All times are GMT. The time now is 05:11 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.