Raised This Month: $ Target: $400
 0% 

Solved no chance for me to understand bits


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-15-2022 , 10:25   Re: no chance for me to understand bits
Reply With Quote #1

your solution is to shift the wpn depending on the weapon ID

So your function should be as following.

PHP Code:
/** I'm asking about this method */
get_weapon_slot(wpn)
{
    
wpn = (1<<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;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 11-15-2022 , 10:39   Re: no chance for me to understand bits
Reply With Quote #2

Quote:
Originally Posted by Natsheh View Post
your solution is to shift the wpn depending on the weapon ID

So your function should be as following.

PHP Code:
/** I'm asking about this method */
get_weapon_slot(wpn)
{
    
wpn = (1<<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;

bruh... That's it? I forgot it's not shifted. Thank you
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
Reply



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