Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PERCENT = 0.50
- GoGoGarry = {}
- SeatDMG = {}
- function GoGoGarry.IsVehicle(enti)
- if enti then
- return type(enti.GetDriver)=="function"
- else
- return false
- end
- end
- local wep = FindMetaTable("Entity")
- // detour FireBullets
- if (wep._FireBBackup) then wep.FireBullets = wep._FireBBackup end
- wep.OldFireBullets = wep.FireBullets
- wep._FireBBackup = wep.FireBullets
- wep.FireBullets = function( self, bullet )
- // detour the callback function into the bullet
- local OldCallback = bullet.Callback
- bullet.Callback = function( attacker, tr, dmginfo )
- local ent = tr.Entity
- if IsValid(ent) and ent:GetClass() == "prop_vehicle_prisoner_pod" then
- local driver = ent:GetDriver()
- if IsValid(driver) then
- driver:TakeDamage( dmginfo:GetDamage()*PERCENT, attacker, nil )
- end
- end
- // calls the old callback, if any
- if OldCallback then
- OldCallback( attacker, tr, dmginfo )
- end
- end
- // call the old FireBullets function, passing the modified bullet
- self:OldFireBullets( bullet )
- end
- hook.Add("EntityTakeDamage","stdmg",function(tar,dinf)
- if not GoGoGarry.IsVehicle(tar) then return dinf end
- if dinf:IsExplosionDamage() then
- //print("HAAAA")
- dinf:ScaleDamage(0.7)
- dinf:SetAttacker(dinf:GetInflictor():CPPIGetOwner())
- if tar:GetDriver() then
- tar:GetDriver():TakeDamage( dinf:GetDamage(), dinf:GetInflictor():CPPIGetOwner() , dinf:GetInflictor() )
- end
- return dinf
- end
- end,1)
Advertisement
Add Comment
Please, Sign In to add comment