Jump to content

vote setting


boro

Recommended Posts

Hi all i make vote system for my gamemode and i set vote but i don't know how to set nomination to 0 for this vote is this setting good for set nomination to 0 ?

    local poll = { 
        title="Vote for the next map:", 
        visibleTo=getRootElement(), 
        percentage=51, 
        timeout=15, 
        nomination=0, 
        allowchange=true; 
        } 

here is full script

function startNextMapVote() 
    local g_Root = getRootElement() 
    exports.votemanager:stopPoll() 
  
    local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource()) 
     
     
    if #compatibleMaps > 8 then 
        math.randomseed(getTickCount()) 
        repeat 
            table.remove(compatibleMaps, math.random(1, #compatibleMaps)) 
        until #compatibleMaps == 8 
    elseif #compatibleMaps < 2 then 
        return false 
    end 
  
    -- mix up the list order 
    for i,map in ipairs(compatibleMaps) do 
        local swapWith = math.random(1, #compatibleMaps) 
        local temp = compatibleMaps[i] 
        compatibleMaps[i] = compatibleMaps[swapWith] 
        compatibleMaps[swapWith] = temp 
    end 
     
    local poll = { 
        title="Vote for the next map:", 
        visibleTo=getRootElement(), 
        percentage=51, 
        timeout=14, 
        nomination=0, 
        allowchange=true; 
        } 
     
    for index, map in ipairs(compatibleMaps) do 
        local mapName = getResourceInfo(map, "name") or getResourceName(map) 
        table.insert(poll, {mapName, 'nextMapVoteResult', getRootElement(), map}) 
    end 
     
    local currentMap = exports.mapmanager:getRunningGamemodeMap() 
    if currentMap and not (mapaSeHrala == 0) then 
        table.insert(poll, {"Play again", 'nextMapVoteResult', getRootElement(), currentMap}) 
    end 
  
    -- Allow addons to modify the poll 
    g_Poll = poll 
    triggerEvent('onPollStarting', g_Root, poll ) 
    poll = g_Poll 
    g_Poll = nil 
  
    local pollDidStart = exports.votemanager:startPoll(poll) 
  
    if pollDidStart then 
        --gotoState('NextMapVote') 
        --addEventHandler("onPollEnd", getRootElement(), chooseRandomMap) 
    end 
  
    return pollDidStart 
end 
  
  
  
addEvent('nextMapVoteResult') 
addEventHandler('nextMapVoteResult', getRootElement(), 
    function( map ) 
            if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then 
                return 
            end 
    end 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...