View Single Post
Old 06-22-2006, 08:15 PM   #1
Vruki Salet
Junior Member
 
Vruki Salet's Avatar
 
Join Date: Aug 2005
Location: Somewhere else entirely
Posts: 443
How can I make BUTTON_ATTACK as if pressed in cgame?

I have made a command in g_cmds.c that needs the game to make like BUTTON_ATTACK has been pressed without the player really doing so.

in bg_pmove.c, within PM_Weapon, I have the following:

Code:
#ifdef QAGAME
	if (g_entities[pm->ps->clientNum].client->vsnSaberCombat.swingingSaber == qtrue)
		{
		pm->cmd.buttons |= BUTTON_ATTACK;
		}
#endif
As you can see it's only in QAGAME so it works fine if my client is the same as my server like when I run it as a non-dedicated listening server, but doesn't work for any clients when I run the code on a dedicated server.

How can I make the cgame also virtually press BUTTON_ATTACK at the same time?

PS.:

I tried out ways that avoided using #ifdef QAGAME but it didn't seem to help. "cmd.buttons |= BUTTON_ATTACK" still didn't work from cgame files though I tried it in various places. As it is now the QAGAME version is back since it's more convenient in other ways.
Vruki Salet is offline   you may: quote & reply,