Raised This Month: $ Target: $400
 0% 

AMX AddAdmin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-20-2017 , 09:46   AMX AddAdmin
Reply With Quote #1

Hello. I started working on a brand new admin plugin for my HL1 server.

Code:
public cmdAddAdmin(id){    
	new arg[32]
	new arg2[64]
	new szName[32]
	new linetoadd=-1
	new Player = find_player("bl", arg);
	read_argv(1, arg, 63)
	new arglen=read_argv(2, arg2, 63)
	new flags = get_user_flags(id);
	get_user_name(id,szName,charsmax(szName))
	if (((is_user_connected(id)) && (flags & ADMIN_LEVEL_H)) && (read_argc() > 2)){
			format(file_admins, 511, "^"%s^" ^"%s^" *Admin set by %s*", arg, arg2, szName)
			get_user_authid(Player , arg , charsmax(arg) )
			set_user_flags(Player,arglen)
			client_print(0,print_console,"* The user became an admin with level %s.", arg2)
			write_file(conffile_admins,file_admins,linetoadd)
			if (read_argc() < 3)
			{
				client_print(id,print_console,"Usage: <steamid> <level>")
				return PLUGIN_HANDLED
			}
		}		
	else if ((is_user_connected(id)) && (!(flags & ADMIN_LEVEL_H)))
		{
			client_print(id,print_console,"You do not have access to use this command.")
			return PLUGIN_HANDLED
		}
	return PLUGIN_HANDLED		
}
Can someone fix the code for me? I want to check if there is a player with the steamid wrote in console, get it's name, and if there is no player with the steamid that I wrote, it should say No user with that name was found on the server. If it was found, it should set it's flags from arg2. Thanks!
DarthMan is offline
 



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:54.


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