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

[CS:GO] Disabling weapon pickup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
manicogaming
AlliedModders Donor
Join Date: Aug 2014
Old 05-27-2023 , 15:45   [CS:GO] Disabling weapon pickup
Reply With Quote #1

I'm trying to make it so that a BOT can't pick up any other primary when they have the AWP and only pickup the AWP or AK-47 when they have the M4A1-S but this code that I wrote for it doesn't seem to work properly, is there anything I'm doing wrong?

PHP Code:
public Action OnWeaponCanUse(int clientint iWeapon)
{
    if(
eItems_GetWeaponSlotByWeapon(iWeapon) != CS_SLOT_PRIMARY)
        return 
Plugin_Continue;

    
int iPrimary GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY);
    if(!
IsValidEntity(iPrimary))
        return 
Plugin_Continue;
    
    
int iDroppedDefIndex GetEntProp(iWeaponProp_Send"m_iItemDefinitionIndex");
    
int iRifleDefIndex GetEntProp(iPrimaryProp_Send"m_iItemDefinitionIndex");
    
    if(
iRifleDefIndex == || (iRifleDefIndex == 60 && (iDroppedDefIndex != || iDroppedDefIndex != 7)))
        return 
Plugin_Handled
    
    return 
Plugin_Continue;

__________________
manicogaming is offline
Austin
Senior Member
Join Date: Oct 2005
Old 05-28-2023 , 18:03   Re: [CS:GO] Disabling weapon pickup
Reply With Quote #2

I don't know about your other logic,
but here is a working fucntion that keeps bots from using
weapon_healthshot

Maybe this can help you figure it out....
PHP Code:
public Action OnWeaponCanUse(int clientint weapon)
{
    
char weaponName[128];
    
GetEdictClassname(weaponweaponNamesizeof(weaponName));
    if (
strcmp(weaponName"weapon_healthshot") == 0)
        if (
IsFakeClient(client))
            return 
Plugin_Handled;
    return 
Plugin_Continue;

Austin is offline
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 14:44.


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