Modificare plugin BuyAdmin

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Alexandru P.
Membru, skill 0
Membru, skill 0
Posts: 77
Joined: 10 Apr 2020, 11:27
Detinator Steam: Da
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: CS.BHZD.RO
Fond eXtream: 0
Has thanked: 7 times
Contact:

04 Aug 2020, 16:56

| Afiseaza codul
#include <amxmodx>
#pragma semicolon 1

native fcs_get_user_credits(client);
native fcs_set_user_credits(client, credits);

#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", // V.I.P
    "bcdefgmh", // HELPER
	"bcdefghim", // ADMINISTRATOR
	"bcdefghijm", // MODERATOR
    "bcdefghijlm", // SUPER MODERATOR
    "bcdefghijlmn", // GOD
	"bcdefghijlmnop", // CO OWNER
	"bcdefghijklmnopq", // OWNER
	"abcdefghijklmnopqrx", // OWNER +VIP
    "z" // PREFIX
};

new const COST[] =
{
    300000,
    350000000,
    13000000,
	16000000,
	22000000,
    28000000,
    54000000,
	280000000,
	628000000,
	850000000,
	500000
};

new const BUY_LIST[][] =
{
    "SLOT",
    "V.I.P",
    "HELPER",
	"ADMINISTRATOR",
	"MODERATOR",
    "SUPER MODERATOR",
    "GOD",
	"CO OWNER",
	"OWNER",
	"OWNER + VIP",
	"PREFIX"
};

new g_PField;
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);

    //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(sTemp, charsmax(sTemp), "SHOP ADMIN [ CS.DEADLY.RO ]:^nCreditele Tale: %d", fcs_get_user_credits(id));
    new menu = menu_create(sTemp, "buyadminc");

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

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}


public buyadminc(id, menu, item)
{

    if( item == MENU_EXIT )
        return PLUGIN_HANDLED;

    new data [6], szName[64], name[32];
    new access, callback;

    menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback);
    get_user_name(id, name, charsmax(name));

    if (fcs_get_user_credits(id) < COST[item])
    {
        client_print(id, print_chat, "%s Nu ai suficiente credite pentru a cumpara admin.", Prefix);
        return PLUGIN_HANDLED;
    }

    fcs_set_user_credits(id, fcs_get_user_credits(id) - COST[item]);

    new pass[16];
    new authid[MAX_AUTHID_LENGTH];
    new pField[32], userid;
    get_pcvar_string(g_PField, pField, charsmax(pField));
    get_user_authid(id, authid, charsmax(authid));
    userid = get_user_userid(id);
    GeneratePassword(8, pass, charsmax(pass));
    console_print(id, "You Admin Password is^n*********^nsetinfo %s ^"%s^"^n*********", pField, pass);
    // <playername|auth> <accessflags> [password] [authtype]
    server_cmd("amx_addadmin ^"%s^" ^"%s^" ^"%s^" ^"steamid^"", authid, FLAG_LIST[item], pass);
    server_cmd("kick #%i ^"(Your Admin Password: Check Your Console)^"", userid);

    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

//
// @Bugsy's Logic.
//
GeneratePassword(iPasswordLength, szPassword[], maxchars)
{
    new iPasswordPos, iCharType;

    new const AsciiCodes[][] =
    {
        { 33, 64 },     // ! " # $ % & ' ( ) * + , - . / 0 - 9 : ; < = > ? @
        { 97, 122 },    // a - z
        { 65, 90 }      // 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 }
*/ 


Salut !
Ma poate ajuta cineva sa modific acest plugin?
Ce vreau mai exact:
-atunci cand cumperi admin sa iti setezi singur parola pe care vrei sa o ai si sa se salveze pe nume in "users.ini" pentru ca el saleveaza pe steam id acum.

In momentul de fata el executa comanda "kick" pe tine atunci cand cumperi admin si in consola iti apare un mesaj cu parola generata automat si in users.ini apare asa

"STEAM_0:0:123456" "!dfds^!b" "abcdefgij" "de"
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests