s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
573 stars 196 forks source link

[Feature Request] mp_weapons_map_count #936

Open Maxi605 opened 7 months ago

Maxi605 commented 7 months ago

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 commented 7 months ago

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