AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]C4 Pickup and touch vs WeapPickup (https://forums.alliedmods.net/showthread.php?t=233333)

GuskiS 01-13-2014 07:10

[SOLVED]C4 Pickup and touch vs WeapPickup
 
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?

DavidJr 01-13-2014 08:15

Re: C4 Pickup and touch vs WeapPickup
 
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
    
}



GuskiS 01-13-2014 10:45

Re: C4 Pickup and touch vs WeapPickup
 
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

DavidJr 01-13-2014 10:50

Re: C4 Pickup and touch vs WeapPickup
 
Ah, you want to make you have 2 C4?

ConnorMcLeod 01-14-2014 00:25

Re: C4 Pickup and touch vs WeapPickup
 
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.

GuskiS 01-14-2014 07:37

Re: C4 Pickup and touch vs WeapPickup
 
Quote:

Originally Posted by DavidJr (Post 2085380)
Ah, you want to make you have 2 C4?

Yes.
Quote:

Originally Posted by ConnorMcLeod (Post 2085645)
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");

Arkshine 01-14-2014 07:39

Re: C4 Pickup and touch vs WeapPickup
 
return PLUGIN_HANDLED

GuskiS 01-14-2014 16:47

Re: C4 Pickup and touch vs WeapPickup
 
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.


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

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