Raised This Month: $ Target: $400
 0% 

Solved Admin flags are being ignored


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SaBBa
Member
Join Date: Dec 2012
Old 01-04-2021 , 14:32   Admin flags are being ignored
Reply With Quote #1

This is the only place in my code, where g_iKills and g_iInfections increase.
In mostly it works good, but, sometimes admin player is getting his kills increased, what could be a reason ?

Code:
public EventDeathMsg()
{
    if(!(tournament))
        return PLUGIN_HANDLED

    new killer = read_data(1)
    new victim = read_data(2)

    if(!(is_user_valide(victim)) || !(is_user_valide(killer)))
        return PLUGIN_HANDLED

    if(killer == victim)
        return PLUGIN_HANDLED

    if(~get_user_flags(killer) & ADMIN_USER)
        return PLUGIN_HANDLED

    if(zp_get_user_zombie(killer)) {
        g_iInfections[killer]++
        return PLUGIN_HANDLED
    }

    g_iKills[killer]++
    return PLUGIN_HANDLED
}

Last edited by SaBBa; 01-04-2021 at 17:52.
SaBBa is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2021 , 14:37   Re: Admin flags are being ignored
Reply With Quote #2

Code:
    if(~get_user_flags(killer) & ADMIN_USER)         return PLUGIN_HANDLED

simple don't give them admin flags with the flag z....
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2021 at 14:37.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SaBBa
Member
Join Date: Dec 2012
Old 01-04-2021 , 14:42   Re: Admin flags are being ignored
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Code:
    if(~get_user_flags(killer) & ADMIN_USER)         return PLUGIN_HANDLED

simple don't give them admin flags with the flag z....
that guy had "bceijmprst" flags, he got 2 of his kills counted, others got ignore, how is this even possible?
SaBBa is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2021 , 14:47   Re: Admin flags are being ignored
Reply With Quote #4

post the full code....

and post what the ADMIN_USER is defined for you...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2021 at 14:48.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SaBBa
Member
Join Date: Dec 2012
Old 01-04-2021 , 14:49   Re: Admin flags are being ignored
Reply With Quote #5

### Censored ###

Last edited by SaBBa; 01-04-2021 at 15:19.
SaBBa is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2021 , 15:01   Re: Admin flags are being ignored
Reply With Quote #6

i don't know the code seems to be fine, but i'd recommend resetting those player-variables on client putinserver.

Code:
public client_putinserver(id) {     get_user_name(id, Name[id], charsmax(Name[]))     get_user_authid(id, SteamID[id], charsmax(SteamID[]))     g_iKills[id] = 0;                    // <-----------     g_iInfections[id] = 0;            // <----------- }


if you're still experiencing some issues try changing the logic of this code.

PHP Code:
    if(~get_user_flags(killer) & ADMIN_USER)
        return 
PLUGIN_HANDLED 
into this

PHP Code:
    if((~get_user_flags(killer) & ADMIN_USER) > 0)
        return 
PLUGIN_HANDLED 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2021 at 15:07.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SaBBa
Member
Join Date: Dec 2012
Old 01-04-2021 , 15:15   Re: Admin flags are being ignored
Reply With Quote #7

hhhh, I will try to following:

replace client_putinserver with client_connect add client_disconnected and set values to 0
probably he joined with same ID, after someone left and he got his score, dunno, maybe, I will try
like

PHP Code:
public client_connect(id)
{
    
get_user_name(idName[id], charsmax(Name[]))
    
get_user_authid(idSteamID[id], charsmax(SteamID[]))
    
g_iKills[id] = 0;
    
g_iInfections[id] = 0;
}
public 
client_disconnected(id)
{
    
g_iKills[id] = 0;
    
g_iInfections[id] = 0;

PHP Code:
 if((~get_user_flags(killer) & ADMIN_USER) > 0
I don't think that changing this will affect anything

Last edited by SaBBa; 01-04-2021 at 15:18.
SaBBa is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2021 , 15:33   Re: Admin flags are being ignored
Reply With Quote #8

there's no need to use client_disconnect and client_putinserver, either just use on of them, you're just going to reset them twice when there's no need to.

client_putinserver should work fine there're no problems with using it..



Quote:
I don't think that changing this will affect anything
well it depends on the logic that the compiler is using.

you're returning bitsum values and not 1 or 0 the logic values, which it might fails , it will be safer to just use the logic operators instead of just using the bitsum operators.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2021 at 15:37.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SaBBa
Member
Join Date: Dec 2012
Old 01-04-2021 , 15:55   Re: Admin flags are being ignored
Reply With Quote #9

ok, thanks for your help
SaBBa is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-04-2021 , 22:04   Re: Admin flags are being ignored
Reply With Quote #10

Maybe use simpler bit conditions (IMO) if this is the root of your problem

PHP Code:
//To check for 1 flag
if ( get_user_flags(killer) & ADMIN_SLAY 
{
     
//User has ADMIN_SLAY 
}

if ( !( 
get_user_flags(killer) & ADMIN_SLAY ) ) 
{
     
//User does not have ADMIN_SLAY 
}

//To check for 1 or more flags
const FlagsToCheck ADMIN_SLAY ADMIN_KICK ADMIN_BAN;

if ( ( 
get_user_flags(killer) & FlagsToCheck ) == FlagsToCheck 
{
     
//User has all flags
}

if ( 
get_user_flags(killer) & FlagsToCheck 
{
     
//User has at least one of the flags... they could also have all of the flags.

__________________
Bugsy is offline
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 14:07.


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