h4x7o0r Posted December 5, 2011 Share Posted December 5, 2011 (edited) 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 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 December 5, 2011 by Guest Link to comment
tropez Posted December 5, 2011 Share Posted December 5, 2011 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
h4x7o0r Posted December 5, 2011 Author Share Posted December 5, 2011 I don't need any outputChatBox because i wanna change the way how the maps will be shown in the votemap poll. Link to comment
tropez Posted December 5, 2011 Share Posted December 5, 2011 So, find a fragment of code where is the votemap poll. Link to comment
h4x7o0r Posted December 5, 2011 Author Share Posted December 5, 2011 i have written before : racevoting_server.lua (guess from line 238) ... and here is a section of code thanks for your help. Link to comment
Aibo Posted December 5, 2011 Share Posted December 5, 2011 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
h4x7o0r Posted December 5, 2011 Author Share Posted December 5, 2011 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now