Jump to content

Dm votemanager


h4x7o0r

Recommended Posts

Hey guys,

I'm having a DM server and i wanna change a lil bit how votemanager's acting. For example, DM maps obviously are finished when at last one player is taking the Hunter and then kill others alive. The problem is that it's kinda impossible for some1 skilled to finish the map because others are failing before reaching the hunter. So is there any command / resource on community to modify this votemap to appear just only last player alive take the hunter or so ?

Sincerly i've search for a related topic but couldn't fine anything useful at all.

Thanks in advance.

Link to comment

Thank you so much for your help, i've found this :https://community.multitheftauto.com/index.php?p=resources&s=details&id=5530

But when u download the resource, there's a link to download and there u must pay some money. I don't trust those things and also, i think it's kinda denied to upload it that way. who knows. anyways I will still searching for.

Link to comment

Mkay, open up race/modes/destructionderby.lua

find in function DestructionDerby:onPlayerWasted(player)

if getActivePlayerCount() <= 1 then 

replace it with

if getActivePlayerCount() <= 0 then 

So it should look like this

function DestructionDerby:onPlayerWasted(player) 
    if isActivePlayer(player) then 
        self:handleFinishActivePlayer(player) 
        if getActivePlayerCount() <= 0 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 

About this hunter thingy you could check if player is the only one playing and as soon as he gets hunter simply kill him and map will end.

Link to comment

thank you very much for your solution, it's working very well (i've used kinda different this)

  
    if getActivePlayerCount() < 1 then 
  

also as u suggested i should kill the last player who takes the hunter so i decided to use it this way :

  
    -- Update ranking board if one player left 
    local activePlayers = getActivePlayers() 
    if #activePlayers == 1 then 
        self.rankingBoard:add(activePlayers[1], timePassed) 
        showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) 
        triggerEvent( "onPlayerWinDD",activePlayers[1] ) 
    end 
        --------- 
        if ( tonumber(getElementModel(veh)) == 425 ) and ( #activePlayers == 1) then  
          
  
       end 
  

I don't know if this is the right way, and also to kill him should I use setElementHealth or other ?

Thanks for all your help guys.

LE. i've modified "and" tnx

Edited by Guest
Link to comment
  
    -- Update ranking board if one player left 
    local activePlayers = getActivePlayers() 
    if #activePlayers == 1 then 
        self.rankingBoard:add(activePlayers[1], timePassed) 
        showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) 
        triggerEvent( "onPlayerWinDD",activePlayers[1] ) 
    end 
        --  
        local targetPlayer = getPlayerFromName ( targetPlayerName ) 
        if ( tonumber(getElementModel(veh)) == 425 ) and ( #activePlayers == 1) then 
            if targetPlayer then 
                   setElementHealth ( targetPlayer, getElementHealth(targetPlayer) - 110 ) 
            end 
        end 
  

I don't know if it's correct.

Link to comment
  
    -- Update ranking board if one player left 
    local activePlayers = getActivePlayers() 
    if #activePlayers == 1 then 
        self.rankingBoard:add(activePlayers[1], timePassed) 
        showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) 
        triggerEvent( "onPlayerWinDD",activePlayers[1] ) 
    end 
        -- 
        local targetPlayer = getPlayerFromName (sourcePlayer ) 
        local veh = getPedOccupiedVehicle(targetPlayer) 
         
        if ( tonumber(getElementModel(veh)) == 425 ) and ( #activePlayers == 1) then 
            if targetPlayer then 
                   setElementHealth ( targetPlayer, getElementHealth(targetPlayer) - 110 ) 
            end 
        end 
  

How about now ?

Edited by Guest
Link to comment

This one will end the map if last player has already hunter

    -- Update ranking board if one player left 
local activePlayers = getActivePlayers() 
if #activePlayers == 1 then 
    self.rankingBoard:add(activePlayers[1], timePassed) 
    showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) 
    triggerEvent( "onPlayerWinDD",activePlayers[1] ) 
    if (getElementModel(getPedOccupiedVehicle(activePlayers[1])) == 425) then 
        RaceMode.endMap() 
    end 
end 

And this one will end the map when last player gets hunter

(add it end of the file)

addEventHandler("onElementModelChange",root, 
function(old,new) 
    if (getElementType(source) == "vehicle") then 
            if #activePlayers <= 1 then 
                if (new == 425) then 
                    RaceMode.endMap() 
                end 
            end 
    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...