Raised This Month: $ Target: $400
 0% 

Giving a player flags, somebody joins = flags are removed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xTr3m3r
Member
Join Date: Feb 2010
Old 02-20-2017 , 13:43   Giving a player flags, somebody joins = flags are removed
Reply With Quote #1

So I have an issue and I found why it happens but Im not sure how do I fix it.

With the code below I can give someone the flag U so he can use the blockmaker on my server and when I write amx_who his flags are U and Z. It works.. but whenever somebody joins the server who has got no flags except Z (which is the default player flag as you know) the U flag I have given to the player disappears and then when I write amx_who again - he has only Z flag left. My question is: Do I have to remove the Z flag from the player first and then give him U flag, so when anybody joins the server it wont think that the player I gave the U flag is just a default player and his U flag will remain or is there another way I can fix this?

PHP Code:
GiveBlockMakerAccess(id) {

    if ( ! ( 
get_user_flags(id) & BM_ADMIN_LEVEL2 ) )
        return;

    new 
playerbody;
    
get_user_aiming(idplayerbody);

    if ( ! 
player || ! is_user_connected(player) )
        return;

    new 
szPlayerName[32];
    
get_user_name(playerszPlayerNamecharsmax(szPlayerName));

    new 
tempFlags get_user_flags(player);

    if ( 
tempFlags BM_ADMIN_LEVEL) {
        
client_print(idprint_chat"%s %s has got BlockMaker access already."gszPrefixszPlayerName);
        return;
    }

    
set_user_flags(playerread_flags("u"));

    
client_print(playerprint_chat"%s You now have BlockMaker access. Enjoy!"gszPrefix);
    
client_print(idprint_chat"%s %s has BlockMaker access now."gszPrefixszPlayerName);

Thanks in advance!
xTr3m3r is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-20-2017 , 16:01   Re: Giving a player flags, somebody joins = flags are removed
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=107153

read... this .. .for blockmaker topics
__________________
@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-20-2017 at 16:01.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
xTr3m3r
Member
Join Date: Feb 2010
Old 02-20-2017 , 16:17   Re: Giving a player flags, somebody joins = flags are removed
Reply With Quote #3

Dude Im not asking you to code my bm, Im asking you guys to tell me how do i fix an 'error'. This can be used in any other plugin as well. Thats not a blockmaker topic, its about giving rights, it just happens to be included in the blockmaker im using.

EDIT:

PHP Code:
GiveAccess(id) { 

    if ( ! ( 
get_user_flags(id) & ADMIN_LEVEL2 ) ) 
        return; 

    new 
playerbody
    
get_user_aiming(idplayerbody); 

    if ( ! 
player || ! is_user_connected(player) ) 
        return; 

    new 
szPlayerName[32]; 
    
get_user_name(playerszPlayerNamecharsmax(szPlayerName)); 

    new 
tempFlags get_user_flags(player); 

    if ( 
tempFlags ADMIN_LEVEL) { 
        
client_print(idprint_chat"%s %s has got access already."gszPrefixszPlayerName); 
        return; 
    } 

    
set_user_flags(playerread_flags("u")); 

    
client_print(playerprint_chat"%s You now have access. Enjoy!"gszPrefix); 
    
client_print(idprint_chat"%s %s has access now."gszPrefixszPlayerName); 

Can you help me now?

Last edited by xTr3m3r; 02-20-2017 at 16:21.
xTr3m3r is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-20-2017 , 17:48   Re: Giving a player flags, somebody joins = flags are removed
Reply With Quote #4

There's no reason for that to happen. The problem is from a plugin you're using. I think that happen when amx_reloadadmins is used, so some plugin may be executing it in a bad time.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
xTr3m3r
Member
Join Date: Feb 2010
Old 02-21-2017 , 01:28   Re: Giving a player flags, somebody joins = flags are removed
Reply With Quote #5

I removed every plugin im using (except from amxx) and it still happens.

EDIT:
Okay, I found this in admin.sma

PHP Code:
public cmdReload(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    
//strip original flags (patch submitted by mrhunt)
    
remove_user_flags(0read_flags("z"))
    
    
admins_flush();
// some more code here 
In remove_user_flags I should make the 0 to id I guess, and should I remove the admins_flush(), what do you think, guys?

EDIT 2: that has nothing to do with the issue

EDIT 3: My plugins:

PHP Code:
;PROTECTIONS!!! DO NOT DELETE!!!!!!
fullupdate.amxx
autobuyfix_connor
.amxx
anti_fullupdate
.amxx
fast_fix_hashsign
.amxx
nickfix
.amxx
;END OF PROTECTIONS ^^^^ DO NOT DELETE!  (I have no idea what are these aboutits from the host im using)

hidenseek.amxx
Bm
.amxx
;allchat.amxx
rules
.amxx
;sbtitle.amxx
land_reality
.amxx debug
firehole
.amxx
;traps.amxx
auto_join_on_connect
.amxx
Anti_Jointeam
.amxx
player_gag
.amxx
frostnades
.amxx
demo
.amxx
pain_shock_free
.amxx
antiflood
.amxx
reloadshit
.amxx
colorchat
.amxx
resetscore
.amxx
Swap_Spawn_Points
.amxx
nademodes
.amxx
stuck
.amxx
galileo
.amxx debug
startspawn
.amxx

pluginmenu
.amxx
messages
.amxx
admin
.amxx
admincmd
.amxx
slots_reservation
.amxx
menufront
.amxx
plmenu
.amxx    
adminchat
.amxx    
timeleft
.amxx 

Last edited by xTr3m3r; 02-21-2017 at 06:46.
xTr3m3r is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-21-2017 , 10:38   Re: Giving a player flags, somebody joins = flags are removed
Reply With Quote #6

Of course it has something do to with it. The amx_reloadadmins resets all flags and some plugin you're using is executing that command when a player connects.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 20:59.


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