Advertisement
th3w1zard1

VehiColl Fixed

Jan 22nd, 2014 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- For vehicle collision off -inspired Eliteprime, wizard, shaft and bugs's works --
  2.  
  3. --vehicle_dmgmodifier = 0.1
  4. playerRunoverCounter = {}
  5. playerIsHit = {}
  6.  
  7. function GetRequiredVersion()
  8.     return 200
  9. end
  10.  
  11.  
  12. function OnScriptLoad(processid, game, persistent) end
  13.  
  14. function OnDamageLookup(receiving, causing, mapId, tagdata)
  15.     if causing then
  16.         local c_player = objectidtoplayer(causing)
  17.         if c_player and isinvehicle(c_player) then
  18.             local m_vehicleId = getplayervehicleid(c_player)
  19.             if m_vehicleId then
  20.                 local m_vehicle = getobject(m_vehicleId)
  21.                 local driver = readdword(m_vehicle + 0x324)
  22.                 if driver == causing then
  23.                     if not playerIsHit[c_player] then
  24.                         if not playerRunoverCounter[c_player] then playerRunoverCounter[c_player] = 0 end
  25.                         playerRunoverCounter[c_player] = playerRunoverCounter[c_player] + 1
  26.                         local name = tostring(getname(c_player))
  27.                         say("Player " .. name .. " has been ran over " .. tostring(playerRunoverCounter[c_player]) .. " times!")
  28.                         if playerRunoverCounter[c_player] == 5 then
  29.                             say("Player " .. name .. " has been ran over 5 times and will now die!")
  30.                             return true
  31.                         else
  32.                             playerIsHit[c_player] = true
  33.                             registertimer(1000, "Alrdycrashed", c_player)
  34.                             return false
  35.                         end
  36.                     end
  37.                        
  38.                 end
  39.             end
  40.         end
  41.     end
  42. end
  43.  
  44. function getplayervehicleid(player)
  45.     local m_objectId = getplayerobjectid(player)
  46.     if m_objectId then return readdword(getobject(m_objectId) + 0x11C) end
  47. end
  48.  
  49.  
  50. function Alrdycrashed(id, count, player)
  51.     playerIsHit[player] = nil
  52.     return false
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement