Raised This Month: $ Target: $400
 0% 

How to Strip weapon correctly ??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
assd
Junior Member
Join Date: Jul 2008
Old 01-05-2009 , 07:57   How to Strip weapon correctly ??
Reply With Quote #1

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?
assd is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-05-2009 , 09:14   Re: How to Strip weapon correctly ??
Reply With Quote #2

just include fakemeta_util.inc and use
PHP Code:
fm_strip_user_weaponsindex ); 
__________________

Last edited by xPaw; 01-28-2009 at 13:16.
xPaw is offline
assd
Junior Member
Join Date: Jul 2008
Old 01-05-2009 , 09:35   Re: How to Strip weapon correctly ??
Reply With Quote #3

This function strip all weapons. I need strip only one, and he can pickup weapon.
assd is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-05-2009 , 11:29   Re: How to Strip weapon correctly ??
Reply With Quote #4

http://forums.alliedmods.net/showthread.php?t=56377
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 01-28-2009 , 09:29   Re: How to Strip weapon correctly ??
Reply With Quote #5

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 =\

Last edited by Owyn; 01-28-2009 at 09:40.
Owyn is offline
Send a message via ICQ to Owyn
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-28-2009 , 09:39   Re: How to Strip weapon correctly ??
Reply With Quote #6

Using Ham ( ConnorMcLeod's link ) would be more efficient.
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-28-2009 , 10:12   Re: How to Strip weapon correctly ??
Reply With Quote #7

There's also fm_strip_user_gun() in Fakemeta. But yeah, Ham's way is better.
__________________
hleV is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 01-28-2009 , 10:47   Re: How to Strip weapon correctly ??
Reply With Quote #8

Why is ham better tan FakeMeta?

I think Fakemeta is way more efficient.
BOYSplayCS is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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