Sign in to follow this  
Daeron

Next map

Recommended Posts

next map start when 1 player is alive and still driving -.-

i want to put it like next map doesnt start till every player is dead

Share this post


Link to post

try this:

addEventHandler("onPlayerWasted",root,function() 
    if not getAlivePlayers() then 
        triggerEvent("onRoundFinished",resourceRoot) 
    end 
end) 

Edited by Guest

Share this post


Link to post

still didnt work , maybe u can send me the script and meta file ? maybe i did something wrong

Share this post


Link to post

LoL, he,s talking about the race... he didn't write it but I know it.. :D

Go to your race folder, then go to the modes folder and you will see destructionderby.lua, edit it, replace it with the following code:

DestructionDerby = setmetatable({}, RaceMode) 
DestructionDerby.__index = DestructionDerby 
mode = 1 
  
DestructionDerby:register('Destruction derby') 
  
function DestructionDerby:isApplicable() 
    return not RaceMode.checkpointsExist() and RaceMode.getMapOption('respawn') == 'none' or RaceMode.getMapOption('respawn') == 'timelimit' 
end 
  
function DestructionDerby:getPlayerRank(player) 
    return #getActivePlayers() 
end 
  
-- Copy of old updateRank 
function DestructionDerby:updateRanks() 
    for i,player in ipairs(g_Players) do 
        if not isPlayerFinished(player) then 
            local rank = self:getPlayerRank(player) 
            if not rank or rank > 0 then 
                setElementData(player, 'race rank', rank) 
            end 
        end 
    end 
    -- Make text look good at the start 
    if not self.running then 
        for i,player in ipairs(g_Players) do 
            setElementData(player, 'race rank', '' ) 
            setElementData(player, 'checkpoint', '' ) 
        end 
    end 
end 
  
function DestructionDerby:onPlayerWasted(player) 
    if isActivePlayer(player) then 
        self:handleFinishActivePlayer(player) 
        if getActivePlayerCount() <= mode then 
            RaceMode.endMap() 
        else 
            TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') 
             
  
        end 
    end 
    RaceMode.setPlayerIsFinished(player) 
    showBlipsAttachedTo(player, false) 
end 
  
function DestructionDerby:onPlayerQuit(player) 
    if isActivePlayer(player) then 
        self:handleFinishActivePlayer(player) 
        if getActivePlayerCount() <= mode then 
            RaceMode.endMap() 
        end 
    end 
end 
  
function DestructionDerby:handleFinishActivePlayer(player) 
    -- Update ranking board for player being removed 
    if not self.rankingBoard then 
        self.rankingBoard = RankingBoard:create() 
        self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) 
    end 
    local timePassed = self:getTimePassed() 
    self.rankingBoard:add(player, timePassed) 
    -- Do remove 
    finishActivePlayer(player) 
    -- Update ranking board if one player left 
    local activePlayers = getActivePlayers() 
    if #activePlayers == 1 then 
        self.rankingBoard:add(activePlayers[1], timePassed) 
        showMessage(getPlayerName(activePlayers[1]) .. ' je KING!', 255, 255, 0) 
        exports.mikiserver:checkWinAndIfWinGiveWinCash(activePlayers[1]) 
  
    end  
end 
  
  
  
------------------------------------------------------------ 
-- activePlayerList stuff 
-- 
  
function isActivePlayer( player ) 
    return table.find( g_CurrentRaceMode.activePlayerList, player ) 
end 
  
function addActivePlayer( player ) 
    table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) 
end 
  
function removeActivePlayer( player ) 
    table.removevalue( g_CurrentRaceMode.activePlayerList, player ) 
end 
  
function finishActivePlayer( player ) 
    table.removevalue( g_CurrentRaceMode.activePlayerList, player ) 
    table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) 
end 
  
function getFinishedPlayerCount() 
    return #g_CurrentRaceMode.finishedPlayerList 
end 
  
function getActivePlayerCount() 
    return #g_CurrentRaceMode.activePlayerList 
end 
  
function getActivePlayers() 
    return g_CurrentRaceMode.activePlayerList 
end 
  
  
function changeMode (player, command) 
  
if hasObjectPermissionTo ( player , "function.kickPlayer", false ) then 
  
  if (mode == 1) then 
    mode = 0 
  outputChatBox("#8ED2FFAdministrator #BDE4FF" .. getPlayerName(player) .. " #8ED2FFpovolil funkci -Vitez mapu dojizdi!- .", getRootElement(), 250,0,0, true ) 
  else 
    mode = 1 
  outputChatBox("#8ED2FFAdministrator #BDE4FF" .. getPlayerName(player) .. " #8ED2FFvypnul funkci -Vitez mapu dojizdi!- .", getRootElement(), 250,0,0, true ) 
  
  end 
  
  else 
 outputChatBox("** Nemas dostatecny admin Level!!", player,250,0,0) 
  
end 
  
 msg = "MODE: " 
            outputServerLog( msg .. mode ) 
  
  
end 
  
addCommandHandler("mode", changeMode) 
addEvent("toggleMode", true) 
addEventHandler("toggleMode", getRootElement(), changeMode)  
  
  

You will have a command /mode to chagne this, if the player can finish or not.. just change the strings at the end of the code to your own language, if you know basics of the scripting you should know what is going on there :D

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.