Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Gunner-is-Driver v2 ###]]--
- --[[ ### by H® Shaft for Phasor v2 ###]]--
- -- edit --
- hog_limit = 15
- -- don't edit --
- hogs = {}
- spawn_in_hog = {}
- compatible = {}
- game_started = false
- -- ---- will player spawn in a vehicle? ----------
- -- Map: enable t/f:
- spawn_in_hog. bloodgulch = true
- spawn_in_hog. dangercanyon = true
- spawn_in_hog. deathisland = true
- spawn_in_hog. gephyrophobia = true
- spawn_in_hog. icefields = true
- spawn_in_hog. infinity = true
- spawn_in_hog. sidewinder = true
- spawn_in_hog. timberland = true
- spawn_in_hog. beavercreek = false -- battle creek
- spawn_in_hog. boardingaction = false
- spawn_in_hog. carousel = false -- derelict
- spawn_in_hog. chillout = false
- spawn_in_hog. damnation = false
- spawn_in_hog. hangemhigh = false
- spawn_in_hog. longest = false
- spawn_in_hog. prisoner = false
- spawn_in_hog. putput = false -- chiron tl34
- spawn_in_hog. ratrace = false
- spawn_in_hog. wizard = false
- -- ----- is map compatible with calling a hog? ---------
- -- Map: compatible t/f:
- compatible. bloodgulch = true
- compatible. dangercanyon = true
- compatible. deathisland = true
- compatible. gephyrophobia = true
- compatible. icefields = true
- compatible. infinity = true
- compatible. sidewinder = true
- compatible. timberland = true
- compatible. beavercreek = false -- battle creek
- compatible. boardingaction = false
- compatible. carousel = false -- derelict
- compatible. chillout = false
- compatible. damnation = false
- compatible. hangemhigh = false
- compatible. longest = false
- compatible. prisoner = false
- compatible. putput = false -- chiron tl34
- compatible. ratrace = false
- compatible. wizard = false
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- gametype_base = 0x671340
- map_name = readstring(0x698F21)
- else
- GAME = "CE"
- gametype_base = 0x5F5498
- map_name = readstring(0x61D151)
- end
- for i=0,15 do
- if getplayer(i) then
- hogs[i] = 0
- end
- end
- end
- function OnNewGame(map)
- if GAME == "PC" then
- gametype_base = 0x671340
- map_name = readstring(0x698F21)
- elseif GAME == "CE" then
- gametype_base = 0x5F5498
- map_name = readstring(0x61D151)
- end
- for i=0,15 do
- if getplayer(i) then
- hogs[i] = 0
- end
- end
- if not spawn_in_hog[map_name] and not compatible[map_name] then
- log_msg(4, map_name .. " is NOT compatible with Gunner-Driver script, Large Maps only!")
- log_msg(1, map_name .. " is NOT compatible with Gunner-Driver script, Large Maps only!")
- end
- if spawn_in_hog[map_name] and compatible[map_name] then
- notice = registertimer(180000, "timednotice") -- 180000 = 3 mins
- end
- game_started = true
- end
- function OnPlayerJoin(player)
- if getplayer(player) then
- hogs[player] = 0
- end
- end
- function OnPlayerSpawnEnd(player, m_objectId)
- if getplayer(player) then
- if spawn_in_hog[map_name] and compatible[map_name] and game_started then
- putinvehicle = registertimer(400, "PutInVehicle", player)
- elseif not spawn_in_hog[map_name] and compatible[map_name] then
- privatesay(player, "** Move away from small areas or bases, then")
- privatesay(player, "** type HOG to get a vehicle.")
- end
- end
- end
- function PutInVehicle(is, count, player)
- if getplayer(player) and game_started then
- local m_player = getplayerobjectid(player)
- local x,y,z = getobjectcoords(m_player)
- if m_player then
- m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.35)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- privatesay(player, "** You are gunner AND driver.")
- end
- end
- return false
- end
- function OnServerChat(player, type, message)
- local response = nil
- if player then
- if string.lower(message) == "hog" then
- local m_player = getplayer(player)
- if m_player then
- local response = false
- if game_started then
- if compatible[map_name] then
- if not isinvehicle(player) then
- local x,y,z = getobjectcoords(m_player)
- local m_player = getplayerobjectid(player)
- if not hog_limit or hogs[player] < hog_limit then
- if m_player then
- local m_vehicleId = createobject(gettagid("vehi", "vehicles\\rwarthog\\rwarthog"), 0, 1, false, x,y,z+0.35)
- entervehicle(player, m_vehicleId, 0)
- entervehicle(player, m_vehicleId, 2)
- hogs[player] = hogs[player] + 1
- privatesay(player, "** You are gunner AND driver.")
- sendconsoletext(player, "**Hogs** You have " .. hog_limit - hogs[player] .. " hog calls remaining.")
- else
- sendconsoletext(player, "**Derp** You cannot spawn a vehicle while dead.")
- end
- else
- sendconsoletext(player, "**Hogs** You have reached the max amount of hog calls for this game.")
- end
- else
- sendconsoletext(player, "**Derp** You already have a vehicle.")
- end
- else
- sendconsoletext(player, "**Hogs** That feature has been disabled for this map.")
- end
- else
- sendconsoletext(player, "**Derp** You cannot spawn a hog after the game has ended.")
- end
- end
- return response
- end
- end
- return response
- end
- function timednotice(id, count)
- for i=0,15 do
- if getplayer(i) then
- privatesay(i, "** No vehicle?")
- privatesay(i, "** Move away from small areas or bases, then")
- privatesay(i, "** type HOG to get a vehicle. You are gunner AND driver.")
- end
- end
- return true
- end
- function OnGameEnd(stage)
- if stage == 1 then
- game_started = false
- if notice then
- notice = nil
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement