Raised This Month: $51 Target: $400
 12% 

Solved BuyAdmin with random password automatic addition


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AlexandruODT
Member
Join Date: May 2020
Old 05-03-2020 , 10:00   BuyAdmin with random password automatic addition
Reply With Quote #1

Hello!
I also want this shop plugin to add the automatic admin purchase function, ie more precisely when a player types "say / buyadmin" to appear that menu and when he bought to automatically add in users.ini with a random password and those messages to be colored

example:
^ x04 / ^ x03 / ^ x01
^ x04 [BUY ADMIN] You are already ^ x04admin, you cannot purchase another one.

Plugin Shop Buy admin with menu:

PHP Code:
#include < amxmodx >
#include < amxmisc>
#include < engine >
#include < cstrike >
#include < fun >
#pragma tabsize 0

native fcs_get_user_credits(client);
native fcs_set_user_credits(clientcredits);

#define PLUGIN "Credits Shop"
#define VERSION "0.1"
#define AUTHOR "zEr0"

new const Prefix[  ] = "[BUY ADMIN]";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
//Register Shop
    
register_clcmd("say /buyadmin""buyadmin" );
    
register_clcmd("say buyadmin""buyadmin" );
    
register_clcmd("say_team /buyadmin""buyadmin" );
    
register_clcmd("say_team buyadmin""buyadmin" );
    
}

public 
buyadmin id ) {   
    
    new 
Temp[101]; 
    
    
formatex(Temp,100"SHOP ADMIN [ LLG ]:^nCreditele Tale: %d"fcs_get_user_credits(id)); 
    new 
menu menu_create(Temp"buyadminc")
    
    
menu_additem(menu"SLOT [300 Credite]""1"0);
    
menu_additem(menu"HELPER [900 Credite]""2"0);
    
menu_additem(menu"SUPERVISOR [1500 Credite]""3"0);
    
menu_additem(menu"MODERATOR [3500 Credite]""4"0);
    
menu_additem(menu"SUPER MODERATOR [6000 Credite]""5"0);
    
menu_additem(menu"ADMINISTRATOR [9000 Credite]""6"0);
    
menu_additem(menu"COMMANDER [15000 Credite]""7"0);
    
menu_additem(menu"SUPER COMMANDER [35000 Credite]""8"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}


public 
buyadminc(idmenuitem) {
    
    if( 
item == MENU_EXIT )
    {
        return 
1;
    }
    
    new 
data ], szName 64 ], name 32 ];
    new 
accesscallback;
    
menu_item_getinfo menuitemaccessdata,charsmax data ), szName,charsmax szName ), callback );
    
get_user_name(id,name,charsmax(name))
    new 
key str_to_num data );
    
    switch ( 
key )
    {  
        
        case 
1:
        {
            if( 
fcs_get_user_credits(id) < 300 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [SLOT], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]."Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [SLOT]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 300)
            }
        }
        case 
2:
        {
            if( 
fcs_get_user_credits(id) < 900 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [HELPER], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [HELPER]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 900)
            }
        }
        case 
3:
        {
            
            if( 
fcs_get_user_credits(id) < 1500 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [SUPERVISOR], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [SUPERVISOR]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 1500)
            }
        }
        case 
4:
        {
            
            if( 
fcs_get_user_credits(id) < 3500 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [MODERATOR], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [MODERATOR]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 3500)
            }
        }
    
    
        case 
5:
        {
            if( 
fcs_get_user_credits(id) < 6000 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [SUPER MODERATOR], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [SUPER MODERATOR]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 6000)
            }
        }
        case 
6:
        {
            if( 
fcs_get_user_credits(id) < 9000 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [ADMINISTRATOR], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [ADMINISTRATOR]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 9000)
            }
        }
        case 
7:
        {
            
            if( 
fcs_get_user_credits(id) < 15000 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [COMMANDER], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [COMMANDER]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 15000)
            }
        }
        case 
8:
        {
            
            if( 
fcs_get_user_credits(id) < 35000 )
            {
                
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
                return 
1;
                
            }
            else
            { 
                
client_print(idprint_chat"%s Ai cumparat [SUPER COMMANDER], fa o poza si posteaz-o pe www.laleagane.ro/forum sectiunea-[CAMPINA - CONCURSURI]"Prefix);
                
log_to_file "buyadmin.log""%s A cumparat [SUPER COMMANDER]"name );
                
fcs_set_user_credits(idfcs_get_user_credits(id) - 35000)
            }
        }
    }     
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;    
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
BuyAdmin plugin without menu:

PHP Code:
#include < amxmodx >
#include < amxmisc >

// ----------------------------------------
// ---    De aici modifici nativele tale    ---
// ----------------------------------------
native fcs_get_user_credits(client);
native fcs_set_user_credits(clientcredits);


// FLAG-urile pe care le ofera
#define FLAGS_TO_BUY    "abcede"

// Pretul adminului
#define PRICE_ADMIN    1500

public plugin_init() {
    
register_clcmd("say /buyadmin""buy_admin");
}

public 
buy_admin(id) {
    if(
is_user_admin(id)) {
        
client_print(idprint_chat"Ai deja admin");
        return 
1;
    }

    if(
get_user_credits(id) < PRICE_ADMIN) {
        
client_print(idprint_chat"Nu ai suficiente credite");
        return 
1;
    }

    
set_user_credits(idget_user_credits(id)-PRICE_ADMIN);
    new 
name[32];    get_user_name(idname31);
    new 
pass[5];    formatex(passcharsmax(pass), "%c%c%c%c"random_num('A''Z'), random_num('a''z'), random_num('A''Z'), random_num('a''z'));
    new 
file[128];    formatex(filecharsmax(file), "^"%s^" ^"%s^" ^"%s^" ^"a^""namepassFLAGS_TO_BUY);
    
write_file("addons/amxmodx/configs/users.ini"file);
    
client_print(idprint_console"PAROLA: %s"pass);
    
server_cmd("amx_reloadadmins");
    return 
0;


Last edited by AlexandruODT; 05-04-2020 at 14:23.
AlexandruODT is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 05-03-2020 , 10:50   Re: BuyAdmin with random password automatic addition
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Buy ADmin"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define MONEY    1500

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /buyadmin""Buy")
}

public 
Buy(id)
{
    new 
iMoney get_user_credits(id);
    
    if (
iMoney >= MONEY)
    {
        new 
szName[32]
        
get_user_name(idszName31)
        
        
set_user_credits(idiMoney MONEY)
        
        new 
rand random_num(0,14)
        
        switch(
rand)
        {
            case 
0: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"AsdteSF54Cf^"",szName)
            
client_print(id"Your Password is : AsdteSF54Cf")
            }
            case 
1: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"SghufdS6542Df^"",szName)
            
client_print(id"Your Password is : SghufdS6542Df")
            }
            case 
2: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"65SDF4Eas^"",szName)
            
client_print(id"Your Password is : 65SDF4Eas")
            }
            case 
3: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"54aASD21rf26^"",szName)
            
client_print(id"Your Password is : 54aASD21rf26")
            }
            case 
4: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"WsdaW458Swda^"",szName)
            
client_print(id"Your Password is : WsdaW458Swda")
            }
            case 
5: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"@Easdas251ds^"",szName)
            
client_print(id"Your Password is : @Easdas251ds")
            }
            case 
6: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"asdjndfESDF51^"",szName)
            
client_print(id"Your Password is : asdjndfESDF51")
            }
            case 
7: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"BNMtrdf1585x^"",szName)
            
client_print(id"Your Password is : BNMtrdf1585x")
            }
            case 
8: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"51qfdsfSDFs4^"",szName)
            
client_print(id"Your Password is : 51qfdsfSDFs4")
            }
            case 
9: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"sdfF541WEF21^"",szName)
            
client_print(id"Your Password is : sdfF541WEF21")
            }
            case 
10: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"SAF5441Rdfs^"",szName)
            
client_print(id"Your Password is : SAF5441Rdfs")
            }
            case 
11: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"54wefDSF5efs^"",szName)
            
client_print(id"Your Password is : 54wefDSF5efs")
            }
            case 
12: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"TYUjv12567wd^"",szName)
            
client_print(id"Your Password is : TYUjv12567wd")
            }
            case 
13: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"ASDjkhrg5d4fdg^"",szName)
            
client_print(id"Your Password is : ASDjkhrg5d4fdg")
            }
            case 
14: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcede^" ^"WRdfknh545krj^"",szName)
            
client_print(id"Your Password is : WRdfknh545krj")
            }
        }
    }
    return 
PLUGIN_HANDLED

alferd is offline
AlexandruODT
Member
Join Date: May 2020
Old 05-03-2020 , 11:22   Re: BuyAdmin with random password automatic addition
Reply With Quote #3

I want it with different prices and let's not forget this is the credit plugin

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fakemeta >
#include < hamsandwich >
#include < nvault >

#pragma semicolon 1


#define PLUGIN "Furien Credits System AIO"
#define VERSION "1.8.8"   // 1.x.x  noi verificari/imbunatatiri

#define    ONE_DAY_IN_SECONDS    86400
#define TASK_pentru    06091993
#define FCS_TEAM_FURIEN     CS_TEAM_T
#define FCS_TEAM_ANTIFURIEN    CS_TEAM_CT

enum Color
{
    
NORMAL 1,     // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
    
GREEN,             // Culoare Verde.
    
TEAM_COLOR,     // Culoare Rosu, Albastru, Gri.
    
GREY,             // Culoarea Gri.
    
RED,             // Culoarea Rosu.
    
BLUE,             // Culoarea Albastru.
};

new 
TeamName[  ][  ] = 
{
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
};

new const 
g_szTag[ ] = "[LLG CREDITS]";
new const 
g_szGiveCreditsFlag[ ] = "k";

new 
g_iCvarPruneDays;
new 
g_iCvarEntry;
new 
g_iCvarRetire;

new 
g_iCvarPTREnable;
new 
g_iCvarPTRMinutes;
new 
g_iCvarPTRCredits;

new 
g_iCvarKREnable;
new 
g_iCvarKRCredits;
new 
g_iCvarKRHSCredits;

new 
g_iCvarTSEnable;
new 
g_iCvarTSMaxCredits;

new 
g_iCvarWTREnable;
new 
g_iCvarWTRFurien;
new 
g_iCvarWTRAnti;

new 
g_szName33 ][ 32 ];
new 
g_iUserCredits33 ];
new 
g_iUserTime33 ];
new 
g_iUserRetired33 ];

new 
iVault;

public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
register_cvar"fcs_version_aio"VERSIONFCVAR_SERVER FCVAR_SPONLY ); 

    
g_iCvarPruneDays register_cvar"fcs_prunedays""15" );
    
g_iCvarEntry register_cvar"fcs_entry_credits""300" );
    
g_iCvarRetire register_cvar"fcs_maxretrive""0" );
    
    
g_iCvarPTREnable register_cvar"fcs_pentru_enable""1" );
    
g_iCvarPTRMinutes register_cvar"fcs_pentru_minutes""5" );
    
g_iCvarPTRCredits register_cvar"fcs_pentru_credits""15" );
    
    
g_iCvarKREnable register_cvar"fcs_kr_enable""1" );
    
g_iCvarKRCredits register_cvar"fcs_kr_credits""7" );
    
g_iCvarKRHSCredits register_cvar"fcs_kr_hscredits""3" );//( bonus, fcs_kr_credits + fcs_kr_hscredits )
    
    
g_iCvarTSEnable register_cvar("fcs_transfer_enable""1" );
    
g_iCvarTSMaxCredits register_cvar("fcs_transfer_maxcredits""50" );

    
g_iCvarWTREnable register_cvar"fcs_wtr_enable""1" );
    
g_iCvarWTRFurien register_cvar"fcs_wtr_furien""12" );
    
g_iCvarWTRAnti register_cvar"fcs_wtr_antifurien""20" );
    
    
register_clcmd"say""ClCmdSay" );
    
register_clcmd"say_team""ClCmdSay" );
    
    
register_clcmd"say /depozit""ClCmdSayDepozit" );
    
register_clcmd"say /deposit""ClCmdSayDepozit" );
    
register_clcmd"say_team /depozit""ClCmdSayDepozit" );
    
register_clcmd"say_team /deposit""ClCmdSayDepozit" );
    
    
register_clcmd"say /retrage""ClCmdSayRetrage" );
    
register_clcmd"say /withdraw""ClCmdSayRetrage" );
    
register_clcmd"say_team /retrage""ClCmdSayRetrage" );
    
register_clcmd"say_team /withdraw""ClCmdSayRetrage" );
    
    
register_clcmd"fcs_credite""ClCmdCredits" );
    
register_clcmd"fcs_credits""ClCmdCredits" );
    
    
register_clcmd"donate""ClCmdFcsDonate" );
    
register_clcmd"transfer""ClCmdFcsDonate" );
    
    
register_clcmd"amx_give_credits""ClCmdGiveCredits" );
    
register_clcmd"amx_take_credits""ClCmdTakeCredits" );
    
    
RegisterHamHam_Spawn"player""ham_SpawnPlayerPost"true );
    
register_forwardFM_ClientUserInfoChanged"Fwd_ClientUserInfoChanged" );
    
    
register_event"DeathMsg","ev_DeathMsg""a" );
    
register_event"SendAudio""ev_SendAudioTerWin""a""2=%!MRAD_terwin" );
    
register_event"SendAudio""ev_SendAudioCtWin""a""2=%!MRAD_ctwin" );
    
    
set_task1.0"task_PTRFunctions"TASK_pentru__"b");    

}

