Raised This Month: $ Target: $400
 0% 

Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StR_Marian
Member
Join Date: Apr 2017
Old 04-24-2017 , 17:10   Help
Reply With Quote #1

Hei guys how can i search if are admins online ? and if not how to make a command work only if no admin is online can you guys give me an example?
StR_Marian is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-24-2017 , 18:25   Re: Help
Reply With Quote #2

Very simple. Create a bool and loop all connected players. If one of them is an admin, set that bool to true. Then use the bool inside the command.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
StR_Marian
Member
Join Date: Apr 2017
Old 04-24-2017 , 19:38   Re: Help
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Very simple. Create a bool and loop all connected players. If one of them is an admin, set that bool to true. Then use the bool inside the command.
i did , thx it worked but i have a question

why this isn't working ? it suposed to set g_Owner = 1 to every admin connects but it's not working any idea why?

PHP Code:
public client_connect(id)
{
   
hasdemo[id] = false;
   if(
get_user_admin(id))
   {
      
g_Owner[id] = 1;
   }

StR_Marian is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-24-2017 , 19:42   Re: Help
Reply With Quote #4

PHP Code:
if(get_user_admin(id)) 


PHP Code:
if( is_user_adminid ) ) 
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
StR_Marian
Member
Join Date: Apr 2017
Old 04-24-2017 , 19:50   Re: Help
Reply With Quote #5

Quote:
Originally Posted by wickedd View Post
PHP Code:
if(get_user_admin(id)) 


PHP Code:
if( is_user_adminid ) ) 
nope, still not working any another idea?
StR_Marian is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-24-2017 , 19:52   Re: Help
Reply With Quote #6

Well you need to show your code.

Edit: Try using client_putinserver or client_authorized
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 04-24-2017 at 19:55.
wickedd is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-24-2017 , 20:00   Re: Help
Reply With Quote #7

PHP Code:
new iAdminsNumbIsAdminOn 
PHP Code:
public client_putinserver(id)
{
    if(
is_user_admin(id))
    {
       
iAdminsNum++
       
bIsAdminOn true
    
}

PHP Code:
public client_disconnect(id)
{
     if(
is_user_admin(id))
     {
         
iAdminsNum--
         if(
iAdminsNum <= 0)
         {
             
bIsAdminOn false
         
}
     }

And use at anywhere you want:

PHP Code:
if(bIsAdminOn)
{
    
//blablabla

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-24-2017 at 20:04.
EFFx is offline
StR_Marian
Member
Join Date: Apr 2017
Old 04-24-2017 , 20:34   Re: Help
Reply With Quote #8

Quote:
Originally Posted by EFFx View Post
PHP Code:
new iAdminsNumbIsAdminOn 
PHP Code:
public client_putinserver(id)
{
    if(
is_user_admin(id))
    {
       
iAdminsNum++
       
bIsAdminOn true
    
}

PHP Code:
public client_disconnect(id)
{
     if(
is_user_admin(id))
     {
         
iAdminsNum--
         if(
iAdminsNum <= 0)
         {
             
bIsAdminOn false
         
}
     }

And use at anywhere you want:

PHP Code:
if(bIsAdminOn)
{
    
//blablabla

worked fine thx

Last edited by StR_Marian; 04-24-2017 at 21:16.
StR_Marian is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2017 , 23:10   Re: Help
Reply With Quote #9

PHP Code:
new g_Admins;

public 
client_putinserverid )
{
    
g_Admins |= ( is_user_adminid ) << ( id 31 ) ); 
}

public 
client_disconnectid )
{
    
g_Admins &= ~( << ( id 31 ) ); 
}

public 
YourFunctionid )
{
    if ( 
g_Admins )
    {
        
//At least 1 admin is online
    
}

__________________

Last edited by Bugsy; 04-27-2017 at 17:47.
Bugsy is offline
StR_Marian
Member
Join Date: Apr 2017
Old 04-25-2017 , 07:21   Re: Help
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
PHP Code:
new g_Admins;

public 
client_putinserverid )
{
    
g_Admins |= ( is_user_adminid ) << ( id 31 ) ); 
}

public 
client_disconnectid )
{
    
g_Admins &= ~( is_user_adminid ) << ( id 31 ) ); 
}

public 
YourFunctionid )
{
    if ( 
g_Admins )
    {
        
//At least 1 admin is online
    
}

thx , for your help , your's is more easyer , i learned a lot from your post
StR_Marian 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 10:29.


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