Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Invisible Koth v1 ###]]--
- --[[ ### by H® Shaft ###]]--
- --[[ ### for Phasor v2 ###]]--
- -- if player is in the hill for 10 seconds or longer, they become invisible
- -- if player is in the hill they move at 50% normal speed
- -- if player is in the hill for 40 seconds, they are given a bonus overshield
- -- if player is in the hill and in a vehicle, they are ejected, cannot re-enter while in the hill
- -- if player is not in the hill they move at 150% normal speed
- inhill_time = {}
- map_reset_boolean = false
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(process, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- gametype_base = 0x671340
- koth_globals = 0x639BD0
- else
- GAME = "CE"
- gametype_base = 0x5F5498
- koth_globals = 0x5BDBF0
- end
- gametype = readbyte(gametype_base + 0x30)
- if kothtimer == nil then
- kothtimer = registertimer(1000, "KothTimer")
- end
- if giveortake == nil then
- giveortake = registertimer(1000, "GiveCamoNos")
- end
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- inhill_time[hash] = 0
- end
- end
- end
- function OnNewGame(map)
- if GAME == "PC" then
- gametype_base = 0x671340
- koth_globals = 0x639BD0
- elseif GAME == "CE" then
- gametype_base = 0x5F5498
- koth_globals = 0x5BDBF0
- end
- gametype = readbyte(gametype_base + 0x30)
- if map_reset_boolean == true then
- kothtimer = registertimer(1000, "KothTimer")
- giveortake = registertimer(1000, "GiveCamoNos")
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- inhill_time[hash] = 0
- end
- end
- end
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- inhill_time[hash] = 0
- end
- end
- end
- function OnGameEnd(stage)
- if stage == 1 then
- if kothtimer then
- removetimer(kothtimer)
- kothtimer = nil
- end
- if giveortake then
- removetimer(giveortake)
- giveortake = nil
- end
- end
- end
- function OnPlayerJoin(player)
- if getplayer(player) then
- local hash = gethash(player)
- inhill_time[hash] = 0
- end
- end
- function OnPlayerKill(killer, victim, mode)
- if getplayer(victim) then
- local hash = gethash(victim)
- inhill_time[hash] = 0
- end
- end
- function OnPlayerLeave(player)
- if getplayer(player) then
- local hash = gethash(player)
- inhill_time[hash] = nil
- end
- end
- function KothTimer(id, count)
- if map_reset_boolean == true then
- map_reset_boolean = false
- end
- for i = 0,15 do
- if getplayer(i) then
- local hash = gethash(i)
- local m_objectId = getplayerobjectid(i)
- if gametype == 4 then
- local m_objectId = getplayerobjectid(i)
- if m_objectId then
- local m_object = getobject(m_objectId)
- if PlayerInHill(i) and m_object then
- inhill_time[hash] = inhill_time[hash] + 1
- setspeed(i, 0.5)
- if isinvehicle(i) then exitvehicle(i) end
- elseif not PlayerInHill(i) and m_object then
- inhill_time[hash] = 0
- setspeed(i, 1.5)
- end
- end
- end
- end
- end
- return true
- end
- function PlayerInHill(player)
- player = tonumber(player)
- local bool = false
- local m_player = getplayer(player)
- if m_player then
- local InHill = readbyte(koth_globals + player + 0x80)
- if InHill == 1 then
- bool = true
- end
- end
- return bool
- end
- function GiveCamoNos(id, count)
- for x = 0,15 do
- if getplayer(x) then
- local hash = gethash(x)
- local m_player = getplayer(x)
- if m_player then
- local m_playerObjId = readdword(m_player + 0x34)
- local m_object = getobject(m_playerObjId)
- if m_object then
- -- apply camo at 10 sec +
- local camoFlag = readdword(m_object + 0x204)
- if camoFlag ~= 0x51 then
- if inhill_time[hash] >= 10 then
- applycamo(x, 10)
- end
- end
- -- apply os at 40 sec
- if inhill_time[hash] == 40 then
- if readfloat(m_object + 0xE4) <= 1 then
- local x,y,z = getobjectcoords(m_playerObjId)
- local ovs = createobject(gettagid("eqip", "powerups\\over shield"), 0, 0, false, x, y, z+0.5)
- if ovs ~= nil then writefloat(getobject(ovs) + 0x70, -2) end
- end
- end
- end
- end
- end
- end
- return true
- end
- function OnObjectCreationAttempt(mapId, parentId, player)
- if mapId == gettagid("eqip", "powerups\\active camouflage") then
- return gettagid("eqip", "powerups\\over shield")
- end
- return nil
- end
- function OnVehicleEntry(player, m_vehicleId, seat, mapId, relevant)
- if getplayer(player) then
- if PlayerInHill(player) then
- return false
- else
- return true
- end
- end
- return nil
- end
- function OnServerCommand(player, command)
- local allow = nil
- local cmd = tokenizecmdstring(command)
- local tokencount = #cmd
- if tokencount > 0 then
- if cmd[1] == "sv_map_reset" or cmd[1] == "sv_script_reload" then
- map_reset_boolean = true
- end
- end
- return allow
- end
- -- Created by H® Shaft thank you 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