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

admin_reservation flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
]FUSION[ Gray Death
Member
Join Date: Mar 2004
Location: Hamburg / Germany
Old 03-27-2004 , 08:37   admin_reservation flag
Reply With Quote #1

While changing my plugins I run into some problems, that shouldn't be to difficult to fix. But I don't get it.

Simple code:

for(i = 0 ;i < inum; ++i) {
if(get_user_flags(players[i]) && ADMIN_RESERVATION) admins++
}

So it should only count the number of players with a "b" accesslevel, right? Instead it counts everyone on the server.
]FUSION[ Gray Death is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-27-2004 , 08:41  
Reply With Quote #2

The access flags use Bit-Wise operators, so use:
if(get_user_flags(players[i]) & ADMIN_RESERVATION) admins++


Notice only a single '&' operator??

& = Bitwise AND operation
&& = Comparison AND operation
xeroblood is offline
Send a message via MSN to xeroblood
]FUSION[ Gray Death
Member
Join Date: Mar 2004
Location: Hamburg / Germany
Old 03-27-2004 , 08:47  
Reply With Quote #3

Nice. As simple as I hoped. Was used to another meaning of & and && . Thanks a lot.
]FUSION[ Gray Death is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-27-2004 , 10:10  
Reply With Quote #4

np!! gotta love simple answers!! Glad I could help!
xeroblood is offline
Send a message via MSN to xeroblood
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 22:52.


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