Raised This Month: $ Target: $400
 0% 

How To Store this values


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-25-2018 , 12:18   Re: How To Store this values
Reply With Quote #11

You can modify the chars used by editing the ranges in CharRanges[] and code length by changing SecurityCodeLength value. It is currently setup to build a 6-character long code using characters 0-9, a-z, A-Z.

Sample output:
Code:
* Your security code is: xL8pqk
* Your security code is: r7CC44
* Your security code is: H3npmW
* Your security code is: XxJnJB
* Your security code is: O44oIA
* Your security code is: 8V08bw
PHP Code:
#include <amxmodx>

#define MAX_PLAYERS 32

const SecurityCodeLength 6;

new const 
CharRanges][ ] = 
{
    { 
'0' '9' },  //0-9 = asc 48-57
    
'A' 'Z' },  //A-Z = asc 65-90
    
'a' 'z' }   //a-z = asc 97-122
};
    
new 
g_szSecurityCodesMAX_PLAYERS ][ SecurityCodeLength ];
 
public 
plugin_init()
{
    
register_plugin"Security Code" "0.1" "bugsy" );
    
    
register_clcmd"say /random" "GenerateCode" );
}

public 
GenerateCodeid )
{
    new 
iCurSet;
    
    for ( new 
SecurityCodeLength i++ )
    {
        
iCurSet randomsizeofCharRanges ) );
        
        
g_szSecurityCodesid ][ ] = random_numCharRangesiCurSet ][ ] , CharRangesiCurSet ][ ] );
    }
    
g_szSecurityCodesid ][ SecurityCodeLength ] = EOS;

    
client_printid print_chat "* Your security code is: %s" g_szSecurityCodesid ] );

__________________

Last edited by Bugsy; 03-25-2018 at 18:29.
Bugsy is offline
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 23:56.


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