HR_Shaft

Gunner-is-Driver v1 for Phasor v2

Feb 18th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.73 KB | None | 0 0
  1. --[[ ###      Gunner-is-Driver v1    ###]]--
  2. --[[ ###  by H® Shaft for Phasor v2  ###]]--
  3.  
  4. -- edit --
  5. hog_limit = 10
  6.  
  7. -- don't edit --
  8. hogs = {}
  9. spawn_in_hog = {}
  10. compatible = {}
  11.  
  12. -- ---- will player spawn in a vehicle? ----------
  13. --              Map:                    enable t/f:
  14. spawn_in_hog.   bloodgulch      =       true
  15. spawn_in_hog.   dangercanyon    =       true
  16. spawn_in_hog.   deathisland     =       true
  17. spawn_in_hog.   gephyrophobia   =       true
  18. spawn_in_hog.   icefields       =       true
  19. spawn_in_hog.   infinity        =       true       
  20. spawn_in_hog.   sidewinder      =       true   
  21. spawn_in_hog.   timberland      =       true
  22. spawn_in_hog.   beavercreek     =       false -- battle creek      
  23. spawn_in_hog.   boardingaction  =       false              
  24. spawn_in_hog.   carousel        =       false -- derelict
  25. spawn_in_hog.   chillout        =       false              
  26. spawn_in_hog.   damnation       =       false                      
  27. spawn_in_hog.   hangemhigh      =       false                  
  28. spawn_in_hog.   longest         =       false              
  29. spawn_in_hog.   prisoner        =       false              
  30. spawn_in_hog.   putput          =       false -- chiron tl34
  31. spawn_in_hog.   ratrace         =       false                  
  32. spawn_in_hog.   wizard          =       false
  33.  
  34. -- ----- is map compatible with calling a hog? ---------
  35. --              Map:                    compatible t/f:
  36. compatible.     bloodgulch      =       true
  37. compatible.     dangercanyon    =       true
  38. compatible.     deathisland     =       true
  39. compatible.     gephyrophobia   =       true
  40. compatible.     icefields       =       true
  41. compatible.     infinity        =       true       
  42. compatible.     sidewinder      =       true   
  43. compatible.     timberland      =       true
  44. compatible.     beavercreek     =       false -- battle creek      
  45. compatible.     boardingaction  =       false              
  46. compatible.     carousel        =       false -- derelict
  47. compatible.     chillout        =       false              
  48. compatible.     damnation       =       false                      
  49. compatible.     hangemhigh      =       false                  
  50. compatible.     longest         =       false              
  51. compatible.     prisoner        =       false              
  52. compatible.     putput          =       false -- chiron tl34
  53. compatible.     ratrace         =       false                      
  54. compatible.     wizard          =       false
  55.  
  56. function GetRequiredVersion()
  57.     return 200
  58. end
  59.  
  60. function OnScriptLoad(process, game, persistent)
  61.     if game == true or game == "PC" then
  62.         GAME = "PC"
  63.         gametype_base = 0x671340
  64.         map_name = readstring(0x698F21)
  65.     else
  66.         GAME = "CE"
  67.         gametype_base = 0x5F5498
  68.         map_name = readstring(0x61D151)
  69.     end
  70.     for i=0,15 do
  71.         if getplayer(i) then
  72.             hogs[i] = 0
  73.         end
  74.     end
  75. end
  76.  
  77. function OnNewGame(map)
  78.     if GAME == "PC" then
  79.         gametype_base = 0x671340
  80.         map_name = readstring(0x698F21)
  81.     elseif GAME == "CE" then
  82.         gametype_base = 0x5F5498
  83.         map_name = readstring(0x61D151)
  84.     end
  85.     for i=0,15 do
  86.         if getplayer(i) then
  87.             hogs[i] = 0
  88.         end
  89.     end
  90.     if not spawn_in_hog[map_name] and not compatible[map_name] then
  91.         log_msg(4, map_name .. " is NOT compatible with Gunner-Driver script, Large Maps only!")
  92.         log_msg(1, map_name .. " is NOT compatible with Gunner-Driver script, Large Maps only!")       
  93.     end
  94.     if spawn_in_hog[map_name] and compatible[map_name] then
  95.         notice = registertimer(180000, "timednotice") -- 180000 = 3 mins
  96.     end    
  97. end
  98.  
  99. function OnPlayerJoin(player)
  100.     if getplayer(player) then
  101.         hogs[player] = 0
  102.     end
  103. end
  104.  
  105. function OnPlayerSpawnEnd(player, m_objectId)
  106.     if getplayer(player) then
  107.         if spawn_in_hog[map_name] and compatible[map_name] then
  108.             putinvehicle = registertimer(400, "PutInVehicle", player)
  109.         elseif not spawn_in_hog[map_name] and compatible[map_name] then
  110.             privatesay(player, "** Move away from small areas or bases, then")
  111.             privatesay(player, "** type HOG to get a vehicle.")
  112.             privatesay(player, "** Alejarse de las areas pequenas o edificio, entonces")
  113.             privatesay(player, "** escriba HOG conseguir un vehiculo.")    
  114.         end
  115.     end
  116. end
  117.  
  118. function PutInVehicle(is, count, player)
  119.     if getplayer(player) then
  120.         local m_player = getplayerobjectid(player)
  121.         local x,y,z = getobjectcoords(m_player)
  122.         if m_player then
  123.             m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.35)
  124.             entervehicle(player, m_vehicleId, 0)
  125.             entervehicle(player, m_vehicleId, 2)
  126.             privatesay(player, "** You are gunner AND driver.")
  127.             privatesay(player, "** Usted es el artillero Y conductor.")
  128.         end
  129.     end
  130.     return false   
  131. end        
  132.  
  133. function OnServerChat(player, type, message)
  134.     local response = nil
  135.    
  136.     if player then
  137.         name = getname(player)
  138.         hash = gethash(player)
  139.        
  140.         if string.lower(message) == "hog" then
  141.             local m_player = getplayer(player)
  142.             if m_player then
  143.                 if compatible[map_name] then
  144.                     if not isinvehicle(player) then
  145.                         local m_player = getplayerobjectid(player)
  146.                         if m_player then x,y,z = getobjectcoords(m_player) end
  147.                         if not hog_limit or hogs[player] < hog_limit then
  148.                             local player_obj_id = getplayerobjectid(player)
  149.                             local m_object = getobject(player_obj_id)
  150.                             if m_object then   
  151.                                 local m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.35)
  152.                                 entervehicle(player, m_vehicleId, 0)
  153.                                 entervehicle(player, m_vehicleId, 2)                                   
  154.                                 hogs[player] = hogs[player] + 1
  155.                                 privatesay(player, "** You are gunner AND driver.")
  156.                                 privatesay(player, "** Usted es el artillero Y conductor.")                            
  157.                                 sendconsoletext(player, "**Hogs** You have " .. hog_limit - hogs[player] .. " hog calls remaining.")
  158.                                 sendconsoletext(player, "**Hogs** Usted tiene " .. hog_limit - hogs[player] .. "  solicitudes de restantes.")
  159.                             end
  160.                         else
  161.                             sendconsoletext(player, "**Hogs** You have reached the max amount of hog calls for this game.")
  162.                             sendconsoletext(player, "**Hogs** Has alcanzado el numero maximo de solicitudes para este juego.")
  163.                         end
  164.                     else
  165.                         sendconsoletext(player, "**Hogs** You already have a vehicle, dumbass.")
  166.                         sendconsoletext(player, "**Hogs** Usted ya tiene un vehiculo, idiota.")
  167.                     end
  168.                 else
  169.                     sendconsoletext(player, "**Hogs** That feature has been disabled for this map.")
  170.                     sendconsoletext(player, "**Hogs** Esa funcion se ha desactivado para mapa.")
  171.                 end
  172.             response = false
  173.             end
  174.         end
  175.        
  176.        
  177.     end
  178.    
  179.     return response
  180. end
  181.  
  182. function timednotice(id, count)
  183.     for i=0,15 do
  184.         if getplayer(i) then
  185.             privatesay(i, "** No vehicle? No vehiculo?")   
  186.             privatesay(i, "** Move away from small areas or bases, then")
  187.             privatesay(i, "** type HOG to get a vehicle. You are gunner AND driver.")
  188.             privatesay(i, "** Alejarse de las areas pequenas o edificio, entonces")
  189.             privatesay(i, "** escriba HOG conseguir un vehiculo. Usted es el artillero Y conductor.")                      
  190.         end
  191.     end
  192.     return true
  193. end
  194.  
  195. function OnGameEnd(stage)
  196.     if stage == 1 then
  197.         if notice then
  198.             removetimer(notice)
  199.             notice = nil
  200.         end
  201.     end    
  202. end
  203.  
  204. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  205. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  206. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
Advertisement
Add Comment
Please, Sign In to add comment