Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Gunner-is-Driver v3 Randomized ###]]--
- --[[ ### by H® Shaft for Phasor v2 ###]]--
- -- This version: Rocket hogs and Chain hogs selected randomly
- -- Best for Race gametypes on Bloodgulch, Sidewinder and Deathisland (large outside maps, players spawn outside)
- -- riders will not automatically eject if they roll upside down
- -- players will be put into a hog as gunner-driver automatically on spawn or ejecting from a hog
- -- In the event that players aren't put into a hog automatically, they can type 'hog' to get one
- -- If players get stuck anywhere on the map, they can type "kill me" or "suicide" to re-spawn
- -- Combine with my other script: 'Leap frog v5' (Makes the hog leap/jump when you press the brake) to increase player enjoyment:
- -- Leap frog v5: http://pastebin.com/gJXFnJnE
- -- don't edit --
- game_started = false
- notice = nil
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- devmode_patch1 = 0x4A4DBF
- devmode_patch2 = 0x4A4E7F
- else
- GAME = "CE"
- devmode_patch1 = 0x47DF0C
- devmode_patch2 = 0x47DFBC
- end
- writeword(devmode_patch1, 0x9090)
- writeword(devmode_patch2, 0x9090)
- if not game_started then game_started = true end
- if notice == nil then
- notice = registertimer(180000, "timednotice") -- every 3 minutes
- end
- end
- function OnNewGame(map)
- if GAME == "PC" then
- devmode_patch1 = 0x4A4DBF
- devmode_patch2 = 0x4A4E7F
- elseif GAME == "CE" then
- devmode_patch1 = 0x47DF0C
- devmode_patch2 = 0x47DFBC
- end
- writeword(devmode_patch1, 0x9090)
- writeword(devmode_patch2, 0x9090)
- if not game_started then game_started = true end
- if notice == nil then
- notice = registertimer(180000, "timednotice") -- every 3 minutes
- end
- end
- function OnPlayerJoin(player)
- if getplayer(player) then
- privatesay(player, "You are both gunner and driver!")
- privatesay(player, "If you get stuck anywhere type \"kill me\" to re-spawn yourself.")
- privatesay(player, "If you aren't automatically put into a hog, type \"hog\" to get a new one.")
- end
- end
- function timednotice(id, count)
- if game_started then
- for i=0,15 do
- if getplayer(i) then
- privatesay(i, "You are both gunner and driver!")
- privatesay(i, "If you get stuck anywhere type \"kill me\" to re-spawn yourself.")
- privatesay(i, "If you aren't automatically put into a hog, type \"hog\" to get a new one.")
- end
- end
- end
- return true
- end
- function OnPlayerSpawnEnd(player, m_objectId)
- if getplayer(player) then
- if game_started then
- putinvehicle = registertimer(400, "PutInVehicle", player)
- end
- end
- end
- function OnVehicleEject(player, relevant)
- if getplayer(player) and game_started then
- putinvehicle = registertimer(1200, "PutInVehicle", player) -- 1200ms gives previous hog time to be destroyed/disappear
- end
- end
- function PutInVehicle(id, count, player)
- if getplayer(player) and game_started then
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local m_object = getobject(m_objectId)
- local x,y,z = getobjectcoords(m_objectId)
- if m_object and not isinvehicle(player) then
- local randomize = getrandomnumber(1, 11)
- if randomize >= 5 then
- m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.45)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- svcmd("set rider_ejection false")
- else
- m_vehicleId = createobject(gettagid("vehi", "vehicles\\warthog\\mp_warthog"), 0, 1, false, x,y,z+0.45)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- svcmd("set rider_ejection false")
- end
- end
- end
- end
- return false
- end
- function OnServerChat(player, type, message)
- local response = nil
- if player then
- if string.lower(message) == "hog" then
- response = false
- if game_started then
- if not isinvehicle(player) then
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local x,y,z = getobjectcoords(m_objectId)
- local m_object = getobject(m_objectId)
- if m_object then
- local randomize = getrandomnumber(1, 11)
- if randomize >= 5 then
- m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.45)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- svcmd("set rider_ejection false")
- else
- m_vehicleId = createobject(gettagid("vehi", "vehicles\\warthog\\mp_warthog"), 0, 1, false, x,y,z+0.45)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- svcmd("set rider_ejection false")
- end
- else
- sendconsoletext(player, "**Derp** You cannot spawn a vehicle while dead.")
- end
- end
- else
- sendconsoletext(player, "**Derp** You already have a vehicle.")
- end
- else
- sendconsoletext(player, "**Derp** You cannot spawn a hog after the game has ended.")
- end
- end
- if string.lower(message) == "killme" or string.lower(message) == "kill me" or string.lower(message) == "suicide" then
- response = false
- if game_started then
- kill(player)
- end
- end
- end
- return response
- end
- function OnGameEnd(stage)
- game_started = false
- if stage == 1 then
- if putinvehicle then
- putinvehicle = nil
- end
- if notice then
- notice = nil
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement