LUA 182
V2+ Rocket-Hog Whores 1.0 By xdedeone on 26th February 2019 04:43:15 PM
  1. --[[ ###  Rocket-Hog Whores v1 ###]]--
  2. --[[ ###         by H® Shaft             ###]]--
  3. --[[ ###    for Phasor v2     ###]]--
  4.  
  5. -- spawns players in Rocket-hogs, (should not be used on indoor maps)
  6. -- should be used for large maps with outdoor player spawns
  7. -- player spawned vehicles respawn in 15 seconds after exit
  8. -- players can type 'hog', or 'HOG' to spawn a new vehicle
  9.  
  10. -- optional: choose to have gametype spawned vehicles replaced by rocket-hogs, see below 'replace_vehicles'
  11. -- optional: choose to spawn players in vehicles (should be used only in large maps with outdoor player spawns)
  12.  
  13. -- edit --
  14. replace_vehicles = true                 -- change to true if you want all gametype spawned vehicles replaced by rocket-hogs
  15. spawn_in_vehicle = true         -- change to true if you want players to spawn in vehicles
  16. show_welcome_message = true             -- joining players are welcomed if this is set to true
  17.  
  18. -- don't edit --
  19. map_ids = {}
  20. game_started = false
  21.  
  22. function GetRequiredVersion()
  23.         return 200
  24. end
  25.  
  26. function OnScriptLoad(process, game, persistent)
  27.         if game == "PC" then
  28.                 map_name = readstring(0x698F21)
  29.         else
  30.                 map_name = readstring(0x61D151)
  31.         end
  32.         LoadTags()
  33.         GAME = game
  34. end
  35.  
  36. function OnNewGame(map)
  37.         if GAME == "PC" then
  38.                 map_name = readstring(0x698F21)
  39.         else
  40.                 map_name = readstring(0x61D151)
  41.         end
  42.         LoadTags()
  43.         game_started = true
  44. end
  45.  
  46. function OnPlayerJoin(player)
  47.         if getplayer(player) then
  48.                 if show_welcome_message then
  49.                         registertimer(5000, "timedwelcome", player)
  50.                 end
  51.         end    
  52. end
  53.  
  54. function timedwelcome(id, count, player)
  55.         if count == 1 then
  56.                 if getplayer(player) then
  57.                         privatesay(player, "Welcome to Rocket-hog Whores: to spawn a hog, type HOG")
  58.                 end    
  59.         end    
  60.         return false   
  61. end
  62.  
  63. function OnPlayerSpawnEnd(player, m_objectId)
  64.         local m_player = getplayerobjectid(player)
  65.         if m_player then
  66.                 if spawn_in_vehicle and game_started then
  67.                         putinvehicle = registertimer(300, "PutPlayerInVehicle", player)
  68.                 end    
  69.         end
  70. end
  71.  
  72. function PutPlayerInVehicle(id, count, player)
  73.         if count == 1 and game_started then
  74.                 local m_player = getplayerobjectid(player)
  75.                 local x,y,z = getobjectcoords(m_player)
  76.                 if map_ids[map_name] then
  77.                         if m_player then
  78.                                 local m_vehicleId = createobject(map_ids[map_name], 0, 15, false, x,y,z+0.4)
  79.                                 entervehicle(player, m_vehicleId, 0)
  80.                         end    
  81.                 end
  82.         end    
  83.         return false   
  84. end    
  85.  
  86. function OnServerChat(player, type, message)
  87.         local response = nil
  88.         if player then
  89.                 if string.lower(message) == "hog" then
  90.                         local response = false
  91.                         local m_player = getplayerobjectid(player)
  92.                         if game_started then
  93.                                 if m_player then
  94.                                         if not isinvehicle(player) then
  95.                                                 local x,y,z = getobjectcoords(m_player)
  96.                                                 if map_ids[map_name] then
  97.                                                         local m_vehicleId = createobject(map_ids[map_name], 0, 15, false, x,y,z+0.4)
  98.                                                         entervehicle(player, m_vehicleId, 0)
  99.                                                 end
  100.                                         else
  101.                                                 sendconsoletext(player, "**Derp** You already have a vehicle.")
  102.                                         end
  103.                                 else
  104.                                         sendconsoletext(player, "**Derp** You cannot spawn a vehicle while dead.")
  105.                                 end
  106.                         else
  107.                                 sendconsoletext(player, "**Derp** You cannot spawn a hog after the game has ended.")
  108.                         end    
  109.                         return response
  110.                 end
  111.         end
  112.         return response
  113. end    
  114.  
  115. function LoadTags()
  116.         map_ids["beavercreek"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  117.         map_ids["bloodgulch"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  118.         map_ids["boardingaction"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  119.         map_ids["carousel"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  120.         map_ids["chillout"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  121.         map_ids["damnation"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  122.         map_ids["dangercanyon"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  123.         map_ids["deathisland"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  124.         map_ids["gephyrophobia"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  125.         map_ids["hangemhigh"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  126.         map_ids["icefields"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  127.         map_ids["infinity"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  128.         map_ids["longest"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  129.         map_ids["prisoner"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  130.         map_ids["putput"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  131.         map_ids["ratrace"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  132.         map_ids["sidewinder"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  133.         map_ids["timberland"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  134.         map_ids["wizard"] = gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  135. end    
  136.  
  137. function OnObjectCreationAttempt(mapId, parentId, player)
  138.         if replace_vehicles then
  139.                 if mapId == gettagid("vehi", "vehicles\\warthog\\mp_warthog") then
  140.                         return gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  141.                 end
  142.                 if mapId == gettagid("vehi", "vehicles\\banshee\\banshee_mp") then
  143.                         return gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  144.                 end
  145.                 if mapId == gettagid("vehi", "vehicles\\ghost\\ghost_mp") then
  146.                         return gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  147.                 end
  148.                 if mapId == gettagid("vehi", "vehicles\\c gun turret\\c gun turret_mp") then
  149.                         return gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  150.                 end
  151.                 if mapId == gettagid("vehi", "vehicles\\scorpion\\scorpion_mp") then
  152.                         return gettagid("vehi", "vehicles\\rwarthog\\rwarthog")
  153.                 end            
  154.         end    
  155. end    
  156.  
  157. function OnGameEnd(stage)
  158.         if stage == 1 then
  159.                 game_started = false
  160.                 if putinvehicle then
  161.                         putinvehicle = nil
  162.                 end
  163.         end    
  164. end
  165.  
  166. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  167. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  168. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.