Author Topic: QVM causes server crash  (Read 3792 times)

Obj-C

  • Posts: 8
  • Turrets: +0/-0
QVM causes server crash
« on: January 25, 2010, 02:03:34 am »
Hey, so I edited gclient and put in 1 extra qboolean, then an admin could change that boolean via a cmd (!decapulate), then in the G_cmds.c I edited G_Say to test if that boolean was true or false. If it was true, then I converted all the text to lower case. Anyways, this worked fine in all the test servers I tried it in, but when I tried it for real, whenever there was 8+ people, the server crashed. Anyone know how to fix this?

Obj-C

  • Posts: 8
  • Turrets: +0/-0
Re: QVM causes server crash
« Reply #1 on: January 25, 2010, 06:11:14 am »
So I did some more testing, and I know that its a segment fault that is causing it... anyone know what to do?

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: QVM causes server crash
« Reply #2 on: January 25, 2010, 08:34:39 am »
post up the changes?
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

Obj-C

  • Posts: 8
  • Turrets: +0/-0
Re: QVM causes server crash
« Reply #3 on: January 25, 2010, 06:16:58 pm »
in g_local.h in the clientPersistant_t struct
Code: [Select]
qboolean            decapulated;

in g_admin.h

Code: [Select]
qboolean G_admin_decapulate( gentity_t *ent, int skiparg );

in g_admin.c
Code: [Select]

{"capulate", G_admin_decapulate, "0",
"capulate a decapulated player",
"[^3name|slot#^7]"
    },

{"decapulate", G_admin_decapulate, "0",
"decapulate a capulated player",
"[^3name|slot#^7]"
    },

and then a bit further down in g_admin.c

Code: [Select]
qboolean G_admin_decapulate( gentity_t *ent, int skiparg )
{
int pids[ MAX_CLIENTS ];
char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
char command[ MAX_ADMIN_CMD_LEN ], *cmd;
gentity_t *vic;

if( G_SayArgc() < 2 + skiparg )
{
ADMP( "^3!decapulate: ^7usage: !decapulate [name|slot#]\n" );
return qfalse;
}
G_SayArgv( skiparg, command, sizeof( command ) );
cmd = command;
if( cmd && *cmd == '!' )
cmd++;
G_SayArgv( 1 + skiparg, name, sizeof( name ) );
if( G_ClientNumbersFromString( name, pids ) != 1 )
{
G_MatchOnePlayer( pids, err, sizeof( err ) );
ADMP( va( "^3!decapulate: ^7%s\n", err ) );
return qfalse;
}
if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )
{
ADMP( "^3!decapulate: ^7sorry, but your intended victim has a higher admin"
" level than you\n" );
return qfalse;
}
vic = &g_entities[ pids[ 0 ] ];
if( vic->client->pers.decapulated == qtrue )
{
if( !Q_stricmp( cmd, "decapulate" ) )
{
ADMP( "^3!decapulate: ^7player is already decapulated\n" );
return qtrue;
}
vic->client->pers.decapulated = qfalse;
CPx( pids[ 0 ], "cp \"^1You have been capulated\"" );
AP( va( "print \"^3!capulate: ^7%s^7 has been capulated by %s\n\"",
  vic->client->pers.netname,
  ( ent ) ? ent->client->pers.netname : "console" ) );
}
else
{
if( !Q_stricmp( cmd, "capulate" ) )
{
ADMP( "^3!capulate: ^7player is not currently decapulated\n" );
return qtrue;
}
vic->client->pers.decapulated = qtrue;
CPx( pids[ 0 ], "cp \"^1You've been decapulated\"" );
AP( va( "print \"^3!decapulate: ^7%s^7 has been decapulated by ^7%s\n\"",
  vic->client->pers.netname,
  ( ent ) ? ent->client->pers.netname : "console" ) );
}
ClientUserinfoChanged( pids[ 0 ] );
return qtrue;
}

in g_cmds at the top of the function G_Say I added
Code: [Select]
int         i=0;
qboolean usedCaps = FALSE;

and a bit further down, I added
Code: [Select]
if (!ent->client->pers.decapulated)
Q_strncpyz( text, chatText, sizeof( text ) );

else {
while (i < MAX_SAY_TEXT) {
if (chatText[i]) {
if (chatText[i] <= 90 && chatText[i] >= 41) {
text[i] += 32;
usedCaps = TRUE;
}
else
text[i] = chatText[i];
}
++i;
}
}

if (usedCaps) {
ADMP( "^1You can't use capital letters\n" );
CP("cp \"^1You can't use capital letters\"");
}

A friend who is helping me test says when aliens go near to turrets using this qvm, there is the error: ERROR: Cvar_Update: handle out of range
« Last Edit: January 25, 2010, 09:17:01 pm by Obj-C »

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: QVM causes server crash
« Reply #4 on: January 25, 2010, 06:58:06 pm »
Code: [Select]
// ps MUST be the first element, because the server expects it
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Obj-C

  • Posts: 8
  • Turrets: +0/-0
Re: QVM causes server crash
« Reply #5 on: January 25, 2010, 07:07:55 pm »
That var still is the first var, I put the my variable underneath the qboolean muted var in clientPersistant_t.
« Last Edit: January 25, 2010, 09:18:31 pm by Obj-C »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: QVM causes server crash
« Reply #6 on: January 25, 2010, 10:08:24 pm »
Make sure that g_main.c has been recompiled after you changed g_local.h; the Makefile should take care of this, but maybe you have some messed up timestamps.

Obj-C

  • Posts: 8
  • Turrets: +0/-0
Re: QVM causes server crash
« Reply #7 on: January 25, 2010, 10:27:18 pm »
I did a make clean, and then remade, still encountering the same issue.