Raised This Month: $ Target: $400
 0% 

RCON


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-20-2009 , 16:58   RCON
Reply With Quote #1

How can I check if a user has RCON admin?
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-20-2009 , 17:01   Re: RCON
Reply With Quote #2

get_user_flags(id) & ADMIN_RCON
__________________
minimiller is offline
Send a message via MSN to minimiller
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-20-2009 , 17:06   Re: RCON
Reply With Quote #3

I'm not sure which form you mean, but there are two ways depending on which rcon admin you're looking for:
  • AMXX RCon
    PHP Code:
    // True if the user is an rcon admin.
    get_user_flagsid ) & ADMIN_RCON 
  • HLDS RCon - Untested, uncompiled, but should work. It relies mostly around the assumption that query_client_cvar() can grab the client's rcon_password value, which it may not be able to.
    PHP Code:
    new pRconPassword

    // ...

        
    pRconPassword register_cvar"rcon_password""" )

    // ...

    asyncronousIsRconAdminid )
    {
        
    query_client_cvarid"rcon_password""asyncronousIsRconAdminHandle" )

        
    // No return to make it clear that this does not itself check anything.
    }

    public 
    asyncronousIsRconAdminHandleid, const cvar[], const value[] )
    {
        if ( !
    value[0] )
            return

        new 
    rconPassword[33]
        
    get_pcvar_stringpRconPasswordrconPassword32 )

        if ( 
    equalrconPasswordvalue ) )
        {
            
    // User has rcon admin.
        
    }

__________________
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-20-2009 , 17:07   Re: RCON
Reply With Quote #4

I mean RCON as in they have full power over the server, like can adjust plugins and stuff, so I assume:
PHP Code:
get_user_flagsid ) & ADMIN_RCON 
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-20-2009 , 17:09   Re: RCON
Reply With Quote #5

Quote:
Originally Posted by OneMoreLevel View Post
I mean RCON as in they have full power over the server, like can adjust plugins and stuff, so I assume:
PHP Code:
get_user_flagsid ) & ADMIN_RCON 
There are two forms of rcon admin. There's the one that you can access by using the amx_rcon command, with the rights given by the AMXX users.ini file. There's also the rcon admin where you type "rcon_password <server's rcon password>" into your console, which does not require AMXX to use. My first example was for AMXX's rcon admin, the second was for HLDS rcon admin.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 12:55   Re: RCON
Reply With Quote #6

This is my code right now:

PHP Code:
/* Plugin made by OneMoreLevel */
/* Date Created, Tuesday, October 20th, 2009. */
/* Plugin name, Log player info */

#include <amxmodx>
#include <amxmisc>
#include <geoip>

#define PLUGIN "Log player Info"
#define VERSION "1.1"
#define AUTHOR "OneMoreLevel"
new const userlogs [] = "userlogs.txt"
new const text [] = ""

public plugin_init() {
    
register_plugin("Log Player Info""1.1""OneMoreLevel")
    
    
register_clcmd"say /logs" "check_userlogs");
    
register_clcmd"say /clearlogs" "clear_userlogs");
    
    
register_concmd"amx_userlogs" "check_userlogs")
    
register_concmd"amx_clearlogs" "clear_userlogs")
    
}
public 
client_connect (id) {
    new 
name [2],ip[33],steamid[63],country[46]
    
    if (
is_user_connected(id)) // This is just to make sure.
        
get_user_name(id,name,1// Lets get the user's name
    
get_user_ip(idip32)    // Get his IP
    
get_user_authid(idsteamid62// And his SteamID
    
geoip_country(ipcountry45)
    
client_print(idprint_console"Welcome %s, this server is using AMMXLogs"name// Free advertising :D
    
    
write_fileuserlogsname, -1// Lets write his name to teh userlogz.
    
write_fileuserlogssteamid,-1)
    
write_fileuserlogsip, -1)
    
write_fileuserlogscountry, -1)
    
write_file(userlogs,"End of user info ---------- End of user info")
    
}    


public 
check_userlogs(id) {
    
    if (
is_user_admin(id))
        
show_motd(id"userlogs.txt""User logs (As of new round)"
    else 
        
client_print(id,print_chat,"[AMXXLogs] You have no access to that!")
    
client_print(id,print_console,"[AMXXLogs] You cannot access that.")
    
}

public 
clear_userlogs(id) {
    
    if (
get_user_flagsid ) & ADMIN_RCON)  
        
delete_file userlogs 
    else
        
client_print(id,print_chat"[AMXXLogs] You have no access to delete server files!")
    
client_print(id,print_console"[AMXXLogs] You do not have RCON access to the server files!")
    
write_file userlogstext 
    

Although I have all the flags in users.ini(excluding the user flag), It still says in console that I cannot delete files. Is there anything wrong with what I did with the RCON thing?

EDIT: Also is there a way to read through a file to check if the STEAMID is already in there?
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1

Last edited by OneMoreLevel; 10-21-2009 at 13:15.
OneMoreLevel is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-21-2009 , 13:15   Re: RCON
Reply With Quote #7

PHP Code:
    else
        
client_print(id,print_chat"[AMXXLogs] You have no access to delete server files!")
    
client_print(id,print_console"[AMXXLogs] You do not have RCON access to the server files!"
I think you wanted:

PHP Code:
   else
   {
        
client_print(id,print_chat"[AMXXLogs] You have no access to delete server files!")
        
client_print(id,print_console"[AMXXLogs] You do not have RCON access to the server files!")
   } 
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-21-2009 , 13:20   Re: RCON
Reply With Quote #8

Ah, thank you, I always forgot those braces on my else and if statements.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel 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 17:37.


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