Raised This Month: $51 Target: $400
 12% 

[STOCK] cs_drop_user_weapon


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-24-2016 , 13:53   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #11

Quote:
// Striping a nade. If the server is not using HamletEagle's Grenade Manager plugin, you always need to put "1"
// for bStrip when you deals with Nades, because nades cannot be just dropped, you really need to strip it.
Instead of such comment which will be confusing, he can use directly http://amxmodx.org/api/amxmodx/is_plugin_loaded and check if plugin is running. If not, set bStrip to 1 automatically.
Anyway, that's not requiered given this is a custom plugin, not part of amxx. It's his choice.
__________________

Last edited by HamletEagle; 07-24-2016 at 13:53.
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-24-2016 , 15:33   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #12

Quote:
Originally Posted by HamletEagle View Post
Instead of such comment which will be confusing, he can use directly http://amxmodx.org/api/amxmodx/is_plugin_loaded and check if plugin is running. If not, set bStrip to 1 automatically.
Anyway, that's not requiered given this is a custom plugin, not part of amxx. It's his choice.
I will wait next Sunday to having enough 'free-time' for reading all the addonzzz post )

Edit: About "szWeaponNameNoPrefix & maxchars" lol, i forgot to remove from main topic, wtf ... , i wass planing to add them, i added, then i change my mind and i forgot to fully remove them, sorry for this, it's my mistake.

Last edited by Craxor; 07-24-2016 at 15:35.
Craxor is offline
Send a message via ICQ to Craxor
FacuuMoran
Junior Member
Join Date: May 2015
Old 07-26-2016 , 10:07   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #13

If i am using knife and use this stock this work?
FacuuMoran is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-26-2016 , 11:01   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #14

No.
__________________
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-26-2016 , 15:01   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #15

Quote:
Originally Posted by FacuuMoran View Post
If i am using knife and use this stock this work?
This works, but is very unstable, just open CsDrop.inc and read it.

( Note: This not only contain the stock cs_drop_user_weapon but also enable drop knife/nades even when a players using "drop" command. Edit: I also added a forward, open and read CsDrop.inc )

Edit: Or you can just use the stock from the first post with the 3rd parameter as "1" to strip the knife:
Code:
cs_drop_user_weapon( id, "weapon_knife", 1 );

Edit2: For everyone who may note that version can be on future more outdated than the first one ( From the first topic ) That's the only version i made in a plugin, i prefer to work more on the stock, so i wil no more update-upgrade this version, thanks.
Attached Files
File Type: zip CsDrop.zip (1.9 KB, 95 views)

Last edited by Craxor; 07-30-2016 at 22:36.
Craxor is offline
Send a message via ICQ to Craxor
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-26-2016 , 16:06   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #16

@Craxor you can do that without an additional plugin.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-27-2016 , 01:43   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #17

Quote:
Originally Posted by PRoSToTeM@ View Post
@Craxor you can do that without an additional plugin.
'Additional' ?

Anyway, i know it, do you talking about the 'Hamlet method' he thold me, but is usseless coding a whole stock when users can just use his plugin, anyway, if you know a better method, tel me about.

------------------
Edit
------------------

I just read addons_zz post, so addons, here you go:

1# -> I will just change to "can't".

I will just let my description with striping, no need to talk about Hamlet Grenade Manager plugin in the first topic, as i discused everywhere in this thread.


2# - > And if i'm declaring outside of the if? Who told you is realy necesary to declare INSIDE ?

@ As you see, that's i'm doing also in give_user_weapon stock, and working realy fine ;) .


3# - > My mistake, sorry for this, i forgot to remove at all, thanks for reminder

4# - > It can. give_item() wich "default" parameter have :-P ?


5# -> I will add a shourtly description.
( About true/false - > NO! )
6# - > No. ( maybe just for szWeaponName[] ).

7# - > Not realy need as is not an 'Official' stock, just a public one made by a user ( My ) , so i can put any description i want, a easy-to-understand one will be enough.

Thanks for your time!

Last edited by Craxor; 07-27-2016 at 02:30.
Craxor is offline
Send a message via ICQ to Craxor
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-27-2016 , 14:06   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #18

@Craxor I mean you can do this without your "CSDrop Library", directly in include file.
PHP Code:
static HamHook:knifeDropHook 0;
if (!
knifeDropHook) {
    
knifeDropHook RegisterHam(Ham_CS_Item_CanDrop"weapon_knife""__CsDropInc_OnKnifeCanDrop");
    
DisableHamForward(knifeDropHook);
}
// some code...
EnableHamForward(knifeDropHook);
// emulate drop command
DisableHamForward(knifeDropHook); 
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 07-27-2016 , 14:40   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #19

Quote:
Originally Posted by Craxor View Post
I will just let my description with striping, no need to talk about Hamlet Grenade Manager plugin in the first topic, as i discused everywhere in this thread.
Good point.

Quote:
Originally Posted by Craxor View Post
2# - > And if i'm declaring outside of the if? Who told you is realy necesary to declare INSIDE ?

@ As you see, that's i'm doing also in give_user_weapon stock, and working realy fine ;) .
There is not problem doing it. The difference is when you do not enter the if, it will not create the variable.
On this case the code performance is completely irrelevant, just a good practice. It is up to you (the coder).



Quote:
Originally Posted by Craxor View Post
4# - > It can. give_item() wich "default" parameter have :-P ?
It cannot, because if 'szWeaponName' is not a valid weapon, 'get_weaponid' will return 0, and it will not pass on your if check 'if( ( 0 < WeaponId < 30 ) && ...'
Also, this is an example where the variable 'const NadeBits' is created but not used.

Quote:
Originally Posted by Craxor View Post
5# ...
( About true/false - > NO! )


Ok, it is up to you (the coder).

Quote:
Originally Posted by Craxor View Post
Thanks for your time!
You are welcome.


Update:

Code:
@return: Weapon Entity ID.
Could be:
Code:
@return: The Weapon Entity ID on success, 0 on failure.
But usually is used a negative value for failure and 0 or more for success, then:
Code:
new wEnt , WeaponId = get_weaponid( szWeaponName );
-->
Code:
new wEnt = -1; new WeaponId = get_weaponid( szWeaponName );
But it is upper to the coder to do it or not. So, sit as you like.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 07-27-2016 at 15:09. Reason: update
addons_zz is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 07-27-2016 , 15:11   Re: [STOCK] cs_drop_user_weapon
Reply With Quote #20

o.k. i will re-think about some of them.

Last edited by Craxor; 07-27-2016 at 15:12.
Craxor is offline
Send a message via ICQ to Craxor
Reply



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 08:05.


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