SetDefaultToolAndGunSettings

From The KillerJim Mod Wiki

PlayerProxy::SetDefaultToolAndGunSettings

SetDefaultToolAndGunSettings.png

Client Only Function - This API call can only be called on clients.

Description

KJMod provides both "guns" (who's main purpose is to damage other things) and "tools" (who's main purpose is to modify, interact or provide some game-mode specific functions).

When you're writing a game-mode you may end up wanting to us some internal tools (physgun, weld, etc.), some internal guns (ak-47, etc.), some external tools or guns (from a workshop package) or maybe some tools or guns you've made inside your game-mode project.

The point is there are many different ways to include tools or guns, however most of these ways you get ALL the tools or guns (i.e. if you use some external workshop package all the guns inside it are mounted for the player to use).

This operation is probably not what you want, you ideally want to limit what they can use based on your game-mode or player particular abilities.

This function allows you to control the tools and gun's made available PER player, normally triggered by the server sending them some information (i.e. "the player is a terrorist, allow them to have some C4 to play with"). In addition to full control you can also use this function to enable standard sandbox or standard fps weapons.

Normally you would call this from the Player Proxies 'Player Spawned' event, so when the player is spawned you set their default tool and gun settings. For more hard-core game-mode developers you may want to turn off all items and manually give the player things (as and when required)

Arguments
1 KJModPlayerProxy The target player proxy to apply settings to...
A structure representing the chat settings for the "current" user.

Enum Mod (default : Custom) - Allows you to specify whether you want defaults used for sandbox, fps or want to use the AvailableTools and AvailableGuns parameters to supply a named list of items.

Array Available Tools - This string array contains a case-sensitive list of tools (internal, or from some workshop item) to initially give the player. They are populated in the equipment bar along the top of the HUD (if the tool is set-up to)

bool Auto Equip Tool (default : false) - If enabled, the first tool is automatically equipped on the player.

Array Available Guns - This string array contains a case-sensitive list of guns (internal, or from some workshop item) to initially give the player. They are populated in the equipment bar along the top of the HUD (if the gun is set-up to)

bool Auto Equip Gun (default : false) - If enabled, the first gun is automatically equipped on the player (overrides auto equip tool)

Playing

Developers

Developer Reference