[0.3z] Unoccupied vehicle damage -
KingHual - 16.01.2014
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
pawn Код:
#define MINIGUN_DAMAGE_ENABLED false
and change it to
pawn Код:
#define MINIGUN_DAMAGE_ENABLED true
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:
- 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
- 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
Functions:
pawn Код:
CreateSyncVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, Float:health = 1000.0)
Creates a vehicle that can be destroyed unoccupied.
Returns: The ID of the vehicle created
pawn Код:
DestroySyncVehicle(vehicleid)
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
pawn Код:
SetSyncVehiclesOption(setting, value)
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
pawn Код:
GetSyncVehicleState(vehicleid)
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)
pawn Код:
IsVehicleSyncVehicle(vehicleid)
Checks if a vehicle was created using CreateSyncVehicle
Returns: 0 if the vehicle isn't a sync vehicle, 1 if it is
Callbacks:
pawn Код:
public OnUnoccupiedSyncVehicleDying(vehicleid)
Called when an unoccupied synced vehicle's engine is lit on fire (5 seconds before it explodes)
pawn Код:
public OnUnoccupiedSyncVehicleDeath(vehicleid)
Called when an unoccupied synced vehicle explodes
pawn Код:
public OnUnoccupiedSyncVehicleRespawn(vehicleid)
Called when an unoccupied synced vehicle
respawns
pawn Код:
public OnUnoccupiedSyncVehicleDamage(playerid, vehicleid, weaponid, Float:amount)
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!
Re: [0.3z] Unoccupied vehicle damage -
iZN - 16.01.2014
Good work King.
Re: [0.3z] Unoccupied vehicle damage -
kristo - 16.01.2014
I actually made the same thing a few hours ago. Very neat code.
Re: [0.3z] Unoccupied vehicle damage -
Danyal - 16.01.2014
Too Fast :P
Nice Work Man
Re: [0.3z] Unoccupied vehicle damage -
jakejohnsonusa - 16.01.2014
EDIT:
Nice work.
Took me a while to even find 0.3z... Kalcor posted it in the Scripting Help forum for some reason and it hasn't been added to the downloads page.
Re: [0.3z] Unoccupied vehicle damage -
Djole1337 - 16.01.2014
good job
))
Re: [0.3z] Unoccupied vehicle damage -
QuaTTrO - 16.01.2014
Quote:
Originally Posted by jakejohnsonusa
That awkward moment when there is no 0.3z version.
At least, none that have officially been released and named that...?
|
https://sampforum.blast.hk/showthread.php?tid=487997
Re: [0.3z] Unoccupied vehicle damage -
KingHual - 16.01.2014
Quote:
Originally Posted by jakejohnsonusa
That awkward moment when there is no 0.3z version.
At least, none that have officially been released and named that...?
|
https://sampforum.blast.hk/showthread.php?tid=487997
Re: [0.3z] Unoccupied vehicle damage -
Zamora - 16.01.2014
Good job..
Re: [0.3z] Unoccupied vehicle damage -
Swisher - 16.01.2014
C:\Users\odst2154\Downloads\test2\filterscripts\vd amage.pwn(2
: error 017: undefined symbol "BULLET_HIT_TYPE_VEHICLE"
1 error