13.08.2015, 12:52
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
Doors:
Door's states:
Window's states:
Siren's states:
Functions:
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.
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
- Opening/closing vehicle's doors with one line
- Opening/closing vehicle's windows with one line
- Getting state of windows/doors with one line
- Installing/removing siren from a vehicle at ANY TIME with one line
Code:
#define WDS_MAX_VEHICLE_DOORS 4 // Amount of doors (Just to avoid using literals)
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
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
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
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).
- SetVehicleWindowState(vehicleid, door, newstate) - sets a new vehicle's window state
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors)
* newstate - new state of vehicle's window (see Definitions -> Window states) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- SetVehicleDoorState(vehicleid, door, newstate) - sets a new vehicle's door state
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors)
* newstate - new state of vehicle window (see Definitions -> Door states) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- SetVehicleSirenState(vehicleid, newstate) - sets a new vehicle's siren state.
Note: it can be used only to install/uninstall siren. There is no possibility to turn siren on/off yet.- Parameters:
* vehicleid - vehicle's ID
* newstate - new state for the siren (see Definitions -> Siren states) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- GetVehicleWindowState(vehicleid, door) - gets a current state of vehicle's window
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns current state of the window (see Definitions -> Window states)
- Parameters:
- OpenVehicleDoor(vehicleid, door) - opens a vehicle's door
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- CloseVehicleDoor(vehicleid, door) - closes a vehicle's door
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- IsVehicleDoorOpened(vehicleid, door) - checks, whether a door is opened or not
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns true, if opened, otherwise false.
- Parameters:
- IsVehicleDoorClosed(vehicleid, door) - checks, whether a door is closed or not
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns true, if closed, otherwise false.
- Parameters:
- OpenVehicleWindow(vehicleid, door) - opens a vehicle's window
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- OpenVehicleWindow(vehicleid, door) - opens a vehicle's window
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns 1, if succeeded, otherwise 0.
- Parameters:
- IsVehicleWindowOpened(vehicleid, door) - checks, whether a window is opened or not
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns true, if opened, otherwise false.
- Parameters:
- IsVehicleWindowClosed(vehicleid, door) - checks, whether a window is closed or not
- Parameters:
* vehicleid - vehicle's ID
* door - vehicle's door ID (see Definitions -> Doors) - Returns true, if closed, otherwise false.
- Parameters:
- InstallVehicleSiren(vehicleid) - intalles a siren on a vehicle
- Parameters:
* vehicleid - vehicle's ID - Returns 1, if succeeded, otherwise 0.
- Parameters:
- UninstallVehicleSiren(vehicleid) - removes a siren from a vehicle
- Parameters:
* vehicleid - vehicle's ID - Returns 1, if succeeded, otherwise 0.
- Parameters:
- GetVehicleSirenState(vehicleid) - gets a current state of vehicle's siren
- Parameters:
* vehicleid - vehicle's ID - Returns current state of the siren (see Definitions -> Siren states)
- Parameters:
- IsVehicleSirenOn(vehicleid) - checks, whether a siren is on or not
- Parameters:
* vehicleid - vehicle's ID - Returns true, if turned on, otherwise false.
- Parameters:
- IsVehicleSirenOff(vehicleid) - checks, whether a siren is off or not
- Parameters:
* vehicleid - vehicle's ID - Returns true, if turned off, otherwise false.
- Parameters:
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.