public 
plugin_natives()
{
    
    
register_library"fcs" );
    
register_native"fcs_get_user_credits""_fcs_get_user_credits" );
    
register_native"fcs_set_user_credits""_fcs_set_user_credits" );
    
}

public 
_fcs_get_user_creditsiPluginiParams )
{
    return 
g_iUserCredits[  get_param)  ];
}

public 
_fcs_set_user_credits(  iPluginiParams  )
{
    new 
id get_param);
    
g_iUserCreditsid ] = max0get_param) );
    
SaveCreditsid );
    return 
g_iUserCreditsid ];
}

public 
client_authorizedid )
{
    if( 
is_user_botid ) )
        return 
PLUGIN_CONTINUE;
    
    
get_user_nameidg_szNameid ], sizeof g_szName[] ) -);
    
LoadCreditsid );
    
    
g_iUserTimeid ] = 0;
    
g_iUserRetiredid ] = 0;
    return 
PLUGIN_CONTINUE;
    
}

public 
client_disconnectid )
{
    if( 
is_user_botid ) )
        return 
PLUGIN_CONTINUE;
        
    
SaveCreditsid );
    
g_iUserRetiredid ] = 0;
    
    return 
PLUGIN_CONTINUE;
    
}

public 
ClCmdSayid )
{
    static 
szArgs[192];
    
read_argsszArgssizeof szArgs ) -);
    
    if( !
szArgs] )
        return 
PLUGIN_CONTINUE;
    
    new 
szCommand15 ];
    
remove_quotesszArgs] );
    
    if( 
equalszArgs"/credite"strlen"/credite" ) )
        || 
equalszArgs"/credits"strlen"/credits" ) ) )
    {
        
replaceszArgssizeof szArgs ) -1"/""" );
        
formatexszCommandsizeof szCommand ) -1"fcs_%s"szArgs );
        
client_cmdidszCommand );
        return 
PLUGIN_HANDLED;
    }
    else if( 
equalszArgs,  "/transfer"strlen(  "/transfer" ) )
        || 
equalszArgs,  "/donate",  strlen(  "/donate" ) ) )
    {
        
replaceszArgssizeof szArgs ) -1"/""" );
        
formatexszCommandsizeof szCommand ) -1"%s"szArgs );
        
client_cmdidszCommand );
        return 
PLUGIN_HANDLED;
    }
        
    return 
PLUGIN_CONTINUE;
}

public 
ClCmdCreditsid )
{
    if( !
is_user_connectedid ) )
        return 
PLUGIN_HANDLED;
        
    new 
szArg32 ];
        
read_argv1szArgsizeof szArg ) -);

    if( 
equalszArg"" ) ) 
    {
        
        
ColorChatidRED"^x04%s^x01 Ai^x03 %i^x01 credite."g_szTagg_iUserCreditsid ] );
        return 
PLUGIN_HANDLED;
    }
    
        new 
iPlayer cmd_targetidszArg);
        if( !
iPlayer || !is_user_connectediPlayer ) )
    {
        
ColorChatidRED,"^x04%s^x01 Jucatorul specificat nu a fost gasit!"g_szTagszArg );
        return 
PLUGIN_HANDLED;
    }

    new 
szName32 ];
    
get_user_nameiPlayerszNamesizeof szName ) -);
    
ColorChatidRED,"^x04%s^x01 Jucatorul^x03 %s^x01 are^x03 %i^x01 credit%s"g_szTagszNameg_iUserCreditsiPlayer ], g_iUserCreditsiPlayer ] == "." "e." );
    
    return 
PLUGIN_HANDLED;
    
}

public 
ClCmdSayDepozitid)
{
    
    if( !
is_user_connectedid ) )
        return 
PLUGIN_HANDLED;
        
    new 
CsTeams:iTeam cs_get_user_teamid );
    
    if( 
CS_TEAM_T <= iTeam <= CS_TEAM_CT )
    {
        new 
iMoney cs_get_user_moneyid );
        if( 
iMoney >= 16000 )
        {
            
            
ColorChatidRED"^x04%s^x01 Ai depozitat^x03 16000$^x01 si ai primit^x03 1^x01 credit."g_szTag );
            
cs_set_user_moneyidiMoney 16000 );
            
g_iUserCreditsid ] += 1;
            
            
SaveCreditsid );
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
ColorChatidRED"^x04%s^x01 Iti trebuie^x03 16000$^x01 pentru a putea depozita."g_szTag );
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_HANDLED;

}

public 
ClCmdSayRetrageid)
{
    
    new 
CsTeams:iTeam cs_get_user_teamid );
    
    if( 
CS_TEAM_T <= iTeam <= CS_TEAM_CT )
    {
        
        if( 
g_iUserCreditsid ] > )
        {
            new 
iMaxRetrieve get_pcvar_numg_iCvarRetire );
            if( 
iMaxRetrieve )
            {
                if( 
g_iUserRetiredid ] >= iMaxRetrieve )
                {
                    
ColorChatidRED"^x04%s^x01 Ai retras deja^x03 %i^x01 credit%s runda asta^x01."g_szTagiMaxRetrieveiMaxRetrieve == "" "e" );
                    return 
PLUGIN_HANDLED;
                }
            }
            
            new 
iMoney cs_get_user_moneyid );
            
            
ColorChatidRED"^x04%s^x01 Ai retras^x03 1^x01 credit si, ai primi^x03 1200$^x01."g_szTag );
            
cs_set_user_moneyidiMoney 1200 );
            
            
g_iUserCreditsid ] -=1;
            
g_iUserRetiredid ]++;
            
            
SaveCreditsid );
            
            if( ( 
iMoney 1200 ) > 1200 )
            {
                
ColorChatidRED"^x04%s^x03 ATENTIE^x01, ai^x03 %i$^x01 !"g_szTagiMoney 1200 );
                
ColorChatidRED"^x04%s^x01 La spawn, vei pierde tot ce depaseste suma de^x03 1200$^x01."g_szTag );
                return 
PLUGIN_HANDLED;
            }
        }
        else
        {
            
ColorChat(idRED"^x04%s^x03 NU^x01 ai ce sa retragi, ai^x03 0^x01 credite."g_szTag );
            return 
PLUGIN_HANDLED;
        }
        
    }
    
    return 
PLUGIN_HANDLED;

}

public 
ClCmdGiveCreditsid )
{
    
    if( !( 
get_user_flagsid ) & read_flagsg_szGiveCreditsFlag ) ) )
    {
        
client_cmdid"echo NU ai acces la aceasta comanda!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFirstArg32 ], szSecondArg10 ];
    
    
read_argv1szFirstArgsizeof szFirstArg ) -);
    
read_argv2szSecondArgsizeof szSecondArg ) -);
    
    if( 
equalszFirstArg"" ) || equalszSecondArg"" ) )
    {
        
client_cmdid"echo amx_give_credits < nume/ @ALL/ @T/ @CT > < credite >" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayers32 ];
    new 
