Raised This Month: $ Target: $400
 0% 

[SOLVED]C4 Pickup and touch vs WeapPickup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 01-13-2014 , 07:10   [SOLVED]C4 Pickup and touch vs WeapPickup
Reply With Quote #1

I have 2 things to ask
I have a problem when player is holding C4 and on ground is another C4 - it seems that player picked it up however, it doesn't show up in inventory as 2 C4's, so I assume there isn't a check like if player already has C4 like it is with other weapons - when you have primary weapon you can't pickup another primary weapon. So how to fix this - by adding check if user_has_weapon(id, CSW_C4) or making my own pickup code with conditions?

Second thing is register_touch versus WeapPickup event. I need to check if that weapon which is on ground has specific model, if yes give player true on having that item. So, which is better touch weaponbox with conditions or WeapPickup event?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 01-14-2014 at 18:22.
GuskiS is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-13-2014 , 08:15   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #2

1. I don't understand

2. You can find specific model. with register_touch:

PHP Code:
public fw_Touch(iEntiPlayer)
{
    new 
szModel[64];
    
entity_get_string(iEntEV_SZ_modelszModelsizeof szModel); //get model
    
    
if (equal(szModel"your model"//filtering model
    
{
        
//touch model
    
}

__________________
What are you looking for here?

Last edited by DavidJr; 01-13-2014 at 08:19.
DavidJr is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 01-13-2014 , 10:45   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #3

1. If you have C4 in your hands, and other C4 is dropped and you decide to pick it up - it disappears. It should stay there.
2. I know that already, thats why I asked which one to use, which is more effiecient.


EDIT: :O 23333 thread :O
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 01-13-2014 at 10:46.
GuskiS is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-13-2014 , 10:50   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #4

Ah, you want to make you have 2 C4?
__________________
What are you looking for here?
DavidJr is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2014 , 00:25   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #5

WeaponPickup is for sure better than hooking touch, but you come after the war, so if you want to block pickup you need to hook touch.

You can anyway hook touch to block that c4 bug (check if weaponbox contain c4 with pdata, not with model), and hook WeaponPickup for other stuff.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 01-14-2014 , 07:37   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #6

Quote:
Originally Posted by DavidJr View Post
Ah, you want to make you have 2 C4?
Yes.
Quote:
Originally Posted by ConnorMcLeod View Post
WeaponPickup is for sure better than hooking touch, but you come after the war, so if you want to block pickup you need to hook touch.

You can anyway hook touch to block that c4 bug (check if weaponbox contain c4 with pdata, not with model), and hook WeaponPickup for other stuff.
Well, about that blocking, I have simple check - if(g_hasc4[id]) return; but the weapon box still disappears :/ register_touch("weaponbox", "player", "Touch_C4");
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2014 , 07:39   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #7

return PLUGIN_HANDLED
__________________
Arkshine is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 01-14-2014 , 16:47   Re: C4 Pickup and touch vs WeapPickup
Reply With Quote #8

Can't seem to determine if ent is C4 from weaponbox. Found m_rgpPlayerItems_CWeaponBox[] but I don't know which is for C4. Also, I will use touch because why call one more event?

EDIT: Figured out the upper part.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 01-14-2014 at 17:45.
GuskiS 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 10:11.


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