SA-MP Forums Archive
[Include] WinDoSi.inc (Vehicle Windows/Doors/Siren Control) - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] WinDoSi.inc (Vehicle Windows/Doors/Siren Control) (/showthread.php?tid=585392)



WinDoSi.inc (Vehicle Windows/Doors/Siren Control) - valych - 13.08.2015

Description

This include will ease the control of vehicle's doors, windows and siren states. There is nothing special, just new definitions of different states, new functions to open/close vehicle's door/window, new functions to install/remove vehicle's siren... (for more details see Functions section), which are easier to use.

Features Definitions

Code:
#define WDS_MAX_VEHICLE_DOORS 4 // Amount of doors (Just to avoid using literals)
Doors:
Code:
#define FL_DOOR 	0 // Front Left (Driver's door)
#define FR_DOOR 	1 // Front Right (Passenger's door)
#define BL_DOOR 	2 // Back Left
#define BR_DOOR 	3 // Back Right
Door's states:
Code:
#define WDS_DOOR_STATE_OPENED		1 // Opened state
#define WDS_DOOR_STATE_CLOSED		0 // Closed state
#define WDS_DOOR_STATE_NOT_SET	   -1 // Not set
Window's states:
Code:
#define WDS_WINDOW_STATE_OPENED		0 // Opened state
#define WDS_WINDOW_STATE_CLOSED		1 // Closed state
#define WDS_WINDOW_STATE_NOT_SET   -1 // Not set
Siren's states:
Code:
#define WDS_SIREN_STATE_ON 				 1 // On 
#define WDS_SIREN_STATE_OFF				 0 // Off
#define WDS_SIREN_STATE_NOT_INSTALLED 	-1 //  Not installed - means, that the siren was not set in AddStaticVehicleEx/CreateVehicle functions (parameter addsiren = 0).
Functions: Bugs
GetVehicleDoorState, IsVehicleDoorOpened, IsVehicleDoorClosed are not working properly. Despite the fact that the door is opened or closed, always returns -1. I guess there is a problem with GetVehicleParamsCarDoors/SetVehicleParamsCarDoors (didn't confirmed).

Installation
Put windosi.inc to your pawn/include/ folder. Then, wherever you want to use this include, write #include <windosi> at the top of your script (after #include <a_samp>) and then compile it.

Download links
GitHub
Pastebin
Examples (GitHub)

Please, let me know about grammar or any other mistakes I've done in this thread and documentation.


Re : WinDoSi.inc (Vehicle Windows/Doors/Siren Control) - Dutheil - 13.08.2015

Quote:
Originally Posted by valych
View Post
Bugs
GetVehicleDoorState, IsVehicleDoorOpened, IsVehicleDoorClosed are not working properly. Despite the fact that the door is opened or closed, always returns -1. I guess there is a problem with GetVehicleParamsCarDoors/SetVehicleParamsCarDoors (didn't confirmed).
https://sampforum.blast.hk/showthread.php?tid=571441