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!