Raised This Month: $ Target: $400
 0% 

if authid is bla bla {


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-24-2005 , 04:58   if authid is bla bla {
Reply With Quote #1

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?
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-24-2005 , 05:06  
Reply With Quote #2

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 }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-24-2005 , 05:28  
Reply With Quote #3

thanks! But if I want it to check from a cfg file?
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
NiGHTFiRE
Senior Member
Join Date: Dec 2004
Location: Sweden
Old 04-24-2005 , 05:33  
Reply With Quote #4

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") }
NiGHTFiRE is offline
Send a message via AIM to NiGHTFiRE Send a message via MSN to NiGHTFiRE
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 16:50.


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