AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random password generator ? (https://forums.alliedmods.net/showthread.php?t=86359)

card 02-24-2009 10:49

random password generator ?
 
i need a code for auto password generator, for my server. everytime i type /pass, i get other random password (not only numbers) for the server. if someone can do this, i apreciate

Exolent[jNr] 02-24-2009 11:58

Re: random password generator ?
 
Code:
#include <amxmodx> #include <amxmisc> #define PASSWORD_LENGTH 16 new sv_password; public plugin_init() {     register_plugin("Password Generator", "0.1", "Exolent");         register_clcmd("say /pass", "CmdPass");         sv_password = get_cvar_pointer("sv_password"); } public CmdPass(client) {     if( !access(client, ADMIN_CVAR) )     {         client_print(client, print_chat, "You have no access to that command!");         return PLUGIN_HANDLED;     }         new password[PASSWORD_LENGTH];     for( new i = 0; i < sizeof(password) - 1; i++ )     {         switch( i % 3 )         {             case 0: password[i] = random_num('0', '9');             case 1: password[i] = random_num('a', 'z');             case 2: password[i] = random_num('A', 'Z');         }     }         client_print(client, print_chat, "Password has been printed to your console.");     console_print(client, "^"sv_password^" is ^"%s^"", password);         set_pcvar_string(sv_password, password);         new name[32];     get_user_name(client, name, sizeof(name) - 1);         client_print(0, print_chat, "ADMIN %s :  set a random server password.", name);         return PLUGIN_HANDLED; }

card 02-24-2009 13:03

Re: random password generator ?
 
thank you exolent

xPaw 02-25-2009 12:07

Re: random password generator ?
 
PHP Code:

random_num('A''Z'); 

its not num, how does it work o_O ?

Arkshine 02-25-2009 12:17

Re: random password generator ?
 
It works like nums. A character is basically a num. 'A' = 65 . ( see ascii table )

xPaw 02-25-2009 12:54

Re: random password generator ?
 
ok thanks


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

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