Raised This Month: $32 Target: $400
 8% 

Block pickup Secondary weapon only?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
headshot910
Member
Join Date: Apr 2012
Old 03-18-2020 , 06:20   Block pickup Secondary weapon only?
Reply With Quote #1

Hi is there any plugin that block pickup secondary only? I've search and only found block pickup all weapon. Thanks first!
__________________
Hi!
I'm here!
headshot910 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-18-2020 , 10:08   Re: Block pickup Secondary weapon only?
Reply With Quote #2

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)
__________________
HamletEagle is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-18-2020 , 17:53   Re: Block pickup Secondary weapon only?
Reply With Quote #3

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;

__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-18-2020 , 18:07   Re: Block pickup Secondary weapon only?
Reply With Quote #4

Entity is not a CSW_* index.
__________________
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 03-20-2020 , 11:53   Re: Block pickup Secondary weapon only?
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
Entity is not a CSW_* index.
Long time no see man

Here - cspum
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Reply


Thread Tools
Display Modes

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 01:31.


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