16.01.2014, 19:36
(
Последний раз редактировалось KingHual; 28.01.2014 в 20:33.
Причина: Update to v3
)
Version 3, which takes care of sync issues and adds API support, is now released! (take a look at the Downloads section)
What is this?
So, you know how you can't damage a vehicle unless there's a driver inside it? Say goodbye to that, as this simple filterscript takes advantage of the functions introduced in 0.3z to enable unoccupied vehicle damage!
Limitations
You currently cannot damage vehicles by using weapons that do not fire bullets (melee weapons, explosive weapons etc.)
Setup
Version 1 & 2:
The script is plug-and-play. Minigun damage is disabled by default. If you do not want to be able to deal damage to unoccupied vehicles using the minigun, just skip to the downloads section below and add the script to your filterscripts list.
If you DO want to enable minigun damage, you need to manually compile the source code:
1. Download the source code from the GitHub link below.
2. Open the file in your favourite editor
3. Locate the line
and change it to
4. Save and compile the script using the PAWN compiler
Version 3:
As version 3 adds an API, you need to create the special type of vehicles yourself. Here's how:
Documentation
Definitions:
Functions:
Creates a vehicle that can be destroyed unoccupied.
Returns: The ID of the vehicle created
Destroys a vehicle created using CreateSyncVehicle.
Returns: 0 if the vehicle doesn't exist/is a normal vehicle, 1 if the vehicle has successfully been destroyed
Sets script options, where the setting parameter is one of the SV_ definitions (see above).
Returns: 0 if the option doesn't exist, 1 if the option has been set
Gets a sync vehicle's current state, the VEHICLE_STATE_ definitions (see above)
Returns: A sync vehicle's current state, the VEHICLE_STATE_ definitions (see above)
Checks if a vehicle was created using CreateSyncVehicle
Returns: 0 if the vehicle isn't a sync vehicle, 1 if it is
Callbacks:
Called when an unoccupied synced vehicle's engine is lit on fire (5 seconds before it explodes)
Called when an unoccupied synced vehicle explodes
Called when an unoccupied synced vehicle respawns
Called when a player damages an unoccupied synced vehicle
Downloads
Source code:
v2
v3
API include:
v3
Compiled binaries: Attached to post
Big thanks to Djole1337 who helped gather damage data, and to FUNExtreme for helping me fix the sync issues!
Oh, and absolutely NO thanks whatsoever to [jS]Thomas!
What is this?
So, you know how you can't damage a vehicle unless there's a driver inside it? Say goodbye to that, as this simple filterscript takes advantage of the functions introduced in 0.3z to enable unoccupied vehicle damage!
Limitations
You currently cannot damage vehicles by using weapons that do not fire bullets (melee weapons, explosive weapons etc.)
Setup
Version 1 & 2:
The script is plug-and-play. Minigun damage is disabled by default. If you do not want to be able to deal damage to unoccupied vehicles using the minigun, just skip to the downloads section below and add the script to your filterscripts list.
If you DO want to enable minigun damage, you need to manually compile the source code:
1. Download the source code from the GitHub link below.
2. Open the file in your favourite editor
3. Locate the line
pawn Код:
#define MINIGUN_DAMAGE_ENABLED false
pawn Код:
#define MINIGUN_DAMAGE_ENABLED true
Version 3:
As version 3 adds an API, you need to create the special type of vehicles yourself. Here's how:
- Download the v3 filterscript (see the Downloads section below)
- Place it in your filterscripts folder, and add it to your server.cfg filterscripts line
- Download the v3 API include (.inc file)
- Place it inside your /pawno/include/ folder
- Include it in your other scripts using pawn Код:#include <uvdmg>
- Now, just add whatever vehicles you'd like (see the documentation below for a function list) and compile your script.
Documentation
Definitions:
pawn Код:
VEHICLE_STATE_INACTIVE
VEHICLE_STATE_SPAWNED
VEHICLE_STATE_DYING
SV_MINIGUN_ENABLED
SV_RESPAWN_VEHICLES
pawn Код:
CreateSyncVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, Float:health = 1000.0)
Returns: The ID of the vehicle created
pawn Код:
DestroySyncVehicle(vehicleid)
Returns: 0 if the vehicle doesn't exist/is a normal vehicle, 1 if the vehicle has successfully been destroyed
pawn Код:
SetSyncVehiclesOption(setting, value)
Returns: 0 if the option doesn't exist, 1 if the option has been set
pawn Код:
GetSyncVehicleState(vehicleid)
Returns: A sync vehicle's current state, the VEHICLE_STATE_ definitions (see above)
pawn Код:
IsVehicleSyncVehicle(vehicleid)
Returns: 0 if the vehicle isn't a sync vehicle, 1 if it is
Callbacks:
pawn Код:
public OnUnoccupiedSyncVehicleDying(vehicleid)
pawn Код:
public OnUnoccupiedSyncVehicleDeath(vehicleid)
pawn Код:
public OnUnoccupiedSyncVehicleRespawn(vehicleid)
pawn Код:
public OnUnoccupiedSyncVehicleDamage(playerid, vehicleid, weaponid, Float:amount)
Downloads
Source code:
v2
v3
API include:
v3
Compiled binaries: Attached to post
Big thanks to Djole1337 who helped gather damage data, and to FUNExtreme for helping me fix the sync issues!
Oh, and absolutely NO thanks whatsoever to [jS]Thomas!