ReGameDLL_CS icon indicating copy to clipboard operation
ReGameDLL_CS copied to clipboard

[Feature Request] mp_weapons_map_count

Open Maxi605 opened this issue 1 year ago • 1 comments

My suggestion is to add a new cvar to control the weapons count that spawn with the map, allowing the ability to have infinite weapon count without the need to modify the map.

  1. Default behaviour (do nothing).
  2. Make the weapons count infinite.

Maxi605 avatar Feb 02 '24 22:02 Maxi605

use this

#define IsPlayer(%1)			(1 <= (%1) <= MaxClients)
#define CanRestart(%1)			(pev(%1, pev_effects) & EF_NODRAW)

public plugin_init()
{
	register_plugin("Armoury CSDM Restart", "0.1", "Vaqtincha")
	
	RegisterHam(Ham_Think, "armoury_entity", "CArmoury_Think", .Post = true)
	RegisterHam(Ham_Touch, "armoury_entity", "CArmoury_Touch", .Post = true)
}

public CArmoury_Touch(const pArmoury, const pPlayer)
{
	if (IsPlayer(pPlayer) && pArmoury > 0 && CanRestart(pArmoury)) {
		set_entvar(pArmoury, var_nextthink, get_gametime() + 10.0) // respawn time 10 sec
	}
}

public CArmoury_Think(const pArmoury)
{
	if (!is_nullent(pArmoury))
	{
		ExecuteHamB(Ham_CS_Restart, pArmoury)
		// emit_sound(pArmoury, CHAN_WEAPON, "items/suitchargeok1.wav", 0.6, ATTN_NORM, 0, 150) // respawn sound
	}
}```

Vaqtincha avatar Feb 05 '24 19:02 Vaqtincha