Jump to content

Votemap Mapname Color


h4x7o0r

Recommended Posts

Hey all, I have a server for dm/dd races, and i wanna make the votemap to show dd maps with red color for example and dm maps with blue.

I've noticed that i need to modify racevoting_server.lua (guess from line 238), a function to verify if every mapname contains dd in the name and use an if statement but i don't know how can i change the color :P

Here's what i've done for the moment but i need some help :

  
    for index, map in ipairs(compatibleMaps) do 
  
        local mapName = getResourceInfo(map, "name") or getResourceName(map) 
                if string.find(getMapName(), "DD", 1, true) then  
                   mapName = 
                else  
                       mapName =  
                end 
        table.insert(poll, {mapName, 'nextMapVoteResult', getRootElement(), map}) 
    end 
  

Edited by Guest
Link to comment

I am not sure what do you want to do, but find a line with outputChatBox and change the arguments of colors.

  
    for index, map in ipairs(compatibleMaps) do 
  
        local mapName = getResourceInfo(map, "name") or getResourceName(map) 
                if string.find(getMapName(), "DD", 1, true) then  
                   etype = 1 
                else  
                     etype = 2 
                end 
        table.insert(poll, {mapName, 'nextMapVoteResult', getRootElement(), map, etype}) 
    end 
  

Later you can check type by use poll[ id? ][5] and create "if"statement.

Link to comment

actually you dont really need to edit race resource, voting window is created by votemanager.

votemanager_client.lua, somewhere around line 191:

  
      -- replace this 
      guiLabelSetColor(optionLabels[index], layout.option.r, layout.option.g, layout.option.b) 
  
      -- with your name check and color 
      if option:find("DD", 1, true) then 
        guiLabelSetColor(optionLabels[index], 255, 0, 0) 
      elseif option:find("DM", 1, true) then 
        guiLabelSetColor(optionLabels[index], 64, 64, 255) 
      else 
        guiLabelSetColor(optionLabels[index], layout.option.r, layout.option.g, layout.option.b) 
      end 
  

ofc you can pass the color from race on poll start for each map separately, but that'll require a bit more rewriting.

Link to comment

Awesome! It works like a charm. That's what I've wanted. Thank you very much.

LE: I've also added another else if for "Play again"

       if option:find("DD", 1, true) then 
        guiLabelSetColor(optionLabels[index], 255, 0, 0) 
      elseif option:find("DM", 1, true) then 
        guiLabelSetColor(optionLabels[index], 64, 64, 255) 
      elseif option:find("Play again", 1, true) then  
        guiLabelSetColor(optionLabels[index], 0, 255, 0) 
      else 
        guiLabelSetColor(optionLabels[index], layout.option.r, layout.option.g, layout.option.b) 
      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...