Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] mp_weapons_map_count #936

Open
Maxi605 opened this issue Feb 2, 2024 · 1 comment
Open

[Feature Request] mp_weapons_map_count #936

Maxi605 opened this issue Feb 2, 2024 · 1 comment

Comments

@Maxi605
Copy link

Maxi605 commented Feb 2, 2024

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.
@Vaqtincha
Copy link
Contributor

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
	}
}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants