Advertisement
Combreal

AntiVehicleCamp

Jan 28th, 2014
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.34 KB | None | 0 0
  1. -- Anti vehicles Camp - inspired from Eliteprime, Wizard, Shaft and Bugs's works --
  2.                         -- Whith the great help of A§H»Wizard --
  3.  
  4. playerRunoverCounter = {}
  5. playerGbCounter = {}
  6. playerBbCounter = {}
  7. playerTbCounter = {}
  8. playerBfCounter = {}
  9. playerTsCounter = {}
  10.  
  11. playerIsHit = {}
  12. playerIsHita = {}
  13. playerIsHitb = {}
  14. playerIsHitc = {}
  15. playerIsHitd = {}
  16. playerIsHite = {}
  17.  
  18. survivesro = 3  -- The player will die twice before surviving by runovers
  19. survivesgb = 5  -- The player will die four times before surviving by ghost bolts
  20. survivesbb = 5  -- The player will die four times before surviving by banshee bolts
  21. survivestb = 5  -- The player will die four times before surviving by tank bullets
  22. survivesbf = 3  -- The player will die twice before surviving by banshee fuel rod
  23. survivests = 3  -- The player will die twice before surviving by tank shell
  24.  
  25. function GetRequiredVersion()
  26.     return 200
  27. end
  28.  
  29.  
  30. function OnScriptLoad(processid, game, persistent)end
  31.  
  32. function OnNewGame(map)
  33.         -- Vehicles
  34.     banshee_tag_id = gettagid("vehi", "vehicles\\banshee\\banshee_mp")
  35.     turret_tag_id = gettagid("vehi", "vehicles\\c gun turret\\c gun turret_mp")
  36.     ghost_tag_id = gettagid("vehi", "vehicles\\ghost\\ghost_mp")
  37.     rwarthog_tag_id = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  38.     tank_tag_id = gettagid("vehi", "vehicles\\scorpion\\scorpion_mp")
  39.     warthog_tag_id = gettagid("vehi", "vehicles\\warthog\\mp_warthog")
  40.  
  41.         -- Weapons
  42.     assaultrifle_tag_id = gettagid("weap", "weapons\\assault rifle\\assault rifle")
  43.     oddball_tag_id = gettagid("weap", "weapons\\ball\\ball")
  44.     flag_tag_id = gettagid("flag", "weap", "weapons\\flag\\flag")
  45.     flamethrower_tag_id = gettagid("weap", "weapons\\flamethrower\\flamethrower")
  46.     needler_tag_id = gettagid("weap", "weapons\\needler\\mp_needler")
  47.     pistol_tag_id = gettagid("weap", "weapons\\pistol\\pistol")
  48.     plasmapistol_tag_id = gettagid("weap", "weapons\\plasma pistol\\plasma pistol")
  49.     plasmarifle_tag_id = gettagid("weap", "weapons\\plasma rifle\\plasma rifle")
  50.     plasmacannon_tag_id = gettagid("weap", "weapons\\plasma_cannon\\plasma_cannon")
  51.     rocketlauncher_tag_id = gettagid("weap", "weapons\\rocket launcher\\rocket launcher")
  52.     shotgun_tag_id = gettagid("weap", "weapons\\shotgun\\shotgun")
  53.     sniper_tag_id = gettagid("weap", "weapons\\sniper rifle\\sniper rifle")
  54.  
  55.         -- Projectiles
  56.     bansheebolt_tag_id = gettagid("proj", "vehicles\\banshee\\banshee bolt")
  57.     bansheeblast_tag_id = gettagid("proj", "vehicles\\banshee\\mp_banshee fuel rod")
  58.     turretfire_tag_id = gettagid("proj", "vehicles\\c gun turret\\mp gun turret")
  59.     ghostbolt_tag_id = gettagid("proj", "vehicles\\ghost\\ghost bolt")
  60.     tankshot_tag_id = gettagid("proj", "vehicles\\scorpion\\bullet")
  61.     tankblast_tag_id = gettagid("proj", "vehicles\\scorpion\\shell shock wave")
  62.     warthogshot_tag_id = gettagid("proj", "vehicles\\warthog\\bullet")
  63.     rifleshot_tag_id = gettagid("proj", "weapons\\assault rifle\\bullet")
  64.     flame_tag_id = gettagid("proj", "weapons\\flamethrower\\flame")
  65.     needlerfire_tag_id = gettagid("proj", "weapons\\needler\\mp_needle")
  66.     pistolshot_tag_id = gettagid("proj", "weapons\\pistol\\bullet")
  67.     plasmapistolbolt_tag_id = gettagid("proj", "weapons\\plasma pistol\\bolt")
  68.     plasmariflebolt_tag_id = gettagid("proj", "weapons\\plasma rifle\\bolt")
  69.     plasmarifleblast_tag_id = gettagid("proj", "weapons\\plasma rifle\\charged bolt")
  70.     rocket_tag_id = gettagid("proj", "weapons\\rocket launcher\\rocket")
  71.     shotgunshot_tag_id = gettagid("proj", "weapons\\shotgun\\pellet")
  72.     snipershot_tag_id = gettagid("proj", "weapons\\sniper rifle\\sniper bullet")
  73.         -- Globals
  74.     global_distanceId = gettagid("jpt!", "globals\\distance")
  75.     global_fallingId = gettagid("jpt!", "globals\\falling")
  76.     global_vehiCollId = gettagid("jpt!", "globals\\vehicle_collision")
  77. end
  78.  
  79. function OnDamageLookup(receiving, causing, mapId, tagdata)
  80.     if causing and receiving then
  81.         local c_player = objectidtoplayer(causing)
  82.         local r_player = objectidtoplayer(receiving)
  83.         if c_player and r_player and isinvehicle(c_player) then
  84.             if not isinvehicle(r_player) then
  85.                 local mapId == global_vehiCollId then
  86.                     if not playerIsHit[r_player] then
  87.                         if not playerRunoverCounter[r_player] then playerRunoverCounter[r_player] = 0 end
  88.                         playerRunoverCounter[r_player] = playerRunoverCounter[r_player] + 1
  89.                         if playerRunoverCounter[r_player] >= survivesro then
  90.                             return false
  91.                         else
  92.                             playerIsHit[r_player] = true
  93.                             registertimer(1000, "Alrdycrashed", r_player)
  94.                         end
  95.                     end
  96.                 elseif dmg == ghostbolt_tag_id then
  97.                     if not playerIsHita[r_player] then
  98.                         if not playerGbCounter[r_player] then playerGbCounter[r_player] = 0 end
  99.                         playerGb[r_player] = playerGbCounter[r_player] + 1
  100.                         if playerGb[r_player] >= survivesgb then
  101.                             return false
  102.                         else
  103.                             playerIsHita[r_player] = true
  104.                             registertimer(1000, "Alrdyghostbolted", r_player)
  105.                         end
  106.                     end
  107.                 elseif dmg == bansheebolt_tag_id then
  108.                     if not playerIsHitb[r_player] then
  109.                         if not playerBbCounter[r_player] then playerBbCounter[r_player] = 0 end
  110.                         playerBbCounter[r_player] = playerBbCounter[r_player] + 1
  111.                         if playerBbCounter[r_player] >= survivesbb then
  112.                             return false
  113.                         else
  114.                             playerIsHitb[r_player] = true
  115.                             registertimer(1000, "Alrdybansheebolted", r_player)
  116.                         end
  117.                     end
  118.                 elseif dmg == tankshot_tag_id then
  119.                     if not playerIsHitc[r_player] then
  120.                         if not playerTbCounter[r_player] then playerTbCounter[r_player] = 0 end
  121.                         playerTbCounter[r_player] = playerTbCounter[r_player] + 1
  122.                         if playerTbCounter[r_player] >= survivestb then
  123.                             return false
  124.                         else
  125.                             playerIsHitc[r_player] = true
  126.                             registertimer(1000, "Alrdytankbulleted", r_player)
  127.                         end
  128.                     end
  129.                 elseif dmg == bansheeblast_tag_id then
  130.                     if not playerIsHitd[r_player] then
  131.                         if not playerBfCounter[r_player] then playerBfCounter[r_player] = 0 end
  132.                         playerBfCounter[r_player] = playerBfCounter[r_player] + 1
  133.                         if playerBfCounter[r_player] >= survivesbf then
  134.                             return false
  135.                         else
  136.                             playerIsHitd[r_player] = true
  137.                             registertimer(1000, "Alrdybansheefueled", r_player)
  138.                         end
  139.                     end
  140.                 elseif dmg == bansheeblast_tag_idthen
  141.                     if not playerIsHite[r_player] then
  142.                         if not playerTsCounter[r_player] then playerTsCounter[r_player] = 0 end
  143.                         playerTsCounter[r_player] = playerTsCounter[r_player] + 1
  144.                         if playerTsCounter[r_player] >= survivests then
  145.                             return false
  146.                         else
  147.                             playerIsHite[r_player] = true
  148.                             registertimer(1000, "Alrdytankshelled", r_player)
  149.                         end
  150.                     end
  151.                 end
  152.             end
  153.         end
  154.     end
  155.     return true
  156. end
  157.  
  158. function getplayervehicleid(player)
  159.     local m_objectId = getplayerobjectid(player)
  160.     if m_objectId then return readdword(getobject(m_objectId) + 0x11C) end
  161. end
  162.  
  163.  
  164. function Alrdycrashed(id, count, player)
  165.     playerIsHit[player] = nil
  166.     return false
  167. end
  168.  
  169. function Alrdyghostbolted(id, count, player)
  170.     playerIsHita[player] = nil
  171.     return false
  172. end
  173.  
  174. function Alrdybansheebolted(id, count, player)
  175.     playerIsHitb[player] = nil
  176.     return false
  177. end
  178.  
  179. function Alrdytankbulleted(id, count, player)
  180.     playerIsHitc[player] = nil
  181.     return false
  182. end
  183.  
  184. function Alrdybansheefueled(id, count, player)
  185.     playerIsHitd[player] = nil
  186.     return false
  187. end
  188.  
  189. function Alrdytankshelled(id, count, player)
  190.     playerIsHite[player] = nil
  191.     return false
  192. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement