Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Block flag/ball holders from driving/gunning ###]]--
- --[[ ### for Phasor v2+ by H® Shaft ###]]--
- -- This script will prevent flag and ball holders from entering the driver or gunner seat of a vehicle (only passenger seats allowed)
- -- Standard Ball and Flag tag names:
- ball_tag = "weapons\\ball\\ball"
- flag_tag = "weapons\\flag\\flag"
- -- Enter custom tag names here (within quotes, see instructions)
- ball_tag2 = "weapons\\ball\\ball"
- flag_tag2 = "weapons\\ball\\ball"
- -- Blocked gunner or driver seat message (you can edit):
- blocked_message = "BLOCKED! Ball and Flag holders cannot gun or drive!"
- -- Instructions for retrieving the ball and flag tag names for unprotected custom maps:
- -- Ball and Flag tag names (above): You won't need to change this for all PC maps and MOST CE maps.
- -- However, you can customize the script so it works for your custom map.
- -- Load the script and map, grab the flag or oddball, then type "weapon" it will tell you the tag name on the screen
- -- then enter that tag name above. Example: The tag name for the ball returned would be: weapons\ball\ball
- -- then scripted above as: weapons\\ball\\ball, or - for the flag: weapons\\flag\\flag, etc. (add the additionional "\")
- -- don't edit below --
- game_started = false
- holders = {}
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- game_started = true
- holdingtimer = registertimer(0, "holding")
- for i = 0,15 do
- if getplayer(i) then
- holders[i] = false
- end
- end
- end
- function OnNewGame(map)
- game_started = true
- if not holdingtimer and game_started then
- holdingtimer = registertimer(0, "holding")
- end
- for i = 0,15 do
- if getplayer(i) then
- holders[i] = false
- end
- end
- end
- function OnPlayerJoin(player)
- if getplayer(player) then
- holders[player] = false
- end
- end
- function OnPlayerLeave(player)
- if getplayer(player) then
- holders[player] = false
- end
- end
- function OnPlayerKill(killer, victim, mode)
- if getplayer(victim) then
- holders[victim] = false
- end
- end
- function holding(id, count)
- for i = 0, 15 do
- if getplayer(i) then
- local m_objectId = getplayerobjectid(i)
- if m_objectId then
- local m_object = getobject(m_objectId)
- if m_object then
- local m_weaponId = readdword(m_object + 0x118)
- if m_weaponId then
- local m_weapon = getobject(m_weaponId)
- if m_weapon then
- local weapname = gettaginfo(readdword(m_weapon))
- if weapname == ball_tag or weapname == flag_tag or weapname == ball_tag2 or weapname == flag_tag2 then
- holders[i] = true
- else
- holders[i] = false
- end
- end
- end
- end
- end
- end
- end
- return true
- end
- function OnServerChat(player, type, message)
- local response = nil
- if player then
- --will tell you the tagname of the primary weapon you are holding if you are not in a vehicle
- if string.lower(message) == "weapon" and not isinvehicle(player) then
- response = true
- local m_objectId = getplayerobjectid(player)
- if m_objectId then
- local m_object = getobject(m_objectId)
- if m_object then
- local m_weaponId = readdword(m_object + 0x118)
- if m_weaponId then
- local m_weapon = getobject(m_weaponId)
- if m_weapon then
- local weapname = gettaginfo(readdword(m_weapon))
- privatesay(player, "Weapon tag name: " .. weapname)
- end
- end
- end
- end
- end
- end
- return response
- end
- function OnVehicleEntry(player, m_vehicleId, seat, mapId, relevant)
- local response = nil
- if getplayer(player) then
- if holders[player] then
- if seat ~= 1 then
- response = false
- privatesay(player, blocked_message)
- else
- response = true
- end
- end
- end
- return response
- end
- function OnGameEnd(stage)
- if stage == 1 then
- game_started = false
- if delayholding then
- delayholding = nil
- end
- if holdingtimer then
- holdingtimer = nil
- end
- if holding then
- holding = nil
- end
- end
- end
- --[[ Created by H® Shaft.
- Thanks to Oxide, AelitePrime, Nugget & Wizard.
- Visit http://halorace.org/forum/index.php?topic=514.0 or
- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts
- ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement