AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Giving a player flags, somebody joins = flags are removed (https://forums.alliedmods.net/showthread.php?t=294133)

xTr3m3r 02-20-2017 13:43

Giving a player flags, somebody joins = flags are removed
 
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!

Natsheh 02-20-2017 16:01

Re: Giving a player flags, somebody joins = flags are removed
 
https://forums.alliedmods.net/showthread.php?t=107153

read... this .. .for blockmaker topics

xTr3m3r 02-20-2017 16:17

Re: Giving a player flags, somebody joins = flags are removed
 
Dude :D 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?

OciXCrom 02-20-2017 17:48

Re: Giving a player flags, somebody joins = flags are removed
 
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.

xTr3m3r 02-21-2017 01:28

Re: Giving a player flags, somebody joins = flags are removed
 
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 :D

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 


OciXCrom 02-21-2017 10:38

Re: Giving a player flags, somebody joins = flags are removed
 
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.


All times are GMT -4. The time now is 20:59.

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