Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ ### Rock-The-Vote ###]]--
- --[[ ### by H® Shaft ###]]--
- --[[ ### for Phasor v2 ###]]--
- --[[ ### version 3.4 ###]]--
- -- don't edit --
- cur_players = 0
- rtv_table = {}
- rtv_timeout = 1
- rtv_initiated = 0
- rock_the_vote = {}
- rtv_required = {}
- -- Toggle Rock the Vote on = True, Off = False
- --map true/false
- rock_the_vote. beavercreek = true -- battle creek
- rock_the_vote. bloodgulch = true
- rock_the_vote. boardingaction = true
- rock_the_vote. carousel = true -- derelict
- rock_the_vote. chillout = true
- rock_the_vote. damnation = true
- rock_the_vote. dangercanyon = true
- rock_the_vote. deathisland = true
- rock_the_vote. gephyrophobia = true
- rock_the_vote. hangemhigh = true
- rock_the_vote. icefields = true
- rock_the_vote. infinity = true
- rock_the_vote. longest = true
- rock_the_vote. prisoner = true
- rock_the_vote. putput = true -- chiron tl34
- rock_the_vote. ratrace = true
- rock_the_vote. sidewinder = true
- rock_the_vote. timberland = true
- rock_the_vote. wizard = true
- -- Set Map Specific Voting Requirements, expressed in decimal max = 1, min = 0.1 - % of players or more will allow skipping the current map
- -- (higher for your favorite map ,lower for less popular maps)
- --map % Required
- rtv_required. beavercreek = 0.6 -- battle creek
- rtv_required. bloodgulch = 0.75
- rtv_required. boardingaction = 0.6
- rtv_required. carousel = 0.6 -- derelict
- rtv_required. chillout = 0.6
- rtv_required. damnation = 0.6
- rtv_required. dangercanyon = 0.75
- rtv_required. deathisland = 0.6
- rtv_required. gephyrophobia = 0.75
- rtv_required. hangemhigh = 0.75
- rtv_required. icefields = 0.75
- rtv_required. infinity = 0.5
- rtv_required. longest = 0.6
- rtv_required. prisoner = 0.6
- rtv_required. putput = 0.6 -- chiron tl34
- rtv_required. ratrace = 0.6
- rtv_required. sidewinder = 0.75
- rtv_required. timberland = 0.75
- rtv_required. wizard = 0.6
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(processId, game, persistent)
- if game == true or game == "PC" then
- GAME = "PC"
- map_name = readstring(0x698F21)
- network_base = 0x745BA8
- cur_players = readword(network_base, 0x1A0)
- else
- GAME = "CE"
- map_name = readstring(0x61D151)
- network_base = 0x6C7988
- cur_players = readword(network_base, 0x1A0)
- end
- rtv_initiated = 0
- rtv_table = {}
- rock_the_vote = {}
- end
- function OnNewGame(map)
- if GAME == "PC" then
- map_name = readstring(0x698F21)
- network_base = 0x745BA8
- cur_players = readword(network_base, 0x1A0)
- elseif GAME == "CE" then
- map_name = readstring(0x61D151)
- network_base = 0x6C7988
- cur_players = readword(network_base, 0x1A0)
- end
- rtv_initiated = 0
- rtv_table = {}
- rock_the_vote = {}
- end
- function OnGameEnd(stage)
- if stage == 1 then
- if rtvtimer then
- removetimer(rtvtimer)
- rtvtimer = nil
- end
- rtv_initiated = -1
- end
- end
- function OnPlayerJoin(player)
- cur_players = cur_players + 1
- end
- function OnPlayerLeave(player)
- cur_players = cur_players - 1
- end
- function OnServerChat(player, type, message)
- if player then
- name = getname(player)
- hash = gethash(player)
- end
- local t = tokenizestring(message, " ")
- local count = #t
- if t[1] == nil then
- return true
- end
- if t[1] == "rtv" then
- if count == 1 and rock_the_vote[map_name] then
- if rtv_initiated >= 0 then
- local rtv_count = 0
- local rtv_number = round(cur_players * rtv_required[map_name], 0)
- for i = 0,15 do
- if getplayer(i) then
- if rtv_table[gethash(i)] == 1 then
- rtv_count = rtv_count + 1
- end
- end
- end
- if rtv_count == 0 then
- rtv_initiated = 1
- rtv_table[hash] = 1
- rtv_count = rtv_count + 1
- say(name .. " has initiated Rock-The-Vote (rtv) to skip this map!")
- say("Type \"rtv\" to join the vote to skip this map.")
- rtvtimer = registertimer(120000, "rtvTimer")
- else
- if rtv_table[hash] == 1 then
- privatesay(player, "You have already voted for Rock-The-Vote.")
- elseif rtv_table[hash] == nil then
- rtv_table[hash] = 1
- rtv_count = rtv_count + 1
- say(name .. " has voted for Rock-The-Vote")
- say(rtv_count .. " of " .. rtv_number .. " votes required for Rock-The-Vote")
- end
- end
- if rtv_count >= rtv_number then
- removetimer(rtvtimer)
- rtvtimer = nil
- rtv_initiated = rtv_timeout
- say("Enough votes for Rock-The-Vote, skipping to next map.")
- svcmd("sv_map_next")
- end
- else
- privatesay(player, "You cannot initiate Rock-The-Vote at this time")
- end
- return false
- elseif count == 1 and not rock_the_vote[map_name] then
- privatesay(player, "Rock-The-Vote is disabled for this map.")
- return false
- end
- end
- return nil
- end
- function rtvTimer(id, count)
- if count == 1 then
- rtv_initiated = rtv_timeout
- rtv_table = {}
- say("The current rtv has expired!")
- return false
- else
- return true
- end
- end
- function round(num)
- under = math.floor(num)
- upper = math.floor(num) + 1
- underV = -(under - num)
- upperV = upper - num
- if (upperV > underV) then
- return under
- else
- return upper
- end
- end
- -- Script originated from Wizard and AelitePrime - extracted and adapted as a stand alone feature by H® Shaft
- -- 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