Raised This Month: $ Target: $400
 0% 

Solved no chance for me to understand bits


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 11-15-2022 , 09:22   no chance for me to understand bits
Reply With Quote #1

Hi. Why does this method not work? When I pass any CSW_* constant, it returns me *not* random numbers but they're wrong.
Did I do something wrong?
Testing code:
PHP Code:
#include amxmodx
#include cstrike_const

const CSW_PRIMARY   = (CSW_ALL_SHOTGUNS CSW_ALL_SMGS CSW_ALL_RIFLES CSW_ALL_SNIPERRIFLES CSW_ALL_MACHINEGUNS);
const 
CSW_SECONDARY = (CSW_ALL_PISTOLS);
const 
CSW_GRENADES  = (CSW_ALL_GRENADES);

public 
plugin_init()
{
    new 
slotcachedszWeaponName[32];

    for(new 
wpn CSW_P228wpn <= CSW_P90wpn++)
    {
        
cached wpn;

        if(
get_weaponname(cachedszWeaponNamecharsmax(szWeaponName)))
        {
            
slot get_weapon_slot(cached);
            
console_print(0"%i :: %s :: Slot: %i"cachedszWeaponNameslot);
        }
    }
}

/** I'm asking about this method */
public get_weapon_slot(wpn)
{
    if(
wpn CSW_PRIMARY)   return CS_WEAPONSLOT_PRIMARY;
    if(
wpn CSW_SECONDARY) return CS_WEAPONSLOT_SECONDARY;
    if(
wpn CSW_KNIFE)     return CS_WEAPONSLOT_KNIFE;
    if(
wpn CSW_GRENADES)  return CS_WEAPONSLOT_GRENADE;
    return 
0;

Output:
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 11-15-2022 at 10:39.
kww is offline
 


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 15:38.


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