AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to Block 100% weapon reload (https://forums.alliedmods.net/showthread.php?t=174502)

dias 12-21-2011 07:11

How to Block 100% weapon reload
 
I have this code:
PHP Code:

#include <hamsandwich>
#include <fakemeta>

new bool:block_reload[33]

public 
plugin_init()
{
     
RegisterHam(Ham_Weapon_Reload"weapon_m249""fw_weapon_reload")
}

public 
fw_weapon_reload(ent)
{
     static 
id
     id 
pev(entpev_owner)

     if(
block_reload[id])
           return 
HAM_SUPERCEDE

     
return HAM_HANDLED


This code only block manual reload by press (R) button. It didn't block auto reload... When the ammo turn to 0, the weapon auto reload. How to block it :|

Devil259 12-21-2011 07:37

Re: How to Block 100% weapon reload
 
Code:
cs_set_user_bpammo( id , CSW_M249 , 0 )

Bos93 12-21-2011 18:49

Re: How to Block 100% weapon reload
 
Code:

#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new block[33];

public plugin_init() RegisterHam(Ham_Weapon_Reload, "weapon_m249", "Reload_Post", 1);
       
public Reload_Post(weapon_entity)
{
        new id = pev(weapon_entity, pev_owner);
       
        if (!is_user_connected(id))
                return HAM_IGNORED;

        if (block[id])
                return HAM_SUPERCEDE;

        return HAM_IGNORED;
}



All times are GMT -4. The time now is 11:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.