Good job!
I will give you a guide on how to do it in a vote.
Mod n!tmod 2.3*
We add a button to the ingame_vote_misc command:
Then add a line to menus.txtCode:BUTTONEXT( 75, 338, .5*(WINDOW_WIDTH-18), 14, "OMNIBOT SKILL SETTINGS", .24, 11, close ingame_vote_misc ; open omnibot_skill )
Then create a menu script:Code:loadMenu { "ui/omnibot_skill.menu" }
omnibot_skill.menu
We go to vote.db:Code:#include "ui/menudef.h" #define WINDOW_X 16 #define WINDOW_Y 16 #define WINDOW_WIDTH 296 #define WINDOW_HEIGHT 210 #define GROUP_NAME "omnibot_skill" #include "ui/menumacros.h" menuDef { name "omnibot_skill" visible 0 fullscreen 0 rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT style WINDOW_STYLE_FILLED onOpen { copyCvar g_gametype ui_voteGameType ; conditionalScript ui_voteGameType 3 // 3: cvartest ( "setcvar ui_voteGameType 2" ) ( "clearFocus" ) "4" ; } onEsc { close omnibot_skill ; open ingame_vote } // Animated menu by mAzak // Polska vodka n!tmod // (C) 2017-2018 // itemDef { // name "Tlo" // group GROUP_NAME // rect 0 0 296 210 // background "ui/assets/bord.tga" // style WINDOW_STYLE_SHADER // visible 1 // decoration // } //itemDef { // name "glosowanie" // rect 87 0 120 35 // style WINDOW_STYLE_SHADER // background "menu/glosowanie.tga" // forecolor 1 1 1 1 // visible 1 // decoration // } // // DESCRIPTION OMNIBOT SETTING BUTTONEXT( 6, 32, WINDOW_WIDTH-12, -1, "^qUSTAWIENIA SKILLA OMNIBOTOW^P:", .24, 11, ) BUTTONEXT( 6, 44, WINDOW_WIDTH-12, -1, "^XDzieki ponizszym ustawieniom botow mozemy regulowac", .24, 11, ) BUTTONEXT( 6, 56, WINDOW_WIDTH-12, -1, "^Xich poziom umiejetjetnosci za pomoca ponizszych guzikow", .24, 11, ) BUTTONEXT( 6, 68, WINDOW_WIDTH-12, -1, "^XWybierz jedno z ponizszych ustawien aby zaglosowac", .24, 11, ) BUTTONEXT( 75, 86, .5*(WINDOW_WIDTH-18), 14, "LEVEL EASY", .24, 11, exec "cmd callvote easy"; exec "exec muza_stop.cfg"; exec "exec vote.cfg"; uiScript closeingame ) BUTTONEXT( 75, 104, .5*(WINDOW_WIDTH-18), 14, "LEVEL MEDIUM", .24, 11, exec "cmd callvote medium"; exec "exec muza_stop.cfg"; exec "exec vote.cfg"; uiScript closeingame ) BUTTONEXT( 75, 122, .5*(WINDOW_WIDTH-18), 14, "LEVEL HARD", .24, 11, exec "cmd callvote hard"; exec "exec muza_stop.cfg"; exec "exec vote.cfg"; uiScript closeingame ) BUTTONEXT( 75, 140, .5*(WINDOW_WIDTH-18), 14, "RANDOM", .24, 11, exec "cmd callvote random"; exec "exec muza_stop.cfg"; exec "exec vote.cfg"; uiScript closeingame ) BUTTONEXT( 6, 158, WINDOW_WIDTH-12, -1, "^sUwaga^q! ^sGlosowanie jest wazne jedna mape", .24, 11, ) BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, "BACK", .3, 14, close omnibot_skill ; open ingame_vote_misc ) }
vote.db
Finished.Code:********** name = easy message = ^sSet the botow level to EASY? help = Vote for the level of bots EASY exec = bot difficulty 2; bot moveskill 2 passtext = ^SOMNIBOT EASY levels = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ********** name = medium message = ^sSet the botow level on a MEDIUM? help = Vote for the level of bots MEDIUM exec = bot difficulty 3; bot moveskill 3 passtext = ^SP^SOMNIBOT MEDIUM levels = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ********** name = hard message = ^sSet the botow level on a HARD? help = Vote for the level of bots HARD exec = bot difficulty 6; bot moveskill 4 passtext = ^S^SOMNIBOT HARD levels = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ********** name = random message = ^sSet the botow level on a RANDOM? help = Vote for the level of bots RANDOM exec = bot difficulty 6; bot moveskill 3 passtext = ^S^SOMNIBOT RANDOM levels = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Other mod: silEnT 0.8.2, ETPub, NQ
lua scripts:
customvote.lua
Add to mod.cfgCode:vote_allow_omnibot_easy = 1 vote_allow_omnibot_medium = 1 vote_allow_omnibot_hard = 1 vote_allow_omnibot_random = 1 description = "Custom omnibots" function et_InitGame( levelTime, randomSeed, restart) local modname = string.format("%s", description) et.G_Print(string.format("%s loaded\n", modname)) et.RegisterModname( modname) sv_maxclients = et.trap_Cvar_Get("sv_maxclients") num0 = math.floor(sv_maxclients * 0.25) num1 = math.floor(sv_maxclients * 0.5) if vote_allow_omnibot_easy == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_easy EQ 1;") else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_easy 0;") end if vote_allow_omnibot_medium == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_omnibot_medium EQ 1;") else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_medium EQ 0;") end if vote_allow_omnibot_hard == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_omnibot_hard EQ 1;") else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_hard EQ 0;") end if vote_allow_omnibot_random == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_random EQ 1;") else et.trap_SendConsoleCommand( et.EXEC_APPEND, "sv_cvar vote_allow_omnibot_random EQ 0;") end end function et_ClientCommand( clientNum, command) command = command:lower() if et.trap_Argv(0) == "votes" then et.trap_SendServerCommand( clientNum, "print \"\n") et.trap_SendServerCommand( clientNum, "print \"^7Custom ^3callvote ^7commands are:\n") et.trap_SendServerCommand( clientNum, "print \"^3-----------------------------\n") if vote_allow_omnibot_easy == 1 then et.trap_SendServerCommand( clientNum, "print \"^5Vote for the level of bots EASY\n") end if vote_allow_omnibot_medium == 1 then et.trap_SendServerCommand( clientNum, "print \"^5Vote for the level of bots MEDIUM\n") end if vote_allow_omnibot_hard == 1 then et.trap_SendServerCommand( clientNum, "print \"^5Vote for the level of bots HARD\n") end if vote_allow_omnibot_random == 1 then et.trap_SendServerCommand( clientNum, "print \"^5Vote for the level of bots RANDOM\n") end et.trap_SendServerCommand( clientNum, "print \"\n") et.trap_SendServerCommand( clientNum, "print \"^7Usage: ^3\\callvote poll <command>\n") et.trap_SendServerCommand( clientNum, "print \"\n") return 1 end end function et_Print( text) if string.sub(text,1,19) == "Vote Passed: [poll]" then if string.format(text) == "Vote Passed: [poll] easy\n" then if vote_allow_omnibot_easy == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "bot difficulty 2; bot moveskill 2") end return elseif string.format(text) == "Vote Passed: [poll] medium\n" then if vote_allow_omnibot_medium == 1 then et.trap_Cvar_Set( bot difficulty 3; bot moveskill 3) end return elseif string.format(text) == "Vote Passed: [poll] hard\n" then if vote_allow_omnibot_hard == 1 then et.trap_Cvar_Set( "bot difficulty 6; bot moveskill 4) end return elseif string.format(text) == "Vote Passed: [poll] random\n" then if vote_allow_random == 1 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "bot difficulty 6; bot moveskill 3") end return end end end
Then add a line to menus.txtCode:set lua_modules "customvote.lua"
We create a menu script:Code:loadMenu { "ui/omnibot_skill.menu" }
omnibot_skill.menu
Silent 0.9.0:Code:#include "ui/menudef.h" // Defines // #define WINDOW_X 16 #define WINDOW_Y 16 //#define WINDOW_WIDTH 128 #define WINDOW_WIDTH 252 #define WINDOW_HEIGHT 200 #define GROUP_NAME "grpCustomMain" // Macros // #include "ui/menumacros.h" // Misc Vote Menu // menuDef { name "omnibot_skill" visible 0 fullscreen 0 rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT style WINDOW_STYLE_FILLED onOpen { conditionalScript vote_allow_omnibot_easy 0 ( "show bttn_easy" ) ( "hide bttn_easy" ) conditionalScript vote_allow_omnibot_medium 0 ( "show bttn_medium" ) ( "hide bttn_medium" ) conditionalScript vote_allow_omnibot_hard 0 ( "show bttn_hard" ) ( "hide bttn_hard" ) conditionalScript vote_allow_omnibot_random 0 ( "show bttn_random" ) ( "hide bttn_random" ) } onEsc { close omnibot_skill ; open ingame_main ; open custom_main } // Window // WINDOW( "^xVOTE", 50) // Buttons // // left side NAMEDBUTTON( "bttn_easy", 6, 50, .5*(WINDOW_WIDTH-18), 14, "^SBOTS EASY", .24, 11, exec "callvote poll easy"; uiScript closeingame ) NAMEDBUTTON( "bttn_hard", 6, 32, .5*(WINDOW_WIDTH-18), 14, "^SBOTS HARD", .24, 11, exec "callvote poll hard"; uiScript closeingame ) // right side NAMEDBUTTON( "bttn_medium", 6+.5*(WINDOW_WIDTH-18)+6, 50, .5*(WINDOW_WIDTH-18), 14, "^SBOTS MEDIUM", .24, 11, exec "callvote poll medium"; uiScript closeingame ) NAMEDBUTTON( "bttn_random", 6+.5*(WINDOW_WIDTH-18)+6, 32, .5*(WINDOW_WIDTH-18), 14, "^SBOTS RANDOM", .24, 11, exec "callvote poll random"; uiScript closeingame ) BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, "BACK", .3, 14, close omnibot_skill ; open ingame_main ; open custom_main ) }
We create a menu script:
custom_main.menu
Then add a line to menus_server_custom.txtCode:#include "ui/menudef.h" // Defines // #define WINDOW_X 16 #define WINDOW_Y 214 // 16 //#define WINDOW_WIDTH 150 #define WINDOW_WIDTH 160 //#define WINDOW_HEIGHT 196 #define WINDOW_HEIGHT 175 // 248 #define GROUP_NAME "grpCustomMain" // Macros // #include "ui/menumacros.h" // Main Menu // menuDef { name "Custom_Main" visible 0 fullscreen 0 rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT style WINDOW_STYLE_FILLED onOpen { //ydnar conditionalscript ROldModeCheck 2 ( "clearFocus ; open vid_confirm ") ( "clearFocus" ) } onEsc { close ingame_main ; close custom_main } // Window // WINDOW( "^WMAIN II", 50) // Buttons // BUTTON( 6, 32, WINDOW_WIDTH-12, 18, "CUSTOM VOTE", .3, 14, close custom_main ; open omnibot_skill ) }
Add to silent.cfgCode:{ loadMenu { "ui/custom_main.menu" } loadMenu { "ui/omnibot_skill.menu" } }
Code:set lua_modules "customvote.lua"








Reply With Quote