Jump to content

Need help with votemanager[ SOLVED ]


Kenix

Recommended Posts

I just modified the resource votemanager.

If someone needs

This script changes the map on which all played just if everyone voted for Don't Change

this is tested.

open script votemanager_server.lua

Just find function applyPollResults and replace function with this :

  
function applyPollResults(chosenOption) 
    local optionTable = activePoll[chosenOption] 
    activePoll = nil 
  
    local result = triggerEvent("onPollEnd", thisResourceRoot, chosenOption) 
  
    if result == true then 
        outputVoteManager("Vote ended! ["..optionTable[1].."]",rootElement) 
         
        if string.find(optionTable[1],"Don't change") then 
            local gamemode = exports.mapmanager:getRunningGamemode( ) 
            local rGamemode = exports.mapmanager:getRunningGamemodeMap( ) 
            local complete = exports.mapmanager:isMapCompatibleWithGamemode( rGamemode, gamemode ) 
            if complete then 
                exports.mapmanager:changeGamemodeMap( rGamemode ) 
            end 
        end 
        local optionExecutorType = type(optionTable[2]) 
        if optionExecutorType == "function" then 
            optionTable[2](unpack(optionTable,3)) 
        elseif optionExecutorType == "string" then 
            triggerEvent(optionTable[2], optionTable[3] or rootElement, unpack(optionTable,4)) 
        end 
    end 
end 
  

qaisjp. Yes, I often find the problem and I do not know how to solve but after a while I know how to fix or refine it :D

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...