Cerere modificare bank sistem

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

01 Dec 2013, 20:47

Salut !
As vrea sa-mi modificati si mie pluginul de bank sistem astfel incat:
1. Sa scoateti meniul pe care il am la /bank
2. Sa scaoteti partea cu register.
3. Sa adaugati in loc de menu asa:
3.a) Cand scriu /depozit <suma> sa depozitez banii
3.b) Cand scriu /retrage <suma> sa retrag banii.
4.Sa adaugati ( Daca vreti, daca nu adaug eu ) un HUD care sa arate cati banii ai ( atat celor care stau spec pe tine cat si tie )
Poftim Sursa | Afiseaza codul
/*

NEW Bank System Ultimate.

Author: ExoTiQ
Link Official: http://www.extreamcs.com/forum

First release 17.06.2013. MySQL Version. [Private]
Final release 05.07.2013. Work on File's [Public]

Plugin este mai simplu de cat versiunea V1.0 , am folosit doar Work on file's.
*
Update V2.0 - 
1) Posibilitate de a schimba Nick-Name 
2) Protectie de la ghicirea parolei. (Se seteaza in CVAR)
3) Posibilitate de a transfera banii altui user.

********

Thank for BETA-TEST , to Calash,Bos93,Gabriel963

*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "BANK-System"
#define VERSION "2.0"
#define AUTHOR "ExoTiQ"

new g_LoadFile[81]
new szReg[33], szAuth[33], szMoney[33]
new szInvalidPassword[33]
new szTransferMoney[33]

new g_Cvar[2]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd("say /bank", "BankMenu")
    register_clcmd("say_team /bank", "BankMenu")
    register_clcmd("say /depozit", "BankMenu")
    register_clcmd("say_team /depozit", "BankMenu")

    g_Cvar[1] = register_cvar("bank_invalid_password", "3")    // Limita maxima de incercari (default:3) 
                                                                       //daca scrii mai mult de 3 ori parola incorecta,primesti kick.

    register_clcmd("make_amount", "MakeMoney")
    register_clcmd("withdraw_amount", "WithdrawMoney")
    register_clcmd("auth_password", "AuthPlayer")
    register_clcmd("reg_password", "RegPlayer")
    register_clcmd("edit_password", "EditPassword")
    register_clcmd("transfer_amount", "TransferAmount")

    register_dictionary("BANK-System.txt")
}

public client_disconnect(id)
{
    szReg[id] = false
    szAuth[id] = false
    szMoney[id] = 0
    szInvalidPassword[id] = 0
    szTransferMoney[id] = 0
}

public plugin_cfg()
{
    get_configsdir(g_LoadFile, 81)
    format(g_LoadFile, 80, "%s/BANK-System-Users.ini", g_LoadFile)     // Fisierul unde se salveaza Nick si Parola.
}

public client_connect(id)
{
    set_task(2.0, "CheckPlayer", id)
}

public CheckPlayer(id)    // Func verifica daca jucatorul este intregistrat.
{
    new szParseText[41], szParseName[32]
    new szName[32]
    new szLine, szNum

    get_user_name(id, szName, charsmax( szName ))

    for(szLine=0;read_file(g_LoadFile, szLine, szParseText, 41, szNum);szLine++) 
    {
        parse(szParseText, szParseName, charsmax( szParseName ))

        if(szNum > 0  && szParseText[0] != ';')
        {
            if(equali(szName, szParseName))
            {
                szReg[id] = true
                break
            }
        }
    }
}

public BankMenu(id)    
{
    if(szReg[id])
    {
        if(szAuth[id])
        {
            new szText[555]

            formatex( szText, charsmax( szText ), "%L", id, "BANK_AUTHYES_TITLE", szMoney[id])
            new menu = menu_create( szText, "BankMenu_handler" )

            formatex( szText, charsmax( szText ), "%L", id, "AUTHYES_ITEM_1")
            menu_additem( menu, szText, "1", 0 )

            if(szMoney[id])
            {
                formatex( szText, charsmax( szText ), "%L", id, "AUTHYES_ITEM_2")
                menu_additem( menu, szText, "2", 0 )
            }else{
                formatex( szText, charsmax( szText ), "%L", id, "AUTHYES_ITEM_2")
                menu_additem( menu, szText, "2", ADMIN_ADMIN )
            }

            formatex( szText, charsmax( szText ), "%L", id, "AUTHYES_ITEM_3")
            menu_additem( menu, szText, "3", 0 )

            formatex( szText, charsmax( szText ), "%L", id, "AUTHYES_ITEM_4")
            menu_additem( menu, szText, "4", 0 )

            menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
            menu_setprop( menu, MPROP_NEXTNAME, "Next")
            menu_setprop( menu, MPROP_BACKNAME, "Back")
            menu_setprop( menu, MPROP_EXITNAME, "Iesire")

            menu_display( id, menu, 0 )
        }else{
            new szText[555]

            formatex( szText, charsmax( szText ), "%L", id, "BANK_AUTHNO_TITLE")
            new menu = menu_create( szText, "BankMenu_handler" )

            formatex( szText, charsmax( szText ), "%L", id, "AUTHNO_ITEM_1")
            menu_additem( menu, szText, "1", 0 )

            menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
            menu_setprop( menu, MPROP_NEXTNAME, "Next")
            menu_setprop( menu, MPROP_BACKNAME, "Back")
            menu_setprop( menu, MPROP_EXITNAME, "Iesire")

            menu_display( id, menu, 0 )
        }
    }else{
        new szText[555]

        formatex( szText, charsmax( szText ), "%L", id, "BANK_REG_TITLE")
        new menu = menu_create( szText, "BankMenu_handler" )

        formatex( szText, charsmax( szText ), "%L", id, "REG_ITEM_1")
        menu_additem( menu, szText, "1", 0 )

        menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
        menu_setprop( menu, MPROP_NEXTNAME, "Next")
        menu_setprop( menu, MPROP_BACKNAME, "Back")
        menu_setprop( menu, MPROP_EXITNAME, "Iesire")

        menu_display( id, menu, 0 )
    }
}

public BankMenu_handler( id, menu, item )
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    new szData[6], szName[64], szAccess, szCallback
    menu_item_getinfo(menu, item, szAccess, szData, charsmax( szData ), szName, charsmax( szName ), szCallback)

    new szKey = str_to_num( szData )
    
    switch( szKey )
    {
        case 1:
        {
            if(szReg[id])
            {
                if(szAuth[id])
                {
                    client_cmd(id, "messagemode make_amount") 
                }else{
                    client_cmd(id, "messagemode auth_password") 
                }
            }else{
                client_cmd(id, "messagemode reg_password") 
            }
        }

        case 2:
        {
            client_cmd(id, "messagemode withdraw_amount") 
        }

        case 3:
        {
            client_cmd(id, "messagemode transfer_amount") 
        }

        case 4:
        {
            client_cmd(id, "messagemode edit_password") 
        }
    }
    return PLUGIN_HANDLED
}

public MakeMoney(id)
{
    if(!szReg[id])
    {
        ChatColor(id, "%L", 0, "BANK_NOREG")
        return PLUGIN_HANDLED
    }

    if(!szAuth[id])
    {
        ChatColor(id, "%L", 0, "BANK_NOAUTH")
        return PLUGIN_HANDLED
    }

    new szParam[10]
    read_args(szParam, 9)
    remove_quotes(szParam)
       
    if(strlen( szParam ) == 0)
    {
        ChatColor(id, "%L", id, "BANK_NOTEXT")
        return PLUGIN_HANDLED
    }

    for(new x; x < strlen( szParam ); x++)
    {
        if(!isdigit( szParam[x] ))
        {
            ChatColor(id, "%L", 0, "BANK_NONUMBER")
            return PLUGIN_HANDLED
        }
    }
       
    new szAmount = str_to_num( szParam )
       
    if (cs_get_user_money(id) < szAmount)
    {
        ChatColor(id, "%L", 0, "BANK_NOMONEY")
        return PLUGIN_HANDLED
    }
       
    UpdateMoney(id, 1, szAmount)

    return PLUGIN_HANDLED
}

public WithdrawMoney(id)
{
    if(!szReg[id])
    {
        ChatColor(id, "%L", 0, "BANK_NOREG")
        return PLUGIN_HANDLED
    }

    if(!szAuth[id])
    {
        ChatColor(id, "%L", 0, "BANK_NOAUTH")
        return PLUGIN_HANDLED
    }

    new szParam[10]
    read_args(szParam, 9)
    remove_quotes(szParam)
       
    if(strlen( szParam ) == 0)
    {
        ChatColor(id, "%L", id, "BANK_NOTEXT")
        return PLUGIN_HANDLED
    }

    for(new x; x < strlen( szParam ); x++)
    {
        if(!isdigit( szParam[x] ))
        {
            ChatColor(id, "%L", 0, "BANK_NONUMBER")
            return PLUGIN_HANDLED
        }
    }
       
    new szAmount = str_to_num( szParam )
       
    if (szMoney[id] < szAmount)
    {
        ChatColor(id, "%L", 0, "BANK_NOMONEY")
        return PLUGIN_HANDLED
    }
       
    UpdateMoney(id, 2, szAmount)

    return PLUGIN_HANDLED
}

public UpdateMoney(id, type, amount)
{
    new szParseText[41], szParseName[32], szParsePassword[32], szParseMoney[32]
    new szName[32]
    new szLine, szNum

    get_user_name(id, szName, charsmax( szName ))

    for(szLine=0;read_file(g_LoadFile, szLine, szParseText, 41, szNum);szLine++) 
    {
        parse(szParseText, szParseName, charsmax( szParseName ), szParsePassword, charsmax( szParsePassword ), szParseMoney, charsmax( szParseMoney ))
    
        if(szNum > 0  && szParseText[0] != ';')
        {
            if(equali(szName, szParseName))
            {
                if(type == 1)
                {
                    new szText[512], szNewMoney
    
                    szNewMoney = str_to_num( szParseMoney ) + amount
                    cs_set_user_money(id, cs_get_user_money(id) - amount)
                    szMoney[id]  = szMoney[id] + amount

                    formatex(szText, charsmax( szText ), "^"%s^" ^"%s^" ^"%d^"", szParseName, szParsePassword, szNewMoney)
                    write_file(g_LoadFile, szText, szLine)

                    ChatColor(id, "%L", 0, "BANK_MAKE_GOOD", amount)
                }else
                if(type == 2)
                {
                    new szText[512], szNewMoney
    
                    szNewMoney = str_to_num( szParseMoney ) - amount
                    cs_set_user_money(id, cs_get_user_money(id) + amount)
                    szMoney[id]  = szMoney[id] - amount

                    formatex(szText, charsmax( szText ), "^"%s^" ^"%s^" ^"%d^"", szParseName, szParsePassword, szNewMoney)
                    write_file(g_LoadFile, szText, szLine)

                    ChatColor(id, "%L", 0, "BANK_WITGDRAW_GOOD", amount)
                }
            }
        }
    }
}

public AuthPlayer(id)
{
    if(szReg[id])
    {
        if(!szAuth[id])
        {
            new szArgsPassword[32]
    
               read_args(szArgsPassword, 31)
               remove_quotes(szArgsPassword)
               
            if(strlen( szArgsPassword ) == 0)
            {
                ChatColor(id, "%L", id, "BANK_NOTEXT")
                return PLUGIN_HANDLED
            }
        
            new szParseText[41], szParseName[32], szParsePassword[32], szParseMoney[32]
            new szName[32]
            new szLine, szNum
            new szNumMoney
    
            get_user_name(id, szName, charsmax( szName ))
    
            for(szLine=0;read_file(g_LoadFile, szLine, szParseText, 41, szNum);szLine++) 
            {
                parse(szParseText, szParseName, charsmax( szParseName ), szParsePassword, charsmax( szParsePassword ), szParseMoney, charsmax( szParseMoney ))
        
                if(szNum > 0  && szParseText[0] != ';')
                {
                    if(equali(szName, szParseName))
                    {
                        if(equali(szParsePassword, szArgsPassword))
                        {
                            szAuth[id] = true
                            
                            szNumMoney = str_to_num( szParseMoney )
                            szMoney[id] = szNumMoney
    
                            ChatColor(id, "%L", id, "BANK_AUTH_GOOD", szMoney[id])
                        }else{
                            ++szInvalidPassword[id]

                            if(szInvalidPassword[id] < get_pcvar_num( g_Cvar[1] ))
                            {
                                ChatColor(id, "%L", id, "BANK_AUTH_FAIL", get_pcvar_num( g_Cvar[1] ) - szInvalidPassword[id])
                                return PLUGIN_HANDLED
                            }else{
                                server_cmd("kick #%d ^"%L^" ", get_user_userid(id), 0, "BANK_KICK")
                                return PLUGIN_HANDLED
                            }
                        }
                    }
                }
            }
        }else{
            ChatColor(id, "%L", 0, "BANK_AUTH")
            return PLUGIN_HANDLED
        }
    }else{
        ChatColor(id, "%L", 0, "BANK_NOREG")
        return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

public RegPlayer(id)
{
    if(!szReg[id])
    {
        new szArgsPassword[32]
    
        read_args(szArgsPassword, 31)
        remove_quotes(szArgsPassword)
               
        if(strlen( szArgsPassword ) == 0)
        {
            ChatColor(id, "%L", id, "BANK_NOTEXT")
            return PLUGIN_HANDLED
        }

        new szText[512]
        new szName[32]

        get_user_name(id, szName, charsmax( szName ))

        formatex(szText, charsmax( szText ), "^"%s^" ^"%s^" ^"0^"", szName, szArgsPassword)
        write_file(g_LoadFile, szText, -1)

        szReg[id] = true
        szAuth[id] = true

        ChatColor(id, "%L", 0, "BANK_REG_GOOD", szArgsPassword)
    }else{
        ChatColor(id, "%L", 0, "BANK_REG")
        return PLUGIN_HANDLED
    }

    return PLUGIN_HANDLED
}

public EditPassword(id)
{
    if(szReg[id])
    {
        if(szAuth[id])
        {
            new szNewPassword[32]
    
            read_args(szNewPassword, 31)
            remove_quotes(szNewPassword)
               
            if(strlen( szNewPassword ) == 0)
            {
                ChatColor(id, "%L", id, "BANK_NOTEXT")
                return PLUGIN_HANDLED
            }

            new szParseText[41], szParseName[32], szParsePassword[32], szParseMoney[32]
            new szName[32]
            new szLine, szNum
    
            get_user_name(id, szName, charsmax( szName ))
    
            for(szLine=0;read_file(g_LoadFile, szLine, szParseText, 41, szNum);szLine++) 
            {
                parse(szParseText, szParseName, charsmax( szParseName ), szParsePassword, charsmax( szParsePassword ), szParseMoney, charsmax( szParseMoney ))
        
                if(szNum > 0  && szParseText[0] != ';')
                {
                    if(equali(szName, szParseName))
                    {
                        new szText[512]

                        formatex(szText, charsmax( szText ), "^"%s^" ^"%s^" ^"%s^"", szName, szNewPassword, szParseMoney)
                        write_file(g_LoadFile, szText, szLine)

                        ChatColor(id, "%L", id, "BANK_EDITPASSWORD_GOOD", szNewPassword)
                        break
                    }
                }
            }
        }else{
            ChatColor(id, "%L", 0, "BANK_NOAUTH")
            return PLUGIN_HANDLED
        }
    }else{
        ChatColor(id, "%L", 0, "BANK_NOREG")
        return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

public TransferAmount(id)
{
    new szParam[10]
    
    read_args(szParam, 9)
    remove_quotes(szParam)

    if(strlen( szParam ) == 0)
    {
        ChatColor(id, "%L", id, "BANK_NOTEXT")
        return PLUGIN_HANDLED
    }

    for(new x; x < strlen( szParam ); x++)
    {
        if(!isdigit( szParam[x] ))
        {
            ChatColor(id, "%L", 0, "BANK_NONUMBER")
            return PLUGIN_HANDLED
        }
    }

    new szAmount = str_to_num( szParam )

    if (szMoney[id] < szAmount)
    {
        ChatColor(id, "%L", 0, "BANK_NOMONEY")
        return PLUGIN_HANDLED
    }

    szTransferMoney[id] = szAmount
    TransferPlayer(id)

    return PLUGIN_HANDLED
}

public TransferPlayer(id)
{
    new szText[555]

    formatex( szText, charsmax( szText ), "%L", id, "BANK_TRANSFERMENU_TITLE")
    new menu = menu_create( szText, "TransferPlayer_handler" )

    new szPlayers[32], szName[32], szPlayer[10]
    new szNum, Player

    get_players(szPlayers, szNum)

    for (new i; i < szNum; i++)
    { 
        Player = szPlayers

        if(Player == id || is_user_bot(id))
            continue

        get_user_name(Player, szName, charsmax( szName ))
            num_to_str(Player, szPlayer, charsmax( szPlayer ))

        if(!szReg[Player])
        {
            formatex( szText, charsmax( szText ), "%s %L", szName, id, "BANK_NOPLAYERREG")
                menu_additem(menu, szText , szPlayer, ADMIN_ADMIN)
        }else{
            formatex( szText, charsmax( szText ), "%s - \d[ \r%i \d]", szName, szMoney[Player])
                menu_additem(menu, szText, szPlayer, 0)
        }
        }

    menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
    menu_setprop( menu, MPROP_NEXTNAME, "Next")
    menu_setprop( menu, MPROP_BACKNAME, "Back")
    menu_setprop( menu, MPROP_EXITNAME, "Iesire")

    menu_display( id, menu, 0 )
}

public TransferPlayer_handler( id, menu, item )
{
    if (item == MENU_EXIT)
    {
        szTransferMoney[id] = 0

        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    new szData[6], szName[64], szAccess, szCallback
    menu_item_getinfo(menu, item, szAccess, szData, charsmax( szData ), szName, charsmax( szName ), szCallback)

    new Player = str_to_num( szData )

    szMoney[Player] = szMoney[Player] + szTransferMoney[id]
    szMoney[id] = szMoney[id] - szTransferMoney[id]

    new szNameTr[32], szNameTd[32]
    
    get_user_name(id, szNameTr, charsmax( szNameTr ))
    get_user_name(Player, szNameTd, charsmax( szNameTd ))

    ChatColor(0, "%L", 0, "BANK_TRANSFER_GOOD", szNameTr, szNameTd, szTransferMoney[id])

    szTransferMoney[id] = 0

        menu_destroy(menu)
        return PLUGIN_HANDLED
}

public client_infochanged(id)
{
    szReg[id] = false
    szAuth[id] = false
    szMoney[id] = 0

    set_task(1.0, "CheckPlayer", id)
}

stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4")
    replace_all(msg, 190, "!y", "^1")
    replace_all(msg, 190, "!t", "^3")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
            for (new i = 0; i < count; i++)
            {
            if (is_user_connected(players))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players);
                        write_byte(players);
                        write_string(msg);
                        message_end();
            }
            }
    }
}



Multumesc anticipat !
Contact: Activitate scazuta.
Post Reply

Return to “Cereri”

  • Information