AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Block pickup Secondary weapon only? (https://forums.alliedmods.net/showthread.php?t=322166)

headshot910 03-18-2020 06:20

Block pickup Secondary weapon only?
 
Hi is there any plugin that block pickup secondary only? I've search and only found block pickup all weapon. Thanks first!
:D :D :D

HamletEagle 03-18-2020 10:08

Re: Block pickup Secondary weapon only?
 
Yes. Hook touch with weaponbox, retrieve the weapon entity index inside that box, get the weapon id from the weapon entity index and finally check if it's a secondary weapon by comparing it with the ids of all secondary weapons.

(I'm aware this is suggestions/requests and not scripting help)

bibu 03-18-2020 17:53

Re: Block pickup Secondary weapon only?
 
Try this:

PHP Code:

#include <amxmodx>
#include <engine>
 
public plugin_init()
{
        
register_plugin("Block Secondary Weapon Pickup""1.0""AMXX Community");
 
        
register_touch("weaponbox""player""BlockPickup");
        
register_touch("armoury_entity""player""BlockPickup");
        
register_touch("weapon_shield""player""BlockPickup");
}
 
public 
BlockPickup(Entity/*, Client*/)
        return (
WeaponGroup(Entity) == 2) ? PLUGIN_HANDLED PLUGIN_CONTINUE;  

public 
WeaponGroup(iWeapID)
{
    
//primary returns 1, secondary returns 2
    
switch (iWeapID)
    {
        case 
CSW_SCOUT,CSW_XM1014,CSW_MAC10CSW_AUGCSW_UMP45,CSW_SG550,CSW_GALIL,CSW_FAMAS,CSW_AWP,CSW_MP5NAVY,CSW_M249,CSW_M3CSW_M4A1,CSW_TMP,CSW_G3SG1,CSW_SG552,CSW_AK47,CSW_P90: return 1;
        case 
CSW_P228CSW_ELITECSW_FIVESEVENCSW_USPCSW_GLOCK18CSW_DEAGLE: return 2;
    }
    
    return 
0;



HamletEagle 03-18-2020 18:07

Re: Block pickup Secondary weapon only?
 
Entity is not a CSW_* index.

Craxor 03-20-2020 11:53

Re: Block pickup Secondary weapon only?
 
Quote:

Originally Posted by HamletEagle (Post 2687526)
Entity is not a CSW_* index.

Long time no see man :)

Here - cspum


All times are GMT -4. The time now is 13:16.

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