This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Ban the worst player and map end


Post New Thread Reply   
 
Thread Tools Display Modes
[PUPPETS] Scooter
Member
Join Date: May 2009
Old 07-30-2011 , 09:21   Re: Ban the worst player and map end
Reply With Quote #21

Post full plugin, so everybody can test it and get the point, why it's not working.
[PUPPETS] Scooter is offline
lis_16
Senior Member
Join Date: Feb 2008
Old 07-30-2011 , 09:45   Re: Ban the worst player and map end
Reply With Quote #22

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(PLUGINVERSIONAUTHOR)
    
    
    
register_concmd("say /zaklad""blok");
    
czas=random_num(11440)
    
set_task(60.0"zmien");
    
//set_task(1.0, "pe",0,_,_,"d")
    
}



public 
blok(id){
    if(!
minely){
        
client_print(idprint_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=0i<=32i++)
        if(
is_user_connected(i) && zaklad[i]) ilosc++
        if(
ilosc<2) return PLUGIN_CONTINUE
        get_user_ip
(idip191)
        
get_user_authid(idauthid31)
        if (!
equal(authid"STEAM_0:"8)){
            
server_cmd("amx_ban %i %s ^"ReasonYou suck.^""czasip)
        }
        else{
            
server_cmd("amx_ban %i %s ^"ReasonYou suck.^""czasauthid)
        }
        
zaklad[id]=false
    
}
    return 
PLUGIN_CONTINUE
}


public 
plugin_end()
{
    
client_print(0print_chat"funkcja")
    new 
players[32], pnumplayerfrags[33]
    
get_players(playerspnum)
    for(new 
0pnumi++)
    {
        
player players[i]
        
        if(!
zaklad[player])
            
players[i--] = players[--pnum]
        else
            
frags[player] = get_user_frags(player)
    }
    
    
//if(pnum < 2) return
    
    
SortCustom1D(playerspnum"SortWorstPlayers"fragssizeof(frags))
    
    new 
stop 0
    player 
players[0]
    while(++
stop pnum && frags[players[stop]] == frags[player]) { }
    if(
stop == pnum) return
    for(new 
0stopi++)
    {
        
player players[i]
        new 
authid[33], ip[32]
        
get_user_ip(playerip191)
        
get_user_authid(playerauthid31)
        if (!
equal(authid"STEAM_0:"8)){
            
server_cmd("amx_ban %i ^"%s^" ^"ReasonYou suck.^""czasip)
        }
        else{

            
server_cmd("amx_ban %i ^"%s^" ^"ReasonYou suck.^""czasauthid)
        } 
    }
}

public 
SortWorstPlayers(player1player2players[], frags[], frag_size)
{
    return 
clamp((frags[player1] - frags[player2]), -11)
}  


public 
potwierdz(id){
    
    
format(title255"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_potMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu_pot0)
    
}

public 
potwierdz_hand(idmenuitem){
    if (
item == MENU_EXIT)
    {
        
zaklad[id]=false
        menu_destroy
(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
name[33]
    
get_user_name(idname32)
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
        
    
{
    case 
1:{
        
        
zaklad[id]=true
        ColorChat
0GREEN,"^x02%s ^x01 Dolaczyl do zakladu o bana na ^x03%i ^x01minut! "nameczas)        
        return 
PLUGIN_CONTINUE
    
}
    case 
2:{
        
zaklad[id]=false
        client_print
(idprint_chat"Nie dolaczyles do zakladu")
        return 
PLUGIN_CONTINUE
    
}
}
    return 
PLUGIN_CONTINUE
}

public 
bomb_explode(planterdefuser){
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 }
*/ 
lis_16 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode