This is a bet system, if player type /zaklad-zaklad[index]=true for him. I want to ban the worst player who typed /zaklad or every player who has same frags count like the worst (fe. 4 players with frags: 30, 34, 20, 20. 2 players with frags 20 should be banned). Here is the code for banning but it won't work. What's wrong?
PHP Code:
new zaklad[33]
new czas
new odj_paka[33]
new bool:minely = true;
PHP Code:
public plugin_end(){
new id_ban[32], pierwszy=false, count=0, ilosc=0
for(new id=0; id<=32; id++)
if(is_user_connected(id) && zaklad[id]) ilosc++
if(ilosc<2) return PLUGIN_CONTINUE
for(new id=0; id<=32; id++){
if(is_user_connected(id) && zaklad[id]){
if(!pierwszy){
pierwszy=true
id_ban[count]=id
count++
}
if(id!=id_ban[count-1]){
new fragi_obecny, fragi_nowy
fragi_obecny=get_user_frags(id_ban[count-1])-odj_paka[count-1] // i subtract frags from plant/defuser a bomb.
fragi_nowy=get_user_frags(id)-odj_paka[id]
if(fragi_nowy==fragi_obecny){
id_ban[count]=id
count++
}
else if(fragi_nowy<fragi_obecny){
count=0
id_ban[count]=id
count++
}
}
}
}
while(--count>-1){
/*new ip[20]
get_user_ip(id_ban[count], ip, 19, 1)
server_cmd("addip %i %s", czas, ip)*/
new ip[20], authid[32], name[32]
get_user_name(count, name, 31)
get_user_ip(id_ban[count], ip, 19, 1)
get_user_authid(id_ban[count], authid, 31)
if (!equal(authid, "STEAM_0:", 8)){
server_cmd("amx_ban %i %s ^"Reason: You suck.^"", czas, ip)
log_to_file("logs.log", "Zbanowany na ip-%s", name)
}
else{
server_cmd("amx_ban %i %s ^"Reason: You suck.^"", czas, authid)
log_to_file("logs.log","Zbanowany na steam-%s", name)
}
}
return PLUGIN_CONTINUE
}