N-SlipknoT Posted November 15, 2015 Share Posted November 15, 2015 Hola, queria saber como hacer para que el vote redo no me quite el next map al dar el redo, me explico, si el vr gana el mapa que hay comprado se quita porque el vote redo lo ha reemplazado para dar el redo. No se si me hice entender :3 Bueno esta es la funcion: English: Hello, I wanted to know how to make the boat do not remove redo the next map to give the redo, I mean, if the vr wins the map there are purchased is removed because the redo vote has replaced to give the redo. If I did not understand: 3: $ Well this is the function: Clancolor = '#1883e9' function getPlayersCount() players = {} for k,v in ipairs(getElementsByType('player')) do table.insert(players,v) end return #players end addEvent('onMapStarting',true) addEventHandler('onMapStarting',root, function() for k,v in ipairs(getElementsByType('player')) do if getElementData(v,'voted') == true then setElementData(v,'voted',false) end end voteredo = { players = math.ceil(getPlayersCount()/2), vr = 0, redo = false, mapname = getMapName(exports.mapmanager:getRunningGamemodeMap()) } end ) function Voteredo(plr) if voteredo then if isRestarted() == false then if voteredo.redo ~= true then if getElementData(plr,'voted') ~= true then if voteredo.vr+1 < voteredo.players then voteredo.vr = voteredo.vr+1 setElementData(plr,'voted',true) outputChatBox(Clancolor..'[VOTEREDO] '..getPlayerNametagText(plr)..'#FFFFFF has voted for redo. '..Clancolor..'[#FFFFFF'..voteredo.vr..''..Clancolor..'/#FFFFFF'..voteredo.players..''..Clancolor..']',root,255,255,255,true) else voteredo.vr = voteredo.vr+1 voteredo.redo = true outputChatBox(Clancolor..'[VOTEREDO] '..getPlayerNametagText(plr)..'#FFFFFF has voted for redo. '..Clancolor..'[#FFFFFF'..voteredo.vr..''..Clancolor..'/#FFFFFF'..voteredo.players..''..Clancolor..']',root,255,255,255,true) end else outputChatBox(Clancolor..'[VOTEREDO] #FFFFFFYou already voted for redo.',plr,255,255,255,true) end else outputChatBox(Clancolor..'[VOTEREDO] #FFFFFFThe vote is completed, the map will be restarted.',plr,255,255,255,true) end else outputChatBox(Clancolor..'[VOTEREDO] #FFFFFFThis map has already been restarted.',plr,255,255,255,true) end else outputChatBox(Clancolor..'[VOTEREDO] #FFFFFFError, try again in the next map.',plr,255,255,255,true) end end addCommandHandler('vr',Voteredo) addEvent('onPostFinish',true) addEventHandler('onPostFinish',root, function () if voteredo then if voteredo.redo == true then local currentMap = exports.mapmanager:getRunningGamemodeMap() setTimer ( function () exports.mapmanager:changeGamemodeMap (currentMap, nil, true) lastmaprestarted = getMapName(exports.mapmanager:getRunningGamemodeMap()) outputChatBox(Clancolor..'[VOTEREDO] #FFFFFFMap restarted by vote.',plr,255,255,255,true) end, 4500, 1) end end end ) function isRestarted() if lastmaprestarted and voteredo.mapname then if lastmaprestarted == voteredo.mapname then return true else return false end else return false end end function getMapName( map ) return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" end Link to comment
Recommended Posts