iPlayersNum;
    
    new 
iCredits str_to_numszSecondArg );
    if( 
iCredits <= )
    {
        
client_cmdid"echo Valoare creditelor trebuie sa fie mai mare decat 0!" );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
szFirstArg] == '@' )
    {
        
        switch ( 
szFirstArg] )
        {
            case 
'A':
            {
                if( 
equalszFirstArg"@ALL" ) )
                {
                    
                    
get_playersiPlayersiPlayersNum"ch" );
                    for( new 
0iPlayersNum i++ )
                        
g_iUserCreditsiPlayers] ] += iCredits;
                        
                    new 
szName32 ];
                    
get_user_nameidszNamesizeof szName ) -);
                    
ColorChat0RED"^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 credite tuturor jucatorilor!"g_szTagszNameiCredits );
                    return 
PLUGIN_HANDLED;
                }
            }
            
            case 
'T':
            {
                if( 
equalszFirstArg"@T" ) )
                {
                    
                    
get_playersiPlayersiPlayersNum"ceh""TERRORIST" );
                    if( 
iPlayersNum == )
                    {
                        
client_cmdid"echo NU se afla niciun jucator in aceasta echipa!" );
                        return 
PLUGIN_HANDLED;
                    }
                    for( new 
0iPlayersNum i++ )
                        
g_iUserCreditsiPlayers] ] += iCredits;
                        
                    new 
szName32 ];
                    
get_user_nameidszNamesizeof szName ) -);
                    
ColorChat0RED"^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 credite jucatorilor de la^x03 TERO^x01!"g_szTagszNameiCredits );
                    return 
PLUGIN_HANDLED;
                }
            }
            
            case 
'C':
            {
                if( 
equalszFirstArg"@CT" ) )
                {
                    
                    
get_playersiPlayersiPlayersNum"ceh""CT" );
                    if( 
iPlayersNum == )
                    {
                        
client_cmdid"echo NU se afla niciun jucator in aceasta echipa!" );
                        return 
PLUGIN_HANDLED;
                    }
                    
                    for( new 
0iPlayersNum i++ )
                        
g_iUserCreditsiPlayers] ] += iCredits;
                        
                    new 
szName32 ];
                    
get_user_nameidszNamesizeof szName ) -);
                    
ColorChat0RED"^x04^%s^x01 Adminul^x03 %s^x01 le-a dat^x03 %i^x01 credite jucatorilor de la^x03 CT^x01!"g_szTagszNameiCredits );
                    return 
PLUGIN_HANDLED;
                }
            }
        }
    }
        
    new 
iPlayer cmd_targetidszFirstArg);
    if( !
iPlayer )
    {
        
client_cmdid"echo Jucatorul %s nu a fost gasit!"szFirstArg );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iUserCreditsiPlayer ] += iCredits;
    
    new 
szName32 ], _szName32 ];
    
get_user_nameidszNamesizeof szName ) -);
    
get_user_nameiPlayer_szNamesizeof _szName ) -);
    
    
ColorChat0RED"^x04%s^x01 Adminul^x03 %s^x01 i-a dat^x03 %i^x01 credite lui^x03 %s^x01."g_szTagszNameiCredits_szName );
    
    return 
PLUGIN_HANDLED;
    
    
}

public 
ClCmdTakeCreditsid )
{
    
    if( !( 
get_user_flagsid ) & read_flagsg_szGiveCreditsFlag ) ) )
    {
        
client_cmdid"echo NU ai acces la aceasta comanda!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFirstArg32 ], szSecondArg10 ];
    
    
read_argv1szFirstArgsizeof szFirstArg ) -);
    
read_argv2szSecondArgsizeof szSecondArg ) -);
    
    if( 
equalszFirstArg"" ) || equalszSecondArg"" ) )
    {
        
client_cmdid"echo amx_take_credits < nume > < credite >" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iCredits str_to_numszSecondArg );
    if( 
iCredits <= )
    {
        
client_cmdid"echo Valoare creditelor trebuie sa fie mai mare decat 0!" );
        return 
PLUGIN_HANDLED;
    }
            
    new 
iPlayer cmd_targetidszFirstArg);
    if( !
iPlayer )
    {
        
client_cmdid"echo Jucatorul %s nu a fost gasit!"szFirstArg );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
g_iUserCreditsiPlayer ] < iCredits )
    {
        
client_cmdid"echo Jucatorul %s nu are atatea credite!Are doar %i"szFirstArgg_iUserCreditsiPlayer ] );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iUserCreditsiPlayer ] -= iCredits;
    
    new 
szName32 ], _szName32 ];
    
get_user_nameidszNamesizeof szName ) -);
    
get_user_nameiPlayer_szNamesizeof _szName ) -);
    
    
ColorChat0RED"^x04%s^x01 Adminul^x03 %s^x01 i-a sters^x03 %i^x01 credite lui^x03 %s^x01."g_szTagszNameiCredits_szName );
    
    return 
PLUGIN_HANDLED;
    
    
}

public 
ClCmdFcsDonateid )
{
    if(  
get_pcvar_num(  g_iCvarTSEnable  )  !=  1  )
    {
        
ColorChatidRED"^x04%s^x01 Comanda dezactivata de catre server!",  g_szTag  );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFirstArg32 ], szSecondArg10 ];
    
        
read_argv1szFirstArgsizeof szFirstArg ) -);
    
read_argv2szSecondArgsizeof szSecondArg ) -);
    
    if( 
equalszFirstArg"" ) || equalszSecondArg"" ) )
    {
        
ColorChatidRED"^x04%s^x01 Folosire:^x03 /transfer^x01 sau^x03 /donate^x01 <^x03 nume^x01 > <^x03 credite^x01 >."g_szTag );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayer cmd_targetidszFirstArg);
    
    if( !
iPlayer  )
    {
        
ColorChatidRED"^x04%s^x01 Acel jucator nu a fost gasit."g_szTag );
        return 
PLUGIN_HANDLED;
    }
    
    
//if( iPlayer == id )
    //{
    //    ColorChat(  id,  RED, "^x04%s^x01 Nu-ti poti transfera credite.", g_szTag );
    //    return PLUGIN_HANDLED;
    //}
    
    
    
new iCredits;
    
iCredits str_to_numszSecondArg );
    
    
    if( 
iCredits <= )
    {
        
ColorChatidRED"^x04%s^x01 Trebuie sa introduci o valoare mai mare de 0."g_szTag );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iMaxCredits get_pcvar_numg_iCvarTSMaxCredits );
    if( 
iCredits iMaxCredits )
    {
        
ColorChatidRED"^x04%s^x01 Poti transfera maxim^x03 %i^x01 credit%s o data!"g_szTagiMaxCreditsiMaxCredits == "" "e" );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
g_iUserCreditsid ] <  iCredits  )
    {
        
ColorChat(  id,  RED"^x04%s^x01 Nu ai destule credite, ai doar^x03 %i credit%s^x01.",  g_szTagg_iUserCreditsid ], g_iUserCreditsid ] == "" "e"  );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iUserCreditsid ] -= iCredits;
    
g_iUserCreditsiPlayer ] += iCredits;
    
    
SaveCreditsid );
    
SaveCreditsiPlayer );
    
    new 
szFirstName32 ], szSecondName32 ];
    
    
get_user_nameidszFirstNamesizeof szFirstName )  -);
    
get_user_nameiPlayerszSecondNamesizeof szSecondName )  -);
    
    
ColorChat0RED"^x04%s^x03 %s^x01 i-a transferat^03 %i credit%s^x01 lui^x03 %s^x01 ."g_szTagszFirstNameiCreditsiCredits == "" "e"szSecondName );
    return 
PLUGIN_HANDLED;
}

public 
ham_SpawnPlayerPostid )
{
    if( 
is_user_aliveid ) )
        
g_iUserRetiredid ] = 0;
}

public 
Fwd_ClientUserInfoChangedidszBuffer )
{
    if ( !
is_user_connectedid ) ) 
        return 
FMRES_IGNORED;
    
    static 
szNewName32 ];
    
    
engfuncEngFunc_InfoKeyValueszBuffer"name"szNewNamesizeof szNewName ) -);
    
    if ( 
equalszNewNameg_szNameid ] ) )
        return 
FMRES_IGNORED;
    
    
SaveCredits(  id  );
    
    
ColorChatidRED"^x04%s^x01 Tocmai ti-ai schimbat numele din^x03 %s^x01 in^x03 %s^x01 !"g_szTagg_szNameid ], szNewName );
    
ColorChatidRED"^x04%s^x01 Am salvat^x03 %i^x01 credite pe numele^x03 %s^x01 !"g_szTagg_iUserCreditsid ], g_szNameid ] );
    
    
copyg_szNameid ], sizeof g_szName[] ) -1szNewName );
    
LoadCreditsid );
    
    
ColorChatidRED"^x04%s^x01 Am incarcat^x03 %i^x01 credite de pe noul nume (^x03 %s^x01 ) !"g_szTagg_iUserCreditsid ], g_szNameid ] );
    
    return 
FMRES_IGNORED;
}


public 
LoadCreditsid )
{
    
iVault  =  nvault_open(  "FurienCreditsSystem"  );
    
    if(  
iVault  ==  INVALID_HANDLE  )
    {
        
set_fail_state(  "nValut returned invalid handle!"  );
    }
    
    static 
szData256 ],  iTimestamp;
    
    if(  
nvault_lookupiVaultg_szNameid ], szDatasizeof szData ) -1iTimestamp ) )
    {
        static 
szCredits15 ];
        
parseszDataszCreditssizeof szCredits ) -);
        
g_iUserCreditsid ] = str_to_numszCredits );
        return;
    }
    else
    {
        
g_iUserCreditsid ] = get_pcvar_numg_iCvarEntry );
    }
    
    
nvault_closeiVault );
    
}


public 
SaveCredits(  id  )
{
    
    
iVault  =  nvault_open(  "FurienCreditsSystem"  );
    
    if(  
iVault  ==  INVALID_HANDLE  )
    {
        
set_fail_state(  "nValut returned invalid handle!"  );
    }
    
    static 
szData256 ];
    
formatexszDatasizeof szData ) -1"%i"g_iUserCreditsid ] );
    
    
nvault_setiVaultg_szNameid ], szData );
    
nvault_closeiVault );
}


public 
task_PTRFunctions( )
{
    if( 
get_pcvar_numg_iCvarPTREnable ) != )
        return;
        
    static 
iPlayers32 ];
    static 
iPlayersNum;
    
    
get_playersiPlayersiPlayersNum"ch" );
    if( !
iPlayersNum )
        return;
    
    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];
        
        
g_iUserTimeid ]++;
        static 
iTime;
        
iTime get_pcvar_numg_iCvarPTRMinutes ) ;
        
        if( 
g_iUserTimeid ] >= iTime 60 )
        {
            
g_iUserTimeid ] -= iTime 60;
            
            static 
iCredits;
            
iCredits get_pcvar_numg_iCvarPTRCredits );
            
            
g_iUserCreditsid ] += iCredits;
            
ColorChatidRED"^x04%s^x01 Ai primit^x03 %i^x01 credite pentru^x03 %i^x01 minute jucate!",
                
g_szTagiCreditsiTime );
                
            
SaveCreditsid );
                
        }
    }
    
}

public 
ev_DeathMsg( )
{
    if( 
get_pcvar_numg_iCvarKREnable ) != )
        return;
        
    new 
iKiller read_data);
    if( 
iKiller == read_data) )
        return;
        
    new 
iCredits get_pcvar_numg_iCvarKRCredits );
    
    if( 
read_data) )
        
iCredits += get_pcvar_numg_iCvarKRHSCredits );
        
    
g_iUserCreditsiKiller ] += iCredits;
    
SaveCreditsiKiller );
    
}


public 
ev_SendAudioTerWin( )
{
    static 
iCvarEnableiCvarFurienReward;
    
iCvarEnable get_pcvar_numg_iCvarWTREnable );
    
iCvarFurienReward get_pcvar_numg_iCvarWTRFurien );
    
    if( 
iCvarEnable != || iCvarFurienReward == )
        return;
        
    
GiveTeamRewardFCS_TEAM_FURIENiCvarFurienReward );
    
}


public 
ev_SendAudioCtWin( )
{
    
    static 
iCvarEnableiCvarAntiReward;
    
iCvarEnable get_pcvar_numg_iCvarWTREnable );
    
iCvarAntiReward get_pcvar_numg_iCvarWTRAnti );
    
    if( 
iCvarEnable != || iCvarAntiReward == )
        return;
        
    
GiveTeamRewardFCS_TEAM_ANTIFURIENiCvarAntiReward );
}

public 
GiveTeamReward( const CsTeams:iTeamiCredits )
{
    
    static 
iPlayers32 ];
    static 
iPlayersNum;
        
    
get_playersiPlayersiPlayersNum"ch" );
    if( !
iPlayersNum )
        return;
        
    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];
        if( 
cs_get_user_teamid ) == iTeam )
        {
            
ColorChatidRED"^x04%s^x01 Ai primit^x03 %i^x01 credit%s pentru castigarea rundei!"g_szTagiCreditsiCredits == "" "e" );
            
g_iUserCreditsid ] += iCredits;
        }
    }
}

public 
plugin_end( )
{
    
iVault  =  nvault_open(  "FurienCreditsSystem"  );
    
    if(  
iVault  ==  INVALID_HANDLE  )
    {
        
set_fail_state(  "nValut returned invalid handle!"  );
    }
    
    new 
iDays get_pcvar_numg_iCvarPruneDays );
    if( 
iDays )
    {
        
nvault_pruneiVault0get_systime( ) - ( iDays ONE_DAY_IN_SECONDS ) );
    }
    
    
