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

Special effects on specific command


Post New Thread Reply   
 
Thread Tools Display Modes
generalmemer
Member
Join Date: Sep 2017
Old 02-21-2019 , 04:06   Re: Special effects on specific command
Reply With Quote #11

Quote:
Originally Posted by Natsheh View Post
PHP Code:
if( ~get_user_flags(id) & ADMIN_SLAY 
        return 
PLUGIN_HANDLED 

PHP Code:
if( !(get_user_flags(id) & ADMIN_SLAY) ) 
        return 
PLUGIN_HANDLED 
And what is the difference here? They work the same way and the way I do it is more readable
generalmemer is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-21-2019 , 05:04   Re: Special effects on specific command
Reply With Quote #12

No its not the same there u reversing the bits in the other hand I'm checking if user hasn't the flag. Which will check if there isn't match in the bits

Think about it ~ is a bits operator which reverse

Can you please explain how it's more readable?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-21-2019 at 05:11.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
generalmemer
Member
Join Date: Sep 2017
Old 02-21-2019 , 06:01   Re: Special effects on specific command
Reply With Quote #13

Quote:
Originally Posted by Natsheh View Post
No its not the same there u reversing the bits in the other hand I'm checking if user hasn't the flag. Which will check if there isn't match in the bits

Think about it ~ is a bits operator which reverse

Can you please explain how it's more readable?
Look, I dont care for the specifics. It is the same, they work exactly the same way
If the client doesn't have e flag it won't be executed, if client has it, it will be executed. So I don't see the issue..? My goal here was to help the op.
It's more readable since there's less of ((())) which is why I use it. In practice there's no dramatic difference which code is used since it works. This is not the plugin submissions section
generalmemer is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 02-21-2019 , 13:31   Re: Special effects on specific command
Reply With Quote #14

My bad, I completely forgot that I use a separate plugin for executing commands like amx_slay or amx_ban, so when I changed amx_slay to amx_ban, it did not actually work because I use a different plugin which kinda replaces admincmd, so instead of amx_ban name time reason, its amx_ban time #userid reason, unfortunately in this case it doesnt work, otherwise if I use admincmd, it does.
__________________

Last edited by SomewhereLost; 02-21-2019 at 22:49.
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-21-2019 , 21:10   Re: Special effects on specific command
Reply With Quote #15

Quote:
Originally Posted by Natsheh View Post
No its not the same there u reversing the bits in the other hand I'm checking if user hasn't the flag. Which will check if there isn't match in the bits

Think about it ~ is a bits operator which reverse

Can you please explain how it's more readable?
The only different between the two methods is that one returns a boolean and the other an integer. Otherwise, they are the same.
__________________
fysiks 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 19:28.


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