Jump to content

Jordy#

Members
  • Posts

    5
  • Joined

  • Last visited

Details

  • Gang
    WTF//
  • Location
    Netherlands
  • Occupation
    DM Player

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Jordy#'s Achievements

Vic

Vic (3/54)

0

Reputation

  1. Thanks man It works now
  2. -- racemidvote_server.lua -- -- Mid-race random map vote and -- NextMapVote handled in this file -- local lastVoteStarterName = '' local lastVoteStarterCount = 0 ---------------------------------------------------------------------------- -- displayHilariarseMessage -- -- Comedy gold ---------------------------------------------------------------------------- function displayHilariarseMessage( player ) if not player then lastVoteStarterName = '' else local playerName = getPlayerName(player) local msg = '' if playerName == lastVoteStarterName then lastVoteStarterCount = lastVoteStarterCount + 1 if lastVoteStarterCount == 5 then msg = playerName .. ' started a vote. Hardly a suprise.' elseif lastVoteStarterCount == 10 then msg = 'Guess what! '..playerName .. ' started ANOTHER vote!' elseif lastVoteStarterCount < 5 then msg = playerName .. ' started another vote.' else msg = playerName .. ' continues to abuse the vote system.' end else lastVoteStarterCount = 0 lastVoteStarterName = playerName msg = playerName .. ' started a vote.' end outputRace( msg ) end end ---------------------------------------------------------------------------- -- displayKillerPunchLine -- -- Sewing kits available in the foyer ---------------------------------------------------------------------------- function displayKillerPunchLine( player ) if lastVoteStarterName ~= '' then outputRace( 'Offical news: Everybody hates ' .. lastVoteStarterName ) end end ---------------------------------------------------------------------------- -- startMidMapVoteForRandomMap -- -- Start the vote menu if during a race and more than 30 seconds from the end -- No messages if this was not started by a player ---------------------------------------------------------------------------- --[[function startMidMapVoteForRandomMap(player) -- Check state and race time left if not stateAllowsRandomMapVote() or g_CurrentRaceMode:getTimeRemaining() < 30000 then if player then outputRace( "I'm afraid I can't let you do that, " .. getPlayerName(player) .. ".", player ) end return end displayHilariarseMessage( player ) exports.votemanager:stopPoll() -- Actual vote started here local pollDidStart = exports.votemanager:startPoll { title='Do you want to change to a random map?', percentage=51, timeout=15, allowchange=true, visibleTo=getRootElement(), [1]={'Yes', 'midMapVoteResult', getRootElement(), true}, [2]={'No', 'midMapVoteResult', getRootElement(), false;default=true}, } -- Change state if vote did start if pollDidStart then gotoState('MidMapVote') end end addCommandHandler('new',startMidMapVoteForRandomMap)--]] ---------------------------------------------------------------------------- -- event midMapVoteResult -- -- Called from the votemanager when the poll has completed ---------------------------------------------------------------------------- addEvent('midMapVoteResult') addEventHandler('midMapVoteResult', getRootElement(), function( votedYes ) -- Change state back if stateAllowsRandomMapVoteResult() then gotoState('Running') if votedYes then startRandomMap() else displayKillerPunchLine() end end end ) ---------------------------------------------------------------------------- -- startRandomMap -- -- Changes the current map to a random race map ---------------------------------------------------------------------------- function startRandomMap() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get a random map chosen from the 10% of least recently player maps, with enough spawn points for all the players (if required) local map = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if map then g_IgnoreSpawnCountProblems = map -- Uber hack 4000 if not exports.mapmanager:changeGamemodeMap ( map, nil, true ) then problemChangingMap() end else outputWarning( 'startRandomMap failed' ) end end ---------------------------------------------------------------------------- -- outputRace -- -- Race color is defined in the settings ---------------------------------------------------------------------------- function outputRace(message, toElement) toElement = toElement or g_Root local r, g, b = getColorFromString(string.upper(get("color"))) if getElementType(toElement) == 'console' then outputServerLog(message) else if toElement == rootElement then outputServerLog(message) end if getElementType(toElement) == 'player' then message = '[PM] ' .. message end outputChatBox(message, toElement, r, g, b,true) end end ---------------------------------------------------------------------------- -- problemChangingMap -- -- Sort it ---------------------------------------------------------------------------- function problemChangingMap() outputRace( 'Changing to random map in 5 seconds' ) local currentMap = exports.mapmanager:getRunningGamemodeMap() TimerManager.createTimerFor("resource","mapproblem"):setTimer( function() -- Check that something else hasn't already changed the map if currentMap == exports.mapmanager:getRunningGamemodeMap() then startRandomMap() end end, math.random(4500,5500), 1 ) end -- -- -- NextMapVote -- -- -- local g_Poll ---------------------------------------------------------------------------- -- startNextMapVote -- -- Start a votemap for the next map. Should only be called during the -- race state 'NextMapSelect' ---------------------------------------------------------------------------- function startNextMapVote() exports.votemanager:stopPoll() -- Handle forced nextmap setting if maybeApplyForcedNextMap() then return end -- Get all maps local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource()) -- limit it to eight random maps if #compatibleMaps > 8 then math.randomseed(getTickCount()) repeat table.remove(compatibleMaps, math.random(1, #compatibleMaps)) until #compatibleMaps == 8 elseif #compatibleMaps < 2 then return false, errorCode.onlyOneCompatibleMap 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="Choose the next map:", visibleTo=getRootElement(), percentage=51, timeout=15, 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 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
  3. ''Admin,SuperModerator'' So yes,
  4. Hey guys i got an problem with my server smods cant do /redo here i my acl. Pls help me Greetz Jordy
×
×
  • Create New...