View Full Version : Admin Mod
Clutch152
2nd December 2005, 15:15
I wish to make a client mod that sends rcon commands to the server. Kinda like having a g_gravity textbox and an OK! button next to it. I dont want to add any cvars if i don't have to I just want to use rcon commands. What would be the best/easiest way to go about doing this?
I also want the mod to be able to add/delete Punkbuster cvar checks and stuff like that.
And of course this mod would only be for my server seeing as how the password would be needed for the rcon commands :drink:
P4nth3r
2nd December 2005, 15:40
This indeed would be nice, cause remembering all the damn rcon commands can be pretty irritating sometimes.
I think the best way to do this is by looking in the /ui map in the pak0.pk3 file and make a menu for it. (how I don't know i'm not a coder)
Greetz Panther aka Way2Evil
Clutch152
2nd December 2005, 16:28
well I already got as far as creating the menu's. I just need to know the best way to set up the commands. Like gor g_gravity i want a text box with an OK button next to it. How would I set that up? I had set it up as a button before and it said unknown cm rcon so im kinda lost. lol
Clutch152
3rd December 2005, 18:02
Ok I have a small problem that baffles me completly. When I add things to a menu sometimes i go to use the menu and it doesnt show up at all. Like i'll click on an ingame menu button and the menus just go away.
#include "ui/menudef.h"
// Defines //
#define WINDOW_X 16
#define WINDOW_Y 16
#define WINDOW_WIDTH 608
#define WINDOW_HEIGHT 448
#define GROUP_NAME "grpksdserversettings"
// Macros //
#include "ui/menumacros.h"
// System Menu //
menuDef {
name "server_settings"
visible 0
fullscreen 0
rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
style WINDOW_STYLE_FILLED
onESC {
close server_settings ;
open server_main_menu
}
// Window //
WINDOW( "KSD SERVER SETTINGS", 90 )
// Subwindows //
#define SUBWINDOW_WIDTH .5*(WINDOW_WIDTH-18)
// Move //
SUBWINDOW( 6, 32, (SUBWINDOW_WIDTH), 160, "General" )
BUTTON( 8, 56, (SUBWINDOW_WIDTH)-4, 14, "Gravity 200", .24, 11, exec "rcon YEARIGHT g_gravity 200" )
// Buttons //
BUTTON( 8, WINDOW_HEIGHT-24, .5*(WINDOW_WIDTH-18), 18, "BACK", .3, 14,
close server_settings ; open server_main_menu )
}
That code works
However this code does not let the menu appear at all
#include "ui/menudef.h"
// Defines //
#define WINDOW_X 16
#define WINDOW_Y 16
#define WINDOW_WIDTH 608
#define WINDOW_HEIGHT 448
#define GROUP_NAME "grpksdserversettings"
// Macros //
#include "ui/menumacros.h"
// System Menu //
menuDef {
name "server_settings"
visible 0
fullscreen 0
rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
style WINDOW_STYLE_FILLED
onESC {
close server_settings ;
open server_main_menu
}
// Window //
WINDOW( "KSD SERVER SETTINGS", 90 )
// Subwindows //
#define SUBWINDOW_WIDTH .5*(WINDOW_WIDTH-18)
// Move //
SUBWINDOW( 6, 32, (SUBWINDOW_WIDTH), 160, "General" )
SLIDER( 8, 56, (SUBWINDOW_WIDTH)-4, 10, "Gravity:", .2, 8, exec "rcon YEARIGHT g_gravity" 800 0 99999, "Change
gravity by moving slider!" )
}
And no its not the back button because i've tried that. any ideas why this code would close the menu instead of open it?
KillerWhale
4th December 2005, 00:59
SLIDER( 8, 56, (SUBWINDOW_WIDTH)-4, 10, "Gravity:", .2, 8, exec "rcon YEARIGHT g_gravity" 800 0 99999, "Change gravity by moving slider!" )
[code]
8th parameter of this line is wrong: exec "rcon YEARIGHT g_gravity" 800 0 99999
Look in the console it should also have given parse errors right after loading a map.
The fault is that this 8th paramter has 5 parameters but should only have 4 and the first one must be a cvar not a command.
You could change it to:
[code]
"g_gravity" 800 0 99999
but then it would only work for local server, which you probably don't want.
I can't think of a way that would allow you to send the gravity cvar to the server, because that would probably require a string concat function which doesn't exist for menu scripting or make a change in the ET source code.
Clutch152
4th December 2005, 02:27
oh ok I see now.
The 8th parameter of a slider has to be a cvarfloat thats why it didnt work with slider and the 8th parameter of a button has to be an Action. Got it :)
So if I'm gonna be using rcon commangs I am limited to
BUTTON
BUTTONEXT
NAMEDBUTTON
NAMEDBUTTONEXT
YESNOACTION
CHECKBOXNOTEXTACTION
CHECKBOXACTION
CHECKBOXALIGNXACTION
TRICHECKBOXACTION
TRICHECKBOXACTIONMULTI
MULTIACTION
MULTIACTIONLEFT
Please tell me if any of these are wrong. Am I correct to say that anything with a parameter having _ACTION in it will be what I need to use for rcon commands?
Also would I be able to link an editfield to a button to make the button use the cvar with an action? Cuz I'd really like to use an editfield with a button next to it like the timlimit box in the vote menu.
Jaquboss
4th December 2005, 08:25
trap_SendConsoleCommand( "rcon %s \n", <your option> );
however you need to make this into text and also change <your option> to something realiable
Clutch152
4th December 2005, 21:23
What is that? where would I put that?
Schaffer
5th December 2005, 12:30
So if I'm gonna be using rcon commangs I am limited to
BUTTON
BUTTONEXT
NAMEDBUTTON
NAMEDBUTTONEXT
YESNOACTION
CHECKBOXNOTEXTACTION
CHECKBOXACTION
CHECKBOXALIGNXACTION
TRICHECKBOXACTION
TRICHECKBOXACTIONMULTI
MULTIACTION
MULTIACTIONLEFT
You are not limited to those as these are only definitions of items that receieve a script to execute as part of an action. You can easily build your own defines to do this and then make it execute whatever, so long as the base type (as defined in the definition) supports events.
Clutch152
5th December 2005, 15:29
yea thats true. but i just started with modding the menus of this game like a week ago so i'm not advanced enough to make my own definitions and I cant change anything in the source code because i cant compile it. I dont have service pack 2 for i cannot install it because my computer doesnt like me :P so i cant install visual C++ version 6. maybe if somone could help me make this thing. I mean its a pretty simple idea, just need somone to help me make the menu's and stuff. I'll give credit to who ever wants to help :) My AIM is clutch152again and my xfire is clutch152 . have a nice day everyone :)
Schaffer
5th December 2005, 20:11
I'd like to help but I'm already busy on another mod. IF you do need assistance with a new define or something quick then hit me a PM and I'll see what I can do. I'm currently also doing menus and they are not as daughnting as they may appear.
Good luck
kamikazee
5th December 2005, 20:12
VS 6 should work on a pre-SP2 windows, I even installed it on a no-SP windows.
Clutch152
6th December 2005, 21:34
trap_SendConsoleCommand( "rcon %s \n", <your option> );
however you need to make this into text and also change <your option> to something realiable
I'd like to know what this meant.
Most of the ETpub options are bitflags and I need a way to add them into the menu using rcon commands would that be possible if i defined a new menu option?
VS 6 should work on a pre-SP2 windows, I even installed it on a no-SP windows.
It said i couldnt install it unless i get SP2. Did i download the wrong version or something?
I'd like to help but I'm already busy on another mod. IF you do need assistance with a new define or something quick then hit me a PM and I'll see what I can do. I'm currently also doing menus and they are not as daughnting as they may appear.
Good luck
Thx man! do you have AIM or Xfire?
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.