AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block reload (https://forums.alliedmods.net/showthread.php?t=223339)

ironskillz1 08-12-2013 11:27

Block reload
 
Im trying to block usp reload and i found this code on the internet


Code:

RegisterHam(Ham_Weapon_Reload, "weapon_usp", "Reload_Post", 1);
Code:

public Reload_Post(weapon_entity)
{
 new id = pev(weapon_entity, pev_owner);
 
 if (!is_user_connected(id))
  return HAM_IGNORED;
 if( g_iCurrentDay == DAY_LASERDOME )
  return HAM_SUPERCEDE;
 return HAM_IGNORED;
}

But the usp is reloading anyways when i giving it 1 bullet

Here is my give 1 bullet code

Code:

if( g_iCurrentDay == DAY_LASERDOME ) 
 {
  get_user_ammo( iPlayer, CSW_USP, clip, ammo )
  if ( ammo <= 0 )
  {
  cs_set_weapon_ammo(fm_get_weapon_id(iPlayer, "weapon_usp"), 1);
  new ent = find_ent_by_owner( 0, "weapon_usp", iPlayer )
  cs_set_weapon_silen( ent, 1 )
  } 
 }

Code:

stock fm_get_weapon_id(index, const weapon[])
{
 new ent = -1;
 
 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", weapon)) != 0)
 {
  if(index == pev(ent, pev_owner))
  return ent;
 }
 return 0;
}


pokemonmaster 08-12-2013 12:54

Re: Block reload
 
register it as a pre not post

ironskillz1 08-13-2013 04:03

Re: Block reload
 
It blocks reload when someone buys a usp and shoots with it

but if i give it 1 bullet it reloads

Black Rose 08-13-2013 07:25

Re: Block reload
 
Did you register it as a pre like you were told to?

ironskillz1 08-13-2013 09:09

Re: Block reload
 
Quote:

Originally Posted by Black Rose (Post 2012083)
Did you register it as a pre like you were told to?

Yes


All times are GMT -4. The time now is 15:56.

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