Raised This Month: $ Target: $400
 0% 

Solved Admin flags are being ignored


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-05-2021 , 00:21   Re: Admin flags are being ignored
Reply With Quote #11

Quote:
Originally Posted by SaBBa View Post
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
While not directly related (but could be based on how you use the SteamID), note that a player won't have a SteamID until client_authorized() is called. This doesn't get called in any specific order relative to client_connect() and client_putinserver(). For initializing variables, client_connect() should be enough.

If your intention is to check for "user is not an admin" you might consider using: !is_user_admin(killer).
__________________

Last edited by fysiks; 01-05-2021 at 00:28.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-05-2021 , 09:16   Re: Admin flags are being ignored
Reply With Quote #12

To add.. if you care about only the player not having ADMIN_USER then is_user_admin() will cover this. If you care about specific flag(s), you will need to do something like what I posted.
__________________
Bugsy is offline
SaBBa
Member
Join Date: Dec 2012
Old 01-05-2021 , 18:29   Re: Admin flags are being ignored
Reply With Quote #13

Thanks a lot

I don't know much in pawn, so, code must be horrible, but what can I improve, I mean, how can I increase it's stability. I think currently it looks like written by 2 yo kid.

Last edited by SaBBa; 01-05-2021 at 23:25.
SaBBa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-05-2021 , 22:58   Re: Admin flags are being ignored
Reply With Quote #14

I gave you advice for fixing an error in your code already but you didn't implement it yet. Other than that, as you keep writing code and looking at other plugins, you'll gain experience with improving your code.
__________________
fysiks is offline
SaBBa
Member
Join Date: Dec 2012
Old 01-05-2021 , 23:28   Re: Admin flags are being ignored
Reply With Quote #15

I didn't understand it properly, but like that will be good right ?

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

SaBBa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-05-2021 , 23:31   Re: Admin flags are being ignored
Reply With Quote #16

Yes, that will work.
__________________

Last edited by fysiks; 01-05-2021 at 23:31.
fysiks 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