[STOCK] give_user_weapon
Give User Weapon
This is pro-variant of default native give_item() What's the difference between mine and default one?
Authors Craxor and Bugsy. OverView Code:
Function
Spoiler
Required modules: CStrike, Engine, Fun. Usage Example: Code:
// Give to a index a deagle with 1 clip and 0 back pack ammo in stock. Code:
// Give to a index 10 hegrenades:
Credit's: HamletEagle(for idea get_weaponname and remove lot of switchs) Nubo, Lux0r - some little modifications Bugsy - a lot of things and rewrite the code with lot of optimization's AMX Mod Dev(i forgot he help me with old code) addons_zz( Parameter's doc help ) Changelog: 1.0: First realease. 1.1: Return the CSW_ Weapon ID 1.2: Bugsy: code cleaning/optimization. 1.3: Bugsy: Added grenade support. 1.4: Added C4 support. 1.5: Bugsy&Craxor: Added Weapon Name support, bomb icon, can skip Clip parameter if is grenade. 1.6: Removed uppercase first char, re-write weapon name code, etc, etc ... 1.7: Removed redundant if/else, use "?" comparator. 1.8: Bugsy update. 1.9: Bugsy added an condition for filltering attempt of giving ammo/bpammo to a knife. |
Re: [STOCK] give_user_weapon
give_item() return weapon entity index, no need to search it.
Code:
new weapon = give_item( index, wp_id ); |
Re: [STOCK] give_user_weapon
question, does the clip capacity resets after reloading?
|
Re: [STOCK] give_user_weapon
@Mistick - This isn't work in 1nd case, if user has weapon -> if use give_item to retrieve weapon index this will give me an bpammo error, only on else{} statement can be done.
@Depresie - I'm not shourt i understand what you wanna say, if i reload weapon it will give me exactly Clip of Weapon you give with give_user_weapon? Answer is NO. it will give you default clip of weapon it have Edit: I just use give_item in else{} statement and working fine, but in first cond(if user have the weapon you wanna give) it throw errors, so i will let as it is. Edit2: Remover .inc file from attach, members can directly copy the stock into they plugins. |
Re: [STOCK] give_user_weapon
I made a few tweaks to it.
PHP Code:
|
Re: [STOCK] give_user_weapon
Bugsy, thanks for code cleaning and optimization i will post in first topic :D
Edit: Your stock doesn't support CSW_HE/FL/SK if i'm right no? I will add info in first topic. |
Re: [STOCK] give_user_weapon
I fixed it to make it work with grenades. The problem is/was that you only want to set bpammo for grenades, not weapon ammo.
|
Re: [STOCK] give_user_weapon
Tested and work fine, for giving a nade you need to do that:
// Example, give 10 hegrenades to a index: Code:
give_user_weapon( id, CSW_HEGRENADE, _, 10); Code:
give_user_weapon( index , iWeaponTypeID , iClip=0 , iBPAmmo=0 ) |
Re: [STOCK] give_user_weapon
Looks good, I changed the following:
PHP Code:
|
Re: [STOCK] give_user_weapon
Note:
Edit: Just a problem, if you want take the name of hegrenade/sk/fl or c4, you should do something like that: Code:
You need to skip an parameter ( "iClip" ), as is not used. ( Only on Hegrenade, FlashBang,Smokegrenade & C4 ) |
All times are GMT -4. The time now is 09:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.