nvault_closeiVault );
}

ColorChat(  idColor:iType, const msg[  ], { FloatSqlResult_}:...  )
{
    
    
// Daca nu se afla nici un jucator pe server oprim TOT. Altfel dam de erori..
    
if( !get_playersnum( ) ) return;
    
    new 
szMessage256 ];

    switch( 
iType )
    {
         
// Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
        
case NORMAL:    szMessage] = 0x01;
        
        
// Culoare Verde.
        
case GREEN:    szMessage] = 0x04;
        
        
// Alb, Rosu, Albastru.
        
default:     szMessage] = 0x03;
    }

    
vformat(  szMessage], 251msg4  );

    
// Ne asiguram ca mesajul nu este mai lung de 192 de caractere.Altfel pica server-ul.
    
szMessage192 ] = '^0';
    

    new 
iTeamiColorChangeiPlayerIndexMSG_Type;
    
    if( 
id )
    {
        
MSG_Type  =  MSG_ONE_UNRELIABLE;
        
iPlayerIndex  =  id;
    }
    else
    {
        
iPlayerIndex  =  CC_FindPlayer(  );
        
MSG_Type MSG_ALL;
    }
    
    
iTeam  =  get_user_teamiPlayerIndex );
    
iColorChange  =  CC_ColorSelection(  iPlayerIndex,  MSG_TypeiType);

    
CC_ShowColorMessage(  iPlayerIndexMSG_TypeszMessage  );
        
    if(  
iColorChange  )    CC_Team_Info(  iPlayerIndexMSG_Type,  TeamNameiTeam ]  );

}

CC_ShowColorMessage(  id, const iType, const szMessage[  ]  )
{
    
    static 
bool:bSayTextUsed;
    static 
iMsgSayText;
    
    if(  !
bSayTextUsed  )
    {
        
iMsgSayText  =  get_user_msgid"SayText" );
        
bSayTextUsed  =  true;
    }
    
    
message_beginiTypeiMsgSayText_id  );
    
write_byte(  id  );        
    
write_string(  szMessage  );
    
message_end(  );
}

CC_Team_Infoid, const iType, const szTeam[  ] )
{
    static 
bool:bTeamInfoUsed;
    static 
iMsgTeamInfo;
    if(  !
bTeamInfoUsed  )
    {
        
iMsgTeamInfo  =  get_user_msgid"TeamInfo" );
        
bTeamInfoUsed  =  true;
    }
    
    
message_beginiTypeiMsgTeamInfo_id  );
    
write_byte(  id  );
    
write_string(  szTeam  );
    
message_end(  );

    return 
PLUGIN_HANDLED;
}

CC_ColorSelection(  id, const iTypeColor:iColorType)
{
    switch(  
iColorType  )
    {
        
        case 
RED:    return CC_Team_Info(  idiTypeTeamName]  );
        case 
BLUE:    return CC_Team_Info(  idiTypeTeamName]  );
        case 
GREY:    return CC_Team_Info(  idiTypeTeamName]  );

    }

    return 
PLUGIN_CONTINUE;
}

CC_FindPlayer(  )
{
    new 
iMaxPlayers  =  get_maxplayers(  );
    
    for( new 
1<= iMaxPlayersi++ )
        if(  
is_user_connected)  )
            return 
i;
    
    return -
1;

PHP Code:
SLOT [300 Credite]
HELPER [900 Credite]
SUPERVISOR [1500 Credite]
MODERATOR [3500 Credite]
SUPER MODERATOR [6000 Credite]
ADMINISTRATOR [9000 Credite]
COMMANDER [15000 Credite]
SUPER COMMANDER [35000 Credite
AlexandruODT is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 05-03-2020 , 11:40   Re: BuyAdmin with random password automatic addition
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Buy ADmin"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define ADMIN_SLOT    16000

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /buyadmin""Buy")
}

public 
Buy(id)
{
    new 
menu menu_create("\rAdmin \y Buy \dMenu \w|""Commands");
    
         
menu_additemmenu"Owner [ \y350000 Credite \w]""0");
         
menu_additemmenu"Super Commander [ \y150000 Credite \w]""1");
         
menu_additemmenu"Commander [ \y75000 Credite \w]""2");
         
menu_additemmenu"Administrator [ \y15000 Credite \w]""3");
         
menu_additemmenu"Super Moderator [ \y9000 Credite \w]""4");
         
menu_additemmenu"Moderator [ \y6000 Credite \w]""5");
         
menu_additemmenu"Slot [ \y16000 Money \w]""6");
         
menu_additemmenu"Silver VIP [ \y450000 Credite \w]""7");
         
menu_additemmenu"Gold VIP [ \y200000 Credite \w]""8");

    
menu_setpropmenuMPROP_EXITMEXIT_ALL );   
     
    
menu_displayidmenu);  
}

public 
Commands(idmenuitem)
{
     if (
item == MENU_EXIT) { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED
    } 
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    new 
key str_to_num(data);
    
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
        
    
switch(key) {
        case 
1: { 
        
Admin_Slot(id);
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
Admin_Slot(id)
{
    new 
iMoney cs_get_user_money(id);
    
    if (
iMoney >= ADMIN_SLOT)
    {
        new 
szName[32]
        
get_user_name(idszName31)
        
        
cs_set_user_money(idiMoney ADMIN_SLOT)
        
        new 
rand random_num(0,14)
        
        switch(
rand)
        {
            case 
0: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcdefghijklmnopqrst^" ^"AsdteSF54Cf^"",szName)
            
client_print(idprint_chat,"Your Password is : AsdteSF54Cf")
            }
            case 
1: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefghijlmnopqrst^" ^"SghufdS6542Df^"",szName)
            
client_print(idprint_chat,"Your Password is : SghufdS6542Df")
            }
            case 
2: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefghijlmnopqrs^" ^"65SDF4Eas^"",szName)
            
client_print(idprint_chat,"Your Password is : 65SDF4Eas")
            }
            case 
3: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijlmnopqr^" ^"54aASD21rf26^"",szName)
            
client_print(idprint_chat,"Your Password is : 54aASD21rf26")
            }
            case 
4: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijmnop^" ^"WsdaW458Swda^"",szName)
            
client_print(idprint_chat,"Your Password is : WsdaW458Swda")
            }
            case 
5: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijmn^" ^"@Easdas251ds^"",szName)
            
client_print(idprint_chat,"Your Password is : @Easdas251ds")
            }
            case 
6: {
            
server_cmd("amx_addadmin ^"%s^" ^"abxu^" ^"asdjndfESDF51^"",szName)
            
client_print(idprint_chat,"Your Password is : asdjndfESDF51")
            }
            case 
