Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
[PLUGIN Cs1.6] BuyAdmin In-Game[Auto]
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins
Author
Message
1271
destroi112
[DEV]
Status: Offline
(since 12-03-2020 22:13)
Joined: 24 May 2014
Posts: 4042
,
Topics: 119
Location:
---------
Reputation:
515.9
Votes
: 118
Posted: 13-09-2016, 13:06:29
| Translate post to:
... (
Click for more languages
)
Descriere
: Playeri au posibilitate de a cumpara admin in joc automat folosindu-se de puncte.
Descarcare
: Ai sma mai jos.
Spoiler:
#include < amxmodx >
#include < amxmisc >
#define PLUGIN "Buy Admin"
#define VERSION "1.0"
#define AUTHOR "D3luxe"
//#define Test
new g_points[33],current_grade[33],MSG_TEXT;
new const Tag[] = "[BuyAdmin]";
enum BUY_STUFF
{
GradName[128],
GradFlags[128],
GradCost
};
/*gradele trebuie puse in ordine crescatoare de la slot pana la ce grad vreti voi*/
new const AdminBuy[][BUY_STUFF] =
{
/*Grad name | Grad flags | Grad Cost*/
{ "Slot","b",3000 },
{ "Helper","bt",350 },
{ "Mod","btr",3000 },
{ "Administrator","btrq",3045 }
};
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /buyadmin", "shop_buy");
#if defined Test
register_clcmd("say /t", "test");
#endif
register_clcmd("Type_your_password","set_password");
MSG_TEXT = get_user_msgid("SayText");
}
#if defined Test
public test(id)
{
g_points[id] += 900000000;
}
#endif
public plugin_natives()
{
register_native("open_buyadmin","shop_buy");
register_native("set_points","native_set");
register_native("get_points","native_get");
}
public native_set( iPlugin, iParams )
{
new id = get_param(1);
g_points[id] = max(0,get_param(2));
return g_points[id];
}
public native_get( iPlugin, iParams )
{
return g_points[get_param(1)];
}
public shop_buy( id )
{
new Temp[128],szNumber[10],count = 0;
formatex(Temp,charsmax(Temp),"Buy Admin \r| \yYour points : \r%d",g_points[id]);
new menu = menu_create(Temp, "handler_admin")
if(check(id) != -1)
{
for(new i = check(id) ; i < sizeof(AdminBuy) ;i++)
{
count++;
num_to_str(i,szNumber, charsmax( szNumber ));
format(Temp,charsmax(Temp),"\r%s \y[\w%d\y]",AdminBuy[i][GradName],AdminBuy[i][GradCost]);
menu_additem(menu,Temp,szNumber);
}
}
if(count==0)
{
ChatColor(id,"!g%s !yNo grades registred.",Tag);
return PLUGIN_HANDLED;
}
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public handler_admin(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
static data[6], name[64], acs, cllbck;
menu_item_getinfo(menu, item, acs, data, 5, name, 63, cllbck);
current_grade[id] = str_to_num(data);
if((g_points[id] - AdminBuy[current_grade[id]][GradCost]) >= 0)
{
client_cmd( id, "messagemode Type_your_password" );
ChatColor(id,"!g%s !yYou just buyed !team%s !y,set your password now please.",Tag,AdminBuy[current_grade[id]][GradName]);
}else{
ChatColor(id,"!g%s !ySorry,you don't have enough points to buy !team%s !y,you need !g%d !ymore points,come back then.",Tag,AdminBuy[current_grade[id]][GradName],(AdminBuy[current_grade[id]][GradCost]-g_points[id]));
return PLUGIN_HANDLED;
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public set_password( id )
{
if(current_grade[id] < 0)
{
ChatColor(id,"!g%s !ySorry you can't hook this command with messagemode.",Tag)
return PLUGIN_HANDLED;
}
new szArg[ 21 ];
read_argv(1, szArg, sizeof ( szArg ) -1 );
if ( !strlen( szArg ) || strlen( szArg ) < 5 )
{
ChatColor(id,"!g%s !yYour password can't be smaller than !team5 characters.",Tag)
client_cmd( id, "messagemode Type_your_password" );
return PLUGIN_HANDLED;
}
else if( strlen( szArg ) > 20 )
{
ChatColor(id,"!g%s !yYour password can't be bigger than !team20 characters.",Tag)
client_cmd( id, "messagemode Type_your_password" );
return PLUGIN_HANDLED;
}
if((g_points[id] - AdminBuy[current_grade[id]][GradCost]) >= 0)
{
g_points[id] -= AdminBuy[current_grade[id]][GradCost];
SetAdmin(id,szArg);
}else{
ChatColor(id,"!g%s !ySorry,you don't have enough points to buy !team%s !y,you need !g%d !ymore points,come back then.",Tag,AdminBuy[current_grade[id]][GradName],(AdminBuy[current_grade[id]][GradCost]-g_points[id]));
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public SetAdmin(id,pass[])
{
new configsDir[64]
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/users.ini", configsDir)
if (!file_exists(configsDir))
{
ChatColor(id,"!g%s !ySorry but our users.ini is missing contact an owner to report this.",Tag);
return PLUGIN_HANDLED;
}
remove_user_flags(id);
new text[256];
new player_name[32],szTypeAdmin[256],i = 0;
new line_name[64],line_password[64],line_accessflags[64],line_flags[64],parsedParams;
new currentTime[9],currentDate[11],stock_i=-1;
get_user_name(id,player_name,charsmax(player_name));
get_time("%H:%M:%S",currentTime,charsmax(currentTime))
get_time("%Y/%m/%d",currentDate,charsmax(currentDate))
new file = fopen(configsDir,"rt");
while(!feof(file))
{
fgets(file,text,50);
i++;
if(text[0] == ';')
continue;
parsedParams = parse(text,line_name,charsmax(line_name),line_password,charsmax(line_password),line_accessflags,charsmax(line_accessflags),line_flags,charsmax(line_flags))
if (parsedParams != 4)
continue;
if(equal(player_name,line_name))
{
stock_i = i;
break;
}
}
formatex(szTypeAdmin, sizeof( szTypeAdmin ) -1,"^"%s^" ^"%s^" ^"%s^" ^"a^";Admin Buyed | Date : %s | Time : %s | Points Left : %d", player_name,pass,AdminBuy[current_grade[id]][GradFlags],currentDate,currentTime,g_points[id]);
if(stock_i != -1)
write_file(configsDir,szTypeAdmin,stock_i-1);
else
write_file(configsDir,szTypeAdmin,i-1);
fclose(file);
new g_passprefix[32];get_cvar_string("amx_password_field",g_passprefix,31);
set_user_info( id, g_passprefix, pass );
ChatColor(id,"!g%s !yYou just buyed !team%s !yyour admin was automatically added,connect next time using setinfo %s %s.",Tag,AdminBuy[current_grade[id]][GradName],g_passprefix,pass);
current_grade[id] = -1;
server_cmd( "amx_reloadadmins" );
return PLUGIN_HANDLED;
}
public client_putinserver(id) current_grade[id] = -1;
public client_disconnect(id) current_grade[id] = -1;
public check(id)
{
new stock_val = 0;
for(new i = 0 ; i < sizeof(AdminBuy);i++)
{
if(get_user_flags(id) == read_flags(AdminBuy[i][GradFlags]))
{
if( i == (sizeof(AdminBuy)-1) )
stock_val = -1;
else
stock_val = i+1;
break;
}
}
return stock_val;
}
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, "!team", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE,MSG_TEXT, _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
Nume plugin
: BuyAdmin
Versiune
: 1.0
Author
: D3luxe
Comenzi administrative (se tasteaza in consola si trebuie sa fiti admin)
: NU necesita.
Comenzi publice (se tasteaza in joc prin apasarea tastei Y sau U)
: /buyadmin
Alte informatii
:
- Pluginul contine native pe care le puteti utiliza pentru adaugare punctelor pentru diferite lucruri (aveti mai jos niste exemple)
Code:
native open_buyadmin(id) //deschide meniul de cumparare admin
native set_points(id,amount) // seteaza un anumit numar de puncte
native get_points(id) //returneaza cate puncte are userul.
- Important , puneti gradele in ordine de la slot pana la ce grad vreti voi sa se poata cumpara.
- Nu suporta STEAM_ID -ul , un jucator ce are pe steam_id parola va putea cumpara grade mai mari dar i se va salva pe nume iar salvarea cu steam_id-ul va ramane si ea.
- Nu apar dubluri in users.ini si pentru a identifica admini ce au cumparat din meniu apare la sfarsitul lor ;Admin Buyed cu data ,ora si punctele ramase dupa cumpararea gradului.
- Aveti nativele pentru puncte puteti pune sa creasca punctele in functie de ce vreti voi , de exemplu exista inc-ul PayPal va puteti folosi de el pentru a face un fel de cumpara puncte dupa cumpara cu ele admin .Sau puneti la x minute jucate (ar fi ok si sa verificati daca playerul nu e afk si daca nu e spec) sa dea x puncte.
- Daca vad ca intereseaza pe cineva poate o sa fac si cele 2 plugine mentionate mai sus (PayPal si pe ore jucate pe server) DACA.
Modificati urmatoarele eu le-am pus doar de test :
Code:
//#define Test //asta e o comanda pt test o puteti sterge complet din sma
new const Tag[] = "[BuyAdmin]"; //tagul ce apare in fata la ChatColor
new const AdminBuy[][BUY_STUFF] =
{
/*Grad name | Grad flags | Grad Cost*/ //numele gradului , flagurile pe care le are acesta si costul acestuia in puncte. puneti gradele voastre din users.ini pentru a nu avea probleme.
{ "Slot","b",3000 },
{ "Helper","bt",350 },
{ "Mod","btr",3000 },
{ "Administrator","btrq",3045 }
};
Retired from Amxmodx
0
0
Back to top
Freakz Forum Index
->
Trash Bin
->
CS 2006-2019 (Archived)
->
Plugins
The time now is 10-01-2025, 20:50:45
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details