AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to Strip weapon correctly ?? (https://forums.alliedmods.net/showthread.php?t=83164)

assd 01-05-2009 07:57

How to Strip weapon correctly ??
 
I use strip_weapon function

Code:

public strip_weapon(id, weaponid){
 if ((weaponid < 1) || (weaponid == 2) || (weaponid > 30) || (wepon_mod_initializated == 1)) return 0;
 new wEnt;
 while ((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapons_name[weaponid])) && pev(wEnt,pev_owner) != id ) {}
 if(!wEnt) return 0;

 new c, a
 if (get_user_weapon(id, c, a) == weaponid) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)

 if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;

 ExecuteHamB(Ham_Item_Kill,wEnt);

 set_pev(id, pev_weapons, pev(id,pev_weapons) & ~(1<<weaponid));
 return 1;
}

This code work normal, but after strip_weapon, the player can't pick up new weapon, untill die. How to correct this problem?

xPaw 01-05-2009 09:14

Re: How to Strip weapon correctly ??
 
just include fakemeta_util.inc and use
PHP Code:

fm_strip_user_weaponsindex ); 


assd 01-05-2009 09:35

Re: How to Strip weapon correctly ??
 
This function strip all weapons. I need strip only one, and he can pickup weapon.

ConnorMcLeod 01-05-2009 11:29

Re: How to Strip weapon correctly ??
 
http://forums.alliedmods.net/showthread.php?t=56377

Owyn 01-28-2009 09:29

Re: How to Strip weapon correctly ??
 
Quote:

This code work normal, but after strip_weapon, the player can't pick up new weapon, untill die
thx alot, i was searching for this.... but it doesn't compile =\

Arkshine 01-28-2009 09:39

Re: How to Strip weapon correctly ??
 
Using Ham ( ConnorMcLeod's link ) would be more efficient.

hleV 01-28-2009 10:12

Re: How to Strip weapon correctly ??
 
There's also fm_strip_user_gun() in Fakemeta. But yeah, Ham's way is better.

BOYSplayCS 01-28-2009 10:47

Re: How to Strip weapon correctly ??
 
Why is ham better tan FakeMeta?

I think Fakemeta is way more efficient.


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

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