7: {
            
server_cmd("amx_addadmin ^"%s^" ^"abx^" ^"BNMtrdf1585x^"",szName)
            
client_print(idprint_chat,"Your Password is : BNMtrdf1585x")
            }
            case 
8: {
            
server_cmd("amx_addadmin ^"%s^" ^"b^" ^"BNMtrdf1585x^"",szName)
            
client_print(idprint_chat,"Your Password is : BNMtrdf1585x")
            }
        }
    }
    return 
PLUGIN_HANDLED


Last edited by alferd; 05-03-2020 at 12:14.
alferd is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 05-03-2020 , 11:44   Re: BuyAdmin with random password automatic addition
Reply With Quote #5

Is it okay written to tomorrow?
My This time is midnight now.

@alferd, why 15 pattern? is not random...
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
AlexandruODT
Member
Join Date: May 2020
Old 05-03-2020 , 12:04   Re: BuyAdmin with random password automatic addition
Reply With Quote #6

Compile error

PHP Code:
warning 217loose indentation
warning 217
loose indentation
warning 217
loose indentation
warning 217
loose indentation
error 017
undefined symbol "get_user_credits"
error 017undefined symbol "set_user_credits"
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
error 035argument type mismatch (argument 2)
//
// 11 Errors.
// Could not locate output file compiled\new_buyadmin.amx (compile failed).
//
// Compilation Time: 0.2 sec 
Plugin:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Buy ADmin"
#define VERSION "1.0"
#define AUTHOR "AlferD"

#define ADMIN_SLOT    300

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /buyadmin""Buy")
}

public 
Buy(id)
{
    new 
menu menu_create("\rAdmin \y Buy \dMenu \w|""Commands");
    
         
menu_additemmenu"Owner [ \y350000 Credite \w]""0");
         
menu_additemmenu"Super Commander [ \y150000 Credite \w]""1");
         
menu_additemmenu"Commander [ \y75000 Credite \w]""2");
         
menu_additemmenu"Administrator [ \y15000 Credite \w]""3");
         
menu_additemmenu"Super Moderator [ \y9000 Credite \w]""4");
         
menu_additemmenu"Moderator [ \y6000 Credite \w]""5");
         
menu_additemmenu"Slot [ \y900 Credite \w]""6");
         
menu_additemmenu"Silver VIP [ \y450000 Credite \w]""7");
         
menu_additemmenu"Gold VIP [ \y200000 Credite \w]""8");

    
menu_setpropmenuMPROP_EXITMEXIT_ALL );   
     
    
menu_displayidmenu);  
}

public 
Commands(idmenuitem)
{
     if (
item == MENU_EXIT) { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED
    } 
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    new 
key str_to_num(data);
    
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
        
    
switch(key) {
        case 
1: { 
        
Admin_Slot(id);
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
Admin_Slot(id)
{
    new 
iMoney get_user_credits(id);
    
    if (
iMoney >= ADMIN_SLOT)
    {
        new 
szName[32]
        
get_user_name(idszName31)
        
        
set_user_credits(idiMoney ADMIN_SLOT)
        
        new 
rand random_num(0,14)
        
        switch(
rand)
        {
            case 
0: {
            
server_cmd("amx_addadmin ^"%s^" ^"abcdefghijklmnopqrst^" ^"AsdteSF54Cf^"",szName)
            
client_print(id"Your Password is : AsdteSF54Cf")
            }
            case 
1: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefghijlmnopqrst^" ^"SghufdS6542Df^"",szName)
            
client_print(id"Your Password is : SghufdS6542Df")
            }
            case 
2: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefghijlmnopqrs^" ^"65SDF4Eas^"",szName)
            
client_print(id"Your Password is : 65SDF4Eas")
            }
            case 
3: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijlmnopqr^" ^"54aASD21rf26^"",szName)
            
client_print(id"Your Password is : 54aASD21rf26")
            }
            case 
4: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijmnop^" ^"WsdaW458Swda^"",szName)
            
client_print(id"Your Password is : WsdaW458Swda")
            }
            case 
5: {
            
server_cmd("amx_addadmin ^"%s^" ^"bcdefgijmn^" ^"@Easdas251ds^"",szName)
            
client_print(id"Your Password is : @Easdas251ds")
            }
            case 
6: {
            
server_cmd("amx_addadmin ^"%s^" ^"abxu^" ^"asdjndfESDF51^"",szName)
            
client_print(id"Your Password is : asdjndfESDF51")
            }
            case 
7: {
            
server_cmd("amx_addadmin ^"%s^" ^"abx^" ^"BNMtrdf1585x^"",szName)
            
client_print(id"Your Password is : BNMtrdf1585x")
            }
            case 
8: {
            
server_cmd("amx_addadmin ^"%s^" ^"b^" ^"BNMtrdf1585x^"",szName)
            
client_print(id"Your Password is : BNMtrdf1585x")
            }
        }
    }
    return 
PLUGIN_HANDLED

The "native" from the credit plugin:

PHP Code:
native fcs_get_user_credits(client);
native fcs_set_user_credits(clientcredits); 

Last edited by AlexandruODT; 05-03-2020 at 12:11.
AlexandruODT is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-03-2020 , 12:09   Re: BuyAdmin with random password automatic addition
Reply With Quote #7

alferd, you can generate truly random passwords. First param controls password length.

PHP Code:
new szPassword16 ] , iLen;

//Constant length
iLen GeneratePasswordcharsmaxszPassword ) , szPasswordcharsmaxszPassword ) );

//Random length, with 5 being the minimum
iLen GeneratePasswordrandom_numsizeofszPassword ) ) , szPassword charsmaxszPassword ) );

GeneratePasswordiPasswordLength szPassword[] , maxchars )
{
    new 
iPasswordPos iCharType;
    
    new const 
AsciiCodes[][] = 
    {
        { 
48 57 }, // 0 - 9
        
97 122 }, // a - z
        
65 90 // A - Z
    
};
    
    while ( ( 
iPasswordPos iPasswordLength ) && ( iPasswordPos maxchars ) )
    {
        
iCharType randomsizeofAsciiCodes ) );
        
szPasswordiPasswordPos++ ] = random_numAsciiCodesiCharType ][ ] , AsciiCodesiCharType ][ ] );
    }
    
    return 
iPasswordPos;

__________________

Last edited by Bugsy; 05-03-2020 at 12:13.
Bugsy is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-03-2020 , 12:10   Re: BuyAdmin with random password automatic addition
Reply With Quote #8

RIP Programming.

So when buying admin, you randomly got Full admin or Slot?

Alfred, gain some experience for your self before trying to help people.
__________________
Retired.
Xalus is offline
AlexandruODT
Member
Join Date: May 2020
Old 05-03-2020 , 12:17   Re: BuyAdmin with random password automatic addition
Reply With Quote #9

Here's the picture



