Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Config
- -- 0.00 = 0%, 0.50 = 50%, 1.00 = 100%, 2.00 = 200%, etc.
- RIDER_DAMAGE = 0.20
- -- Any damage less than this threshold will have its value changed to RIDER_DAMAGE
- RIDER_DAMAGE_THRESHOLD = 0.04
- -- Usual values are between 0 and 1 (where 0 blocks no damage and 1 blocks all damage)
- -- If value is nil, no changes will be made
- VEHICLE_PASSTHROUGH_PENALTY = {
- ["none"] = nil,
- ["falling"] = nil,
- ["bullet"] = 0,
- ["grenade"] = nil,
- ["high_explosive"] = nil,
- ["sniper"] = 0,
- ["melee"] = nil,
- ["flame"] = 0,
- ["mounted_weapon"] = nil,
- ["vehicle"] = nil,
- ["plasma"] = 0,
- ["needle"] = 0,
- ["shotgun"] = 0,
- }
- -- End of Config
- api_version = "1.9.0.0"
- categories = {
- [0] = "none",
- [1] = "falling",
- [2] = "bullet",
- [3] = "grenade",
- [4] = "high_explosive",
- [5] = "sniper",
- [6] = "melee",
- [7] = "flame",
- [8] = "mounted_weapon",
- [9] = "vehicle",
- [10] = "plasma",
- [11] = "needle",
- [12] = "shotgun"
- }
- function OnScriptLoad()
- register_callback(cb['EVENT_GAME_START'], "OnGameStart")
- end
- function OnGameStart()
- local tags_count = read_dword(0x4044000C)
- local tags_array = read_dword(0x40440000)
- for i=0,tags_count-1 do
- local tag_class = read_dword(tags_array + i*32 + 0x0)
- if(tag_class == 0x6A707421) then -- checks if tag is damage_effect
- local damage_data = read_dword(tags_array + i*32 + 0x14)
- local damage_category = read_word(damage_data + 0x1C6)
- local damage_penalty = VEHICLE_PASSTHROUGH_PENALTY[categories[damage_category]]
- if(damage_penalty ~= nil) then
- write_float(damage_data + 0x1DC, damage_penalty)
- end
- elseif(tag_class == 0x76656869) then -- checks if tag is vehicle
- local vehicle_data = read_dword(tags_array + i*32 + 0x14)
- local rider_damage_fraction = round(read_float(vehicle_data + 0x184))
- if(rider_damage_fraction < RIDER_DAMAGE_THRESHOLD) then
- write_float(vehicle_data + 0x184, RIDER_DAMAGE)
- end
- end
- end
- end
- function round(float)
- local multiple = 10^6
- return math.floor(float * multiple + 0.5) / multiple
- end
- function OnScriptUnload() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement