-
Notifications
You must be signed in to change notification settings - Fork 10
Alarms
- Alarms are a safety device. It's the device which gives us audio, visual or some other type of signal to alert o us. It referrs to a problem or condition that needs urgent intervention. Vehicle alarms are the ones which triggers when one want to hijack a car, steal it or damages car drastically. In SA:MP, alarms are modified by
SetVehicleParamsEx
.
- There are functions in SA:MP which allows you to change alarm states. It's as mentioned above, modified by
SetVehicleParamsEx
. The function is used to modify all values of all vehicle parts, like bonnet, objective, alarms, boot etc... Therefore, you need to take into account you are going to need all those values gotten before you can modify. The values from all vehicle params. Let's take a look how it looks. We'll take a closer look into an example from SA:MP/open.mp wikipedia.
// If setting a single parameter, you should obtain the current parameters so they aren't ALL changed
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, VEHICLE_PARAMS_ON, doors, bonnet, boot, objective); // ONLY the lights param was changed to VEHICLE_PARAMS_ON (1)
With vehicle-framework, this becomes a lot easier, as framework finishes all this work for you.
- Like we've just learnt. Framework finishes all of the work for you. Also, it uses tags.
A tag is a prefix to a variable which tells the compiler to treat the variable specially under certain circumstances.
The tags are different, thus, they can't be used with different function. They are
E_ALARMS_OFF = 0,
E_ALARMS_ON
The tags' names are pretty self-explanatory. You got the point just by reading them, ones turn alarm on, the other turn its off. Take a closer look.
new e_ALARMS_STATE: alarm;
alarm = Vehicle_GetAlarmState(vehicleid);
Easy, huh? Look how we have to use tagged variables to get light damage statuses. Don't mix it with non-tagged.
The function's first argument, Vehicle_SetAlarmState
, is tagged with VEHICLE_FRAMEWORK_TAGS
, so it accepts either groupid or vehicleid.
new VehicleGroup: vehicleGroup;
Vehicle_SetAlarmState(vehicleGroup, E_ALARM_ON);
Getting functions can only use vehicleid.
This library has been made to ease use of vehicle functions provided by SA:MP. I've spent most of my free time to develop a library that everyone can use. This is also the biggest library I've ever made. Therefore, if you find any bugs, feel free to request a pull or report me.
-
Functions
- Engines
- Lights
- Alarms
-
Doors
- Vehicle_SetDoorState
- Vehicle_GetDoorState
- Vehicle_GetDoorsLockState
- Vehicle_SetDoorsLockState
- Tires
- Vehicle_SetTireState
- Vehicle_GetTireState
- Plates
- Vehicle_GetNumberPlate
- Vehicle_SetNumberPlate
- Windows
- Vehicle_SetWindows
- Vehicle_GetWindows
- Panels
- Vehicle_SetPanelStates
- Vehicle_GetPanelStates
- Vehicle_SetBumperStates
- Vehicle_GetBumperStates
- Vehicle_GetWindshieldState