 |
|
Member
|

02-14-2017
, 01:16
Re: Give access to menu, Small problem :)
|
#9
|
Quote:
Originally Posted by Black Rose
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.
|
Works perfectly. Thanks!
Last edited by xTr3m3r; 02-14-2017 at 01:16.
|
|
|
|