Tremulous Forum
Mods => Modding Center => Topic started by: ACKMAN on September 02, 2008, 07:46:26 pm
-
I saw this command in some servers months ago. I've searched but i can't find it...
Anyone have a patch or something?
-
My guess is it's just an admin version of the /set command.
-
Yes.. eg: !set g_gravity 10. Its like rcon but faster
-
Can't be too hard to code.
qboolean G_admin_cvarset( gentity_t *ent, int skiparg )
{
char name[ 100 ]; // arbitrary value here since I'm lazy
char value[ MAX_CVAR_VALUE_STRING ];
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
strcpy( value, G_SayConcatArgs( 2 + skiparg ) );
trap_Cvar_Set( name, value );
}
Obviously you'll want to throw in some error checking, but that's the basic idea.
-
Thanks :D really
-
Can't be too hard to code.
qboolean G_admin_cvarset( gentity_t *ent, int skiparg )
{
char name[ 100 ]; // arbitrary value here since I'm lazy
char value[ MAX_CVAR_VALUE_STRING ];
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
strcpy( value, G_SayConcatArgs( 2 + skiparg ) );
trap_Cvar_Set( name, value );
}
Obviously you'll want to throw in some error checking, but that's the basic idea.
that's a little too abusable and/or dangerous
qboolean G_admin_cvarset( gentity_t *ent, int skiparg )
{
char name[ 100 ]; // arbitrary value here since Syntac is lazy
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
trap_SendConsoleCommand( va("set \"%s\" \"%s\"\n", name, G_SayConcatArgs( 2 + skiparg ) ) );
}
this is much safer
-
Thanks for correcting my incredibly sloppy code for me. ;)
-
I like pie 8)
-
Worth pointing out this lets admins set anything and everything. Including the rcon password etc, which can destroy your server with ease.