AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   if authid is bla bla { (https://forums.alliedmods.net/showthread.php?t=12762)

NiGHTFiRE 04-24-2005 04:58

if authid is bla bla {
 
I'm wondering how you woudl do this. let's say i want to type amx_fucker <password> in the console, i want it to check if I have access to type that and if the pass is correct. I have for the pass but how do I check if the user has access to that command?

v3x 04-24-2005 05:06

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     // ..     register_clcmd("amx_fuxor","Do_Fuxor",ADMIN_CFG,"- Blah blah")     register_cvar("fuxor_pass","kthnx") } public Do_Fuxor(id,level,cid) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED     }     new arg[64]     read_argv(1,arg,63)     new pass[64]     get_cvar_string("fuxor_pass",pass,63)     if(equali(arg,pass)) {         // Pass is correct     }     else if(!equali(arg,pass)) {         // Pass is incorrect     }     return PLUGIN_HANDLED }

NiGHTFiRE 04-24-2005 05:28

thanks! But if I want it to check from a cfg file?

NiGHTFiRE 04-24-2005 05:33

This is my code:
Code:
#include <amxmodx> #include <amxmisc> #define max_admins 64 public login(id) {     new usercfg[64]     new arguser[32], argpass[32], password[32]     new line = 0     new flags     new strflags[32]     new linetext[255], linetextlength         read_argv(1,arguser,31)     read_argv(2,argpass,31) {     if((arguser[0] > 0)&&(argpass[0] > 0))     {           get_customdir(usercfg, 63)         format(usercfg, 63, "%s/amxmodx_login/admins.ini", usercfg)         if (file_exists(usercfg))         {             while ((line = read_file(usercfg, line, linetext, 256, linetextlength)))             {                 if(linetext[0] == ';')                 {                     continue                 }                       parse(linetext, 31, password, 31, strflags, 31)                 flags = read_flags(strflags)                 if((equal(arguser))&&(equal(password, argpass)))                 {                     set_user_flags(id, flags)                     new text[128]                     format(text, 128, "[AMXX AUTH] You are now logged in, with the flags: %s.", strflags)                       client_print(id, print_console, text)                     return PLUGIN_HANDLED                 }             }             client_print(id, print_console, "[AMXX AUTH] Incorrect password.")         }     }     return PLUGIN_HANDLED } public logout(id) {     remove_user_flags(id, -1)     client_print(id, print_console, "[AMXX AUTH] You are now logged out of administrator status")     return PLUGIN_HANDLED } public plugin_init() {        ///////////gonna fix later     register_clcmd("amx_login","login",-1,"amx_login - <password> - Logs a player in as admin")     register_clcmd("amx_logout","logout",-1,"amx_logout - Logs a player out of admin") }


All times are GMT -4. The time now is 16:50.

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