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

[SOLVED]Drop / Pickup Grenades


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-10-2016 , 14:42   [SOLVED]Drop / Pickup Grenades
Reply With Quote #1

Is there a way to store a custom value in pev_iuser for a weapon ( when it is dropped ) and then retrieve it when it is picked up without hooking touch ?

For example i want to make the grenades drop, and i want to store in the pev_iuser the bpammo, then retrieve the bpammo when the grenade is picked up

I was thinking to set the bpammo to the entity on FM_SetModel, but i don't know how to retrieve the bpammo when it is picked up ( other than touch )
__________________

Last edited by Depresie; 12-10-2016 at 14:43.
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-10-2016 , 15:48   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #2

What are you trying to do?
__________________
HamletEagle is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-10-2016 , 17:42   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #3

I made the grenades drop via HamCanDrop, but there is a problem regarding the bpammo
For example if i have 5 he grenades and i drop the he, when a player picks it up he gets just one

I am trying to save the grenade's bpammo in an unused field such as pev_iuser1 and then to retrieve the bpammo when the ent is picked up...
__________________
Depresie is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-10-2016 , 20:23   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #4

Multiple ways to do this.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta>

const GRENADE_BITS = ( ( << CSW_HEGRENADE ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_FLASHBANG ) );

public 
plugin_init() 
{
    
RegisterHamHam_AddPlayerItem "player" "HamAddPlayerItem" );
}

public 
HamAddPlayerItemiPlayer iEntity )
{
    new 
iWeaponID;
    
    if ( 
GRENADE_BITS & ( << ( iWeaponID cs_get_weapon_idiEntity ) ) ) )
    {
        
//This would be done on drop, I'm doing it here for demonstration.
        
set_peviEntity pev_iuser1 );

        
cs_set_user_bpammoiPlayer iWeaponID peviEntity pev_iuser1 ) );
    }

__________________

Last edited by Bugsy; 12-10-2016 at 20:53.
Bugsy is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-10-2016 , 23:14   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #5

The problem is that the entity from drop, is not the same entity as the one from AddPlayerItem ( At least it wasn't today when i was testing ) entity index didn't match
__________________
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2016 , 04:26   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #6

You could just use my Grenade Manager plugin. If you don't want to, I may try to post a snippet without okapi. I remember that dropping grenades properly is a pain, game gets buggy.
__________________

Last edited by HamletEagle; 12-11-2016 at 04:27.
HamletEagle is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-11-2016 , 07:44   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #7

I would like to do it without okapi or orpheu..
What do you mean by game gets buggy ? are there any other side effects than the bpammo issue ?

Dropping is done easy, retrieving the bpammo is a little pain in the ass, since i don't want to register a touch just for that... if i do register touch, then i'd rather create handle everything manually ( i.e create custom entity )
__________________

Last edited by Depresie; 12-11-2016 at 07:45.
Depresie is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 12-11-2016 , 08:36   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #8

Just check Grenade Manager plugin, you cand find there the way you can do it.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-11-2016 , 08:36   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #9

Just to make it clear for me, you give let's say 5 he grenades to a player. When he drops it, and someone picks up the entity, it should give one or 5 hegrenades?
__________________

Last edited by HamletEagle; 12-11-2016 at 08:38.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-11-2016 , 08:40   Re: [HELP] Drop / Pickup Grenades
Reply With Quote #10

He wants to drop all off the person's bpammo for that grenade when dropped. When this grenade is picked up, he wants the person to get the bpammo value.
__________________
Bugsy is offline
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 19:19.


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