Raised This Month: $ Target: $400
 0% 

Solved Give access to menu, Small problem :)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-13-2017 , 15:42   Re: Give access to menu, Small problem :)
Reply With Quote #8

I don't really understand your error. Code does exactly what you tell it to, so the problem that it would print both messages is impossible. Unless you're sending the command twice.

I don't know of anything that would strip the flags unless you have conflicting plugins.

Code:
GiveAccess(id) {     if ( ! ( get_user_flags(id) & ACCESS_ADMIN_LEVEL ) )         return;     new player, body;     get_user_aiming(id, player, body);     if ( ! player || ! is_user_connected(player) )         return;     new szPlayerName[32]     get_user_name(player, szPlayerName, charsmax(szPlayerName));     new tempFlags = get_user_flags(player);     if ( tempFlags & ACCESS_ADMIN_LEVEL) {         client_print(id, print_chat, "%s %s has got access already.", Prefix, szPlayerName);         return;     }     set_user_flags(player, tempFlags & read_flags("u"));     client_print(player, print_chat, "%s You now have access. Enjoy!", Prefix);     client_print(id, print_chat, "%s %s has access now.", Prefix, szPlayerName); }
Just a side note: Keeping the code structure flat enables you to more easily handle different outcomes and understand the code.
__________________

Last edited by Black Rose; 02-13-2017 at 15:43.
Black Rose 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 21:01.


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