Raised This Month: $ Target: $400
 0% 

Set user flags from const...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-22-2013 , 08:22   Re: Set user flags from const...
Reply With Quote #2

It won't, first off these are constants not strings and secondly you can't use array in the set_user_flags native.

Code:
new const FreeFlags[ ] = { ADMIN_IMMUNITY, ADMIN_RESERVATION, ADMIN_CHAT } public somefunction( id ) {       new iFlags       for( new i; i < sizeof FreeFlags; i ++ ) iFlags = iFlags | FreeFlags[ i ]       set_user_flags( id, iFlags ) }
Probably can be done better than using a loop but I have no idea about bitwise operators

Or a better way:

Code:
new const FreeFlags = ADMIN_IMMUNITY | ADMIN_RESERVATION | ADMIN_CHAT public somefunction( id ) {      set_user_flags( id, FreeFlags ) }

Last edited by Backstabnoob; 04-22-2013 at 08:25.
Backstabnoob is offline
 



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 10:56.


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