Jump to content

Getting rid of all weapons/force-powers


afi
Go to solution Solved by eezstreet,

Recommended Posts

Hi, I'm wondering what could be the best way to remove all weapons (except for saber) and force-powers (except for jump) so you can't use them anymore in the game.

Of course I can delete them from the menus and remove them from the maps but you would still be able to get them through the console or at least with cheats.

Any idea how I'd remove them completely? Is there a way to "lock" g_forcepowerdisable and g_weapondisable?

 

Something like (pseudocode):

if (g_weapondisable != 524279)
{
g_weapondisable = 524279
}

Or will it be more complicated? Btw do forcepowers get pre-cached (like weapons)?

Link to comment
  • Solution

Assuming you're using OpenJK, change this line to:
 

XCVAR_DEF( g_weaponDisable, "524279", NULL, CVAR_SERVERINFO|CVAR_ROM, qfalse )

This defines the basic properties of a cvar. Note the difference of the stuff in quotes. This is the default value. Also note how I changed it from

CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH

to

CVAR_SERVERINFO|CVAR_ROM

In this particular case, the CVAR_SERVERINFO flag is needed in both cases, as it's responsible for telling clients on the join server menu that your server doesn't have weapons (for the icon thing). CVAR_ARCHIVE means that it gets saved to the jampserver.cfg, CVAR_LATCH means that it requires a map restart to take effect. CVAR_ROM means that the cvar cannot be changed ingame at all.

So by changing the flags to CVAR_ROM and changing the default value, you're setting the cvar to a fixed default value that cannot be changed.

You can perform a similar edit to g_forcePowerDisable as well.

If you aren't using OpenJK, you can do this in g_main.c. The flags and everything are identical, there's just some slight syntax differences but it's nothing to worry about really.

afi likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...