PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <fun>
#include <colorchat>
#define PLUGIN "Zaklady na bana"
#define VERSION "1.0"
#define AUTHOR "lisek"
new zaklad[33]
new czas
new title[256]
new odj_paka[33]
new bool:minely = true;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("say /zaklad", "blok");
czas=random_num(1, 1440)
set_task(60.0, "zmien");
//set_task(1.0, "pe",0,_,_,"d")
}
public blok(id){
if(!minely){
client_print(id, print_chat, "Zaklad dostepny przez 60 sekund od rozpoczecia mapy");
}
else
{
r_zaklad(id)
}
}
public zmien(){
minely = false;
}
public r_zaklad(id){
if(zaklad[id]) return PLUGIN_CONTINUE
potwierdz(id)
return PLUGIN_CONTINUE
}
public client_connect(id){
zaklad[id]=false
odj_paka[id]=0
}
public client_disconnect(id){ //this works fine
if(zaklad[id]){
new ip[20], authid[32], ilosc=0
for(new i=0; i<=32; i++)
if(is_user_connected(i) && zaklad[i]) ilosc++
if(ilosc<2) return PLUGIN_CONTINUE
get_user_ip(id, ip, 19, 1)
get_user_authid(id, authid, 31)
if (!equal(authid, "STEAM_0:", 8)){
server_cmd("amx_ban %i %s ^"Reason: You suck.^"", czas, ip)
}
else{
server_cmd("amx_ban %i %s ^"Reason: You suck.^"", czas, authid)
}
zaklad[id]=false
}
return PLUGIN_CONTINUE
}
public plugin_end()
{
client_print(0, print_chat, "funkcja")
new players[32], pnum, player, frags[33]
get_players(players, pnum)
for(new i = 0; i < pnum; i++)
{
player = players[i]
if(!zaklad[player])
players[i--] = players[--pnum]
else
frags[player] = get_user_frags(player)
}
//if(pnum < 2) return
SortCustom1D(players, pnum, "SortWorstPlayers", frags, sizeof(frags))
new stop = 0
player = players[0]
while(++stop < pnum && frags[players[stop]] == frags[player]) { }
if(stop == pnum) return
for(new i = 0; i < stop; i++)
{
player = players[i]
new authid[33], ip[32]
get_user_ip(player, ip, 19, 1)
get_user_authid(player, authid, 31)
if (!equal(authid, "STEAM_0:", 8)){
server_cmd("amx_ban %i ^"%s^" ^"Reason: You suck.^"", czas, ip)
}
else{
server_cmd("amx_ban %i ^"%s^" ^"Reason: You suck.^"", czas, authid)
}
}
}
public SortWorstPlayers(player1, player2, players[], frags[], frag_size)
{
return clamp((frags[player1] - frags[player2]), -1, 1)
}
public potwierdz(id){
format(title, 255, "Czy chcesz dolaczyc do zakladu na bana o czasie: %d minut?", czas)
new menu_pot=menu_create(title, "potwierdz_hand")
menu_additem(menu_pot, "\wTak", "1", 0)
menu_additem(menu_pot, "\wNie", "2", 0)
menu_setprop(menu_pot, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu_pot, 0)
}
public potwierdz_hand(id, menu, item){
if (item == MENU_EXIT)
{
zaklad[id]=false
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new name[33]
get_user_name(id, name, 32)
new acces, callback
menu_item_getinfo(menu, item, acces, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:{
zaklad[id]=true
ColorChat( 0, GREEN,"^x02%s ^x01 Dolaczyl do zakladu o bana na ^x03%i ^x01minut! ", name, czas)
return PLUGIN_CONTINUE
}
case 2:{
zaklad[id]=false
client_print(id, print_chat, "Nie dolaczyles do zakladu")
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public bomb_explode(planter, defuser){
if(zaklad[planter]) odj_paka[planter]+=3
return PLUGIN_CONTINUE;
}
public bomb_defused(defuser){
if(zaklad[defuser]) odj_paka[defuser]+=3
return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/