07/23/2018 - First release
07/24/2018 - v1.1
- Fixed a log error with the pev().
- Changed the weapon fire function, and with it, the recoil is now avaliable.
- Changed the default value of the bullet speed.
- Removed the chatcolor include (not necessary)
07/27/2018 - v1.2
Code:
. Fixed the damage block (sometimes it wasn't blocking)
. Fixed the deathmsg message (it shows now the weapon icon).
. Changed the way to set sv_maxvelocity in the plugin, sometimes it wasn't setting the value.
Observation:
I figured out that when you catch the death of anyone, with Ham_Killed or DeathMsg, sometimes the weapon id is not passed, so, I recommend to use get_user_weapon() to get the killer's weapon ID.
Like:
1. DeathMsg
PHP Code:
register_event("DeathMsg", "event_DeathMsg", "a")
PHP Code:
public event_DeathMsg()
{
new iKiller = read_data(1), szWeapon[32]
get_weaponname(get_user_weapon(iKiller), szWeapon, charsmax(szWeapon))
log_amx("iKillerID: %d, iVictimID: %d, Killer's WeaponName: %s", iKiller, read_data(2), szWeapon[7])
}
Output:
Code:
iKillerID: 1, iVictimID: 6, Killer's WeaponName: ak47
2. Ham_Killed
PHP Code:
RegisterHam(Ham_Killed, "player", "ham_PlayerKilled")
PHP Code:
public ham_PlayerKilled(iVictim, iKiller, iShouldGib)
{
new szWeapon[32]
get_weaponname(get_user_weapon(iKiller), szWeapon, charsmax(szWeapon))
log_amx("iKillerID: %d, iVictimID: %d, Killer's WeaponName: %s", iKiller, read_data(2), szWeapon[7])
}
Output:
Code:
[bulletSpeed.amxx] iKillerID: 1, iVictimID: 28, Killer's WeaponName: ak47
So, both works. And I know that the player can throw a nade, change to AK47, kill the enemy with the HE, and it'll pass the weapon ID as AK47 (due the get_user_weapon() native), but, that barely happens. For now, it's the best way.
03/23/2019 - v1.3
. Fixed takedamage code.
. Added more FL_GODMODE and DAMAGE_NO support.
. Added a check to see if the victim is attacker's teammate and FFA is 1.
. Added new check to lose accuracy: AWP/Scout without the zoom.
. Changed distanceToGround() to FL_ONGROUND.
. Moved bleedPlayer() from forward_Touch to takeDamage().
. Optimized a little.
. Changed set_user_health() to Ham_TakeDamage.
. Fixed Shotgun damage.
12/16/2020 - v1.4
- The plugin is no longer depending of the cstrike include.
- Changed the default bullet gravity value to 0.33.
- Changed the accuracy when the user is not standing still (water, jumping, walking, etc..)
- Fixed the damage animation of the victim when it's being damaged through the wall.
- Was not needed to reduce each bullet damage by the number of shotguns fired, it was automatically being done using the Ham_TakeDamage forward.
- Fixed the system that checks where the bullet hit the enemy (either head or other parts of the body, such as stomach, chest or legs.) to calculate the damage.
12/25/2020 - v1.5
. Instead of trying to imitate the game's accuracy depending of the circumtances of the player, it now actually follows the game's accuracy itself, making the bullet go where the game tells it to go to. So now you can spray normally, like the bullet is actually the game's bullet.
. Added support for kevlar and helmets.
. Added bullet penetration system (it's still under modifications, but right now it already works as it should)
. Added support for bullet distance.
. The plugin now calculates the damage by itself, no matter other event of the game.
. Added bullet holes support.
. Added 'bullet whizz' sound.
. Added 'bullet crack' sound
. Changed some cvars default values so the bullet trail:
- slowbullet_speed (now it's a float) from 5000.0 to 6500.0
- slowbullet_sniperspeed (now it's a float) from 6000.0 to 10000.0
- slowbullet_trail_type from 1 to 0
- slowbullet_trail_color_intensity from 105 to 25
01/04/2021 - v1.6
. Added ricochet feature.
. Added support for each weapon, this can be edited in a .ini file
{
- Bullet velocity
- Bullet-drop
- Bullet base damage
- Max angle to ricochet
- Max penetration factor (how deep bullet can penetrate through entities)
}
. Added a feature that changes the bullet direction after a penetration.
. Increasement of blood effect after the bullet hit a player.
. Added smoke effect on bullet hit.
. Added a new way of penetrating:
{
- When a bullet is fired, some of them by default have a value to penetrate depending of the ammo penetration factor
which says that every 100 units of penetration, equals 1 penetration.
- After the min value of penetration is set, there's gonna be a check to see if the entity that the bullet
is going to to penetrate is more thick than the bullet max penetration factor (eg: 274u concrete wall vs 192 max penetration factor = it'll not penetrate).
- Also, there's a check to see if the texture of the entity that the bullet is going to penetrate is too dense (e.g metal and concrete), the-
ammo penetration factor is decresed 35% of it's default value.
- After every penetration, the ammo penetration factor decreases and the bullet travels slower than before with a specific calculation.
- After the new velocity calculation, there's gonna be a check to return how fast is the bullet.
- If the bullet is still fast enough to penetrate, it'll continue penetrating if the max penetration set is reached (I couldn't see the sense of making the bullet penetrate more than two times in the game because most of the maps doesn't have too many thin entities to penetrate them all, so I thought it was just a waste of time to make it avaliable anyway), if it reaches a velocity that is physically impossible to penetrate any longer-
or if the new ammo penetration factor set after the penetration is too thin to continue penetrating (e.g: bullet too weak/damaged).
}
01/15/2021 - v1.7
- Now the bullet does damage to entities as well.
- Now the breakable entities, such as glasses, only breaks when the new bullet actually hits it, intead of instantly.
- Now the AWP does not lose damage with distance.
- Now the AWP does not ricochet, it must penetrate in any way.
- Now the shotguns fires 7 bullets instead of 10.
- Now the crack sound is only avaliable when the bullet is too fast.
- Now the 'dense texture' check does not exist.
- Now the ricochet angle is multiplied in different types of textures. Metal entities have more chances to ricochet, whereas wood and tiles have lower. The rest are the same.
- Now some of the bullets of both M3 and XM104 penetrates, but only through entities close enough.
- Added support for 7.62 callibers (most powerful one btw). Now it keeps more velocity after penetration, same for new direction (starts changing after the first penetration).
- Added a min distance to start losing damage. Strong callibers starts losing at 70.0 meters, weak ones starts at 35.0, shotguns at 15.0 meters.
- Added
bullet_trail_life cvar to control the trail life.
- Added impact sounds on different types of textures (new sounds shall be added soon).
- Changed the units check for valid origins through bullet's travel. Now it depends on the bullet velocity.
- Changed some speed values.
- Changed the check to allow ricochets depending of the speed of the bullet.
- Fixed the m3 and xm1014 bullets directions.
- Fixed the m3 and xm1014 damage calculation.
- Fixed the check for touching other bullets.
- Fixed the invalid origin check troughout the bullet's travel.
02/11/2021 - v1.8
- Added support for water physic as well. When the user shoots inside the water, there's a velocity decreasement plus bullet rotation due the resistance of the water.
Also, the bullet loses the ability to penetrate, since it's messy rotation.
- Added a new variable to calculate the damage: bullet's speed. If it's too slow, the damage will be either decreased or no damage will be taken at all.
- Added support for non-listed weapons inside the .ini file.
- Added a cvar that manages whether the max penetration of each bullet is gonna be calculated from the
max penetration factor or just by the bullet speed itself (the bullet will continue penetrating until it's damaged enough to stop).
- Added 'rbullet_bullet_camera' cvar that makes the shooter see where the bullet is going trought it's view itself.
- Added a small angle to make the AWP ricochet.
- Added a code that makes the bullet instantly hit the end position if distance is less than or equal to 1000 units (I've seen blind battles between players that were too close. Now the bullet drop applies only after 1000 units).
- Added 'rbullet_allow_tradekills' cvar which controls trade kills, when two players shoot each other and both bullets hits each one, killing both.
- Added more sounds effects on different types of textures.
- Now the bullet rotates when it penetrate or ricochet as well, depending of the conditios of the bullet, the ammount changes.
- Now the ricochet speed calculation depends on the angle that the bullet ricocheted.
- Now the whizz sound is played by the bullet itself.
- Now the crack sound happens when the bullet passes close to the player instead of when hitting. Also, only rifles will make the crack effect.
- Fixed the penetrations with the AWP.
- Fixed some calculations.
- Fixed the
getEntityInTraceline() stock.
- Fixed penetration code for weapons that did not have penetration avaliable by the game itself.
- Fixed the invalid origin check for bullets outside the map.
- Fixed the whizz sound code.
- Fixed an issue with bullets hitting enemies even with the Shield on.
- Fixed the checks when the bullet ricochets.
- Fixed an issue with the bullet hitplace right at the ass getting called as head shot (was it an issue tho?).
- Fixed an issue with headshot hit while the enemy was crouched.
- Changed trail's cvars to the following:
rbullet_trail_type to 1
rbullet_trail_color_intensity to 15
rbullet_trail_color to 200000000 (red)
- Changed some bullet drop/gravity values so the bullets doesn't seems too hard to hit something.
07/02/2020 - v1.9
- Fixed lags when there's too many bullets flying around.
- Fixed the effect when the bullet penetrates an entity on
bTooClose checks.
- Fixed the bullet crack not being able to hear due the whizz sound overriding it.
- Changed the
iUnitsCheck to
0 when the bullet is allowed to ricochet.
It fixes the distance before the bullet ricochet, making it actually hit entities before ricocheting.
- Added
kRenderFxDistort new effect as default for the bullet, total of 3 effects.
- Now you cannot see the previous impact from enemies or neither yours (due client-side effects). The only effects is when the bullet actually hits an entity.
OBS: It was needed to recreate the animations and default weapon sounds for the previous impact remover.
PHP Code:
// Re-creates the default bullet decals effects created by the game
// so with it the plugin removes the pre-effects client-sided.
// Since it re-creates default sounds as well, maybe some users
// has their own plugin which manages firing effects by themselves
// so add // before it to remove this feature
#define RECREATE_DEFAULT_EFFECTS
v2.0 (FINAL VERSION) - 02/24/2022
Changes
- Changed the underwater physics a little.
- Changed the function that gets the bullet's end point,
EngFunc_TraceToss helped.
- Changed some values on bullet rotation feature after penetrations.
- Changed ricochet damage base constant.
- Changed the way that bullets penetrates through entities.
Now instead of checking X units ahead every time (which causes issues), the bullet has a think delay that only triggers penetration feature when the bullet is about to hit.
It makes bullet penetrations more accurate, even if the penetrations happens too fast.
- Changed speed calculation after penetrations. Bullets gets more slower than before.
- Changed speed calculation after ricochets. Bullets gets more slower than before.
- Changed speed values from some weapons, update
realistic_bullet.ini.
- Changed penetration factor from some weapons, update
realistic_bullet.ini.
- Changed angle of ricochet from some weapons, update
realistic_bullet.ini.
- Changed the angles values of ricochet, they are now more realistic. Update
realistic_bullet.ini.
- Changed
BULLET_MIN_SPEED to
3000.0 Units Per Second.
- Changed the Distance Equation to reduce the damage of the bullet.
- Changed the min speed constant values from some equations.
Fixes
- Fixed an issue with shield not being able to block bullets when they have penetrated an object.
- Fixed default sound precache issue on first precache attempt.
- Fixed the shield firing animation.
- Fixed shotguns bullet hit decals.
- Fixed an effect with bullets bouncing while underwater...
- Fixed the speed decrease when penetrating entities.
- Fixed bullet hit on players when penetrating entities (ty
EngFunc_TraceToss).
- Fixed FOV values when firing with snipers.
- Fixed issues with
rbullet_ffa cvar. When its 0 bullets will pass through teammates, opposite as when it is 1.
- Fixed issues with shotguns fire event. It was making only ONE bullet think and cancelling the rest ones.
- Fixed issues with bullets getting stuck inside the ground when ricocheting (rarely, but was happening).
- Fixed issues with bullet ricocheting after hitting the player's head (it started happening when I changed to 1.10 for some reason... weird).
- Fixed issues with the thickness checks in some weapons.
Features Added
- Now there is invisible option for the bullets,
rbullet_trail_type should be
3.
- Now there is only instant hit on players. Default hit on the map itself will still have the bullet drop feature.
- Now the bullet drop factor is based on bullet speed instead of globally checking it for 1000 units.
- Now there is not
rbullet_use_penetration_factor cvar. By default all bullets will keep penetrating until it loses power.
- Now there are just 2 new ricochet sounds, 10 in total.
- Now there are Bullet Snow Impact sounds, 5 in total.
- Now there are two cvars:
rbullet_allow_penetration and
rbullet_allow_ricochet. Helps to decrease large calculations that each feature has.
- Now you can see the default bullet path by the game using
rbullet_show_default_path. Also, the trail color with
rbullet_default_trail_color.
- Now the bullet direction goes down after each penetration.
- Now the bullets always bounce when too slow, unless it is the water or hits sky.
The speed of the bounce depends of the angle the bullet hit the wall/entity. Also, there's more bullet rotations after every bounce.
- Now too low speeds are no longer avaliable. Default minimum speed is controlled by
BULLET_MIN_SPEED, which is 3000.0 UPS.
- Now the shotguns does not penetrate anymore.
-------------------------------
There is some comments in the code if someone wants to understand easier.
I rest my case.