I typed "/ buyadmin" and the menu appeared
and I want when you buy to take the credits you have and to automatically add in the user.ini the respective admin with a random password

I want to add this menu to this plugin:

PHP Code:
#include < amxmodx >
#include < amxmisc >


// ----------------------------------------
// ---    De aici modifici nativele tale    ---
// ----------------------------------------
native fcs_get_user_credits(client);
native fcs_set_user_credits(clientCredits);


// FLAG-urile pe care le ofera
#define FLAGS_TO_BUY    "abcdefghijklmnopqrst"

// Pretul adminului
#define PRICE_ADMIN    350000

public plugin_init() {
    
register_clcmd("say /buyowner""buy_admin");
}

public 
buy_admin(id) {
    if(
is_user_admin(id)) {
        
client_print(idprint_chat"[BUY ADMIN] Ai deja admin");
        return 
1;
    }

    if(
fcs_get_user_credits(id) < PRICE_ADMIN) {
        
client_print(idprint_chat"[BUY ADMIN] Nu ai suficiente credite");
        return 
1;
    }

    
fcs_set_user_credits(idfcs_get_user_credits(id)-PRICE_ADMIN);
    new 
name[32];    get_user_name(idname31);
    new 
pass[5];    formatex(passcharsmax(pass), "%c%c%c%c"random_num('A''Z'), random_num('a''z'), random_num('A''Z'), random_num('a''z'));
    new 
file[128];    formatex(filecharsmax(file), "^"%s^" ^"%s^" ^"%s^" ^"a^""namepassFLAGS_TO_BUY);
    
write_file("addons/amxmodx/configs/users.ini"file);
    
client_print(idprint_console"PAROLA: %s"pass);
    
server_cmd("amx_reloadadmins");
    return 
0;

This plugin only works for the rank I added there:
meaning:
#define FLAGS_TO_BUY "abcdefghijklmnopqrst"

// The price of the admin
#define PRICE_ADMIN 350000

I mean I want a plugin with that menu to buy admin with credits and to be automatically added to user.ini with a password generated by the plugin

Please help

Last edited by AlexandruODT; 05-03-2020 at 13:17.
AlexandruODT is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 05-03-2020 , 18:13   Re: BuyAdmin with random password automatic addition
Reply With Quote #10

PHP Code:
#include <amxmodx>
#pragma semicolon 1

native fcs_get_user_credits(client);
native fcs_set_user_credits(clientcredits);

#define PLUGIN "Credits Shop"
#define VERSION "0.1"
#define AUTHOR "zEr0"
#if !defined MAX_AUTHID_LENGTH
    #define MAX_AUTHID_LENGTH 64
#endif

new const Prefix[] = "[BUY ADMIN]";

//
// Replace Your Access Level.
//
new const FLAG_LIST[][] =
{
    
"b"// SLOT
    
"abx"// SILVER VIP
    
"abxu"// GOLD VIP
    
"bcdefgijmn"// MODERATOR
    
"bcdefgijmnop"// SUPER MODERATOR
    
"bcdefgijlmnopqr"// ADMINISTRATOR
    
"bcdefghijlmnopqrs"// COMMANDER
    
"bcdefghijlmnopqrst"// SUPER COMMANDER
    
"abcdefghijklmnopqrst" // OWNER
};

new const 
COST[] = 
{
    
900
    
200000,
    
350000,
    
6000,
    
9000,
    
12000,
    
15000,
    
20000,
    
150000
};

new const 
BUY_LIST[][] =
{
    
"SLOT",
    
"HELPER",
    
"SUPERVISOR",
    
"MODERATOR",
    
"SUPER MODERATOR",
    
"ADMINISTRATOR",
    
"COMMANDER",
    
"SUPER COMMANDER",
    
"OWNER"
};

new 
g_PField;
public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
//Register Shop
    
register_clcmd("say /buyadmin""buyadmin" );
    
register_clcmd("say buyadmin""buyadmin" );
    
register_clcmd("say_team /buyadmin""buyadmin" );
    
register_clcmd("say_team buyadmin""buyadmin" );

    
g_PField get_cvar_pointer("amx_password_field");    
}

public 
buyadmin (id
{
    
    new 
sTemp[101]; 
    new 
sInfo[3];

    
formatex(sTempcharsmax(sTemp), "SHOP ADMIN [ LLG ]:^nCreditele Tale: %d"fcs_get_user_credits(id)); 
    new 
menu menu_create(sTemp"buyadminc");

    for(new 
0sizeof(BUY_LIST); i++)
    {
        
num_to_str(isInfocharsmax(sInfo));
        
formatex(sTempcharsmax(sTemp), "%s [ \r%i Credite\w ]"BUY_LIST[i], COST[i]);
        
menu_additem(menusTempsInfo0);
    }    

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}


public 
buyadminc(idmenuitem
{
    
    if( 
item == MENU_EXIT )
        return 
PLUGIN_HANDLED;
    
    new 
data [6], szName[64], name[32];
    new 
accesscallback;

    
menu_item_getinfo(menuitemaccessdatacharsmax(data), szNamecharsmax(szName), callback);
    
get_user_name(idnamecharsmax(name));

    if (
fcs_get_user_credits(id) < COST[item])
    {
        
client_print(idprint_chat"%s Nu ai suficiente Credite."Prefix);
        return 
PLUGIN_HANDLED;
    }

    
fcs_set_user_credits(idfcs_get_user_credits(id) - COST[item]);

    new 
pass[16];
    new 
authid[MAX_AUTHID_LENGTH];
    new 
pField[32];
    
get_pcvar_string(g_PFieldpFieldcharsmax(pField));
    
get_user_authid(idauthidcharsmax(authid));

    
GeneratePassword(8passcharsmax(pass));

    
// <playername|auth> <accessflags> [password] [authtype]
    
server_cmd("amx_addadmin ^"%s^" ^"%s^" ^"%s^" ^"%s^""authidFLAG_LIST[item], pass"c");
    
server_cmd("amx_kick #%i ^"(Your Admin Passwordsetinfo %%s)^""idpFieldpass);

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;    
}

// 
// @Bugsy's Logic.
// 
GeneratePassword(iPasswordLengthszPassword[], maxchars)
{
    new 
iPasswordPosiCharType;
    
    new const 
AsciiCodes[][] = 
    {
        { 
3364 },     // ! " # $ % & ' ( ) * + , - . / 0 - 9 : ; < = > ? @
        
97122 },    // a - z
        
6590 }      // A - Z
    
};
    
    while ((
iPasswordPos iPasswordLength) && (iPasswordPos maxchars))
    {
        
iCharType random(sizeof(AsciiCodes));
        
szPassword[iPasswordPos++] = random_num(AsciiCodes[iCharType][0], AsciiCodes[iCharType][1]);
    }
    
    return 
iPasswordPos;


/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 05-04-2020 at 09:51.
+ARUKARI- 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 13:11.


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