INSIDE RESURSE

Resurse pentru toate jocurile online! samp, csgo, mape, muzica, filme, ps, divertisment, geforce, fzarea, muzica, clan, coduri, cfg, inside, resurse, servere, gata, facute, war, zone, pgl, long, nvid


Nu sunteti conectat. Conectati-va sau inregistrati-va

[Plugin] BuyAdmin

Por favor, faça o login para responder

Vezi subiectul anterior Vezi subiectul urmator In jos  Mesaj [Pagina 1 din 1]

#1vendME 

la data de Joi Mai 04, 2017 2:43 pm

avatar

Fondator
Fondator
Numele Plugin-ului: BuyAdmin
Descriere: Playeri au posibilitate de a cumpara admin in joc automat folosindu-se de puncte.
Download:



Cod:
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","native_openbuy");
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 native_openbuy( iPlugin, iParams )
{
shop_buy(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(); 



}




Autor: D3luxe
Sursa (Link-ul oficial):


AmxModX/AdminMod: -
CVar-uri: -
Module necesare: -
Comenzi: (se tasteaza in joc prin apasarea tastei Y sau U): /buyadmin
Instalare:-


_________________

INSIDE RESURSE











http://resurseinside.forumgratuit.ro

Vezi subiectul anterior Vezi subiectul urmator Sus  Mesaj [Pagina 1 din 1]

Por favor, faça o login para responder

Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum