Raised This Month: $ Target: $400
 0% 

Ban the worst player and map end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lis_16
Senior Member
Join Date: Feb 2008
Old 07-20-2011 , 06:54   Ban the worst player and map end
Reply With Quote #1

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=falsecount=0ilosc=0
    
for(new id=0id<=32id++)
        if(
is_user_connected(id) && zaklad[id]) ilosc++
    if(
ilosc<2) return PLUGIN_CONTINUE
    
for(new id=0id<=32id++){
        if(
is_user_connected(id) && zaklad[id]){
            if(!
pierwszy){
                
pierwszy=true
                id_ban
[count]=id
                count
++
            }
            if(
id!=id_ban[count-1]){
                new 
fragi_obecnyfragi_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(countname31)
        
get_user_ip(id_ban[count], ip191)
        
get_user_authid(id_ban[count], authid31)
        if (!
equal(authid"STEAM_0:"8)){
            
server_cmd("amx_ban %i %s ^"ReasonYou suck.^""czasip)
            
log_to_file("logs.log""Zbanowany na ip-%s"name)
        }
        else{
            
server_cmd("amx_ban %i %s ^"ReasonYou suck.^""czasauthid)
            
log_to_file("logs.log","Zbanowany na steam-%s"name)
        }
    }
    return 
PLUGIN_CONTINUE

lis_16 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-20-2011 , 15:46   Re: Ban the worst player and map end
Reply With Quote #2

There is no reason to ban by IP since everybody should have a SteamID, BTW. Also, you probably need quotes around the SteamID.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-20-2011 , 15:56   Re: Ban the worst player and map end
Reply With Quote #3

PHP Code:
public plugin_end()
{
    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]
        
        
get_user_name(playerfragscharsmax(frags))
        
        
server_cmd("amx_ban %d #%d ^"ReasonYou suck.^""czasget_user_userid(player))
        
log_to_file("logs.log""Zbanowany na %s"frags)
    }
}

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

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 07-26-2011 , 08:23   Re: Ban the worst player and map end
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
There is no reason to ban by IP since everybody should have a SteamID, BTW. Also, you probably need quotes around the SteamID.
If you have two steam userd and cs then it is a reason
.Dare Devil. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-26-2011 , 15:57   Re: Ban the worst player and map end
Reply With Quote #5

Quote:
Originally Posted by .Dare Devil. View Post
If you have two steam userd and cs then it is a reason
Sill not a good reason. Just ban both accounts. Simple as that. It's easier and cheaper to get a new IP than it is to get a new Steam account and buy the game again.
__________________
fysiks is offline
lis_16
Senior Member
Join Date: Feb 2008
Old 07-20-2011 , 15:58   Re: Ban the worst player and map end
Reply With Quote #6

Ban code works fine, because i ban when play left game while bet too, so server_cmd works fine. Maybe something is wrong in loops? But it look fine too.
lis_16 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-20-2011 , 16:03   Re: Ban the worst player and map end
Reply With Quote #7

Did you try mine?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lis_16
Senior Member
Join Date: Feb 2008
Old 07-20-2011 , 16:06   Re: Ban the worst player and map end
Reply With Quote #8

Look at posted time, you posted while I was posting. Will try and give you an anserw.
lis_16 is offline
lis_16
Senior Member
Join Date: Feb 2008
Old 07-20-2011 , 17:03   Re: Ban the worst player and map end
Reply With Quote #9

I added some logs.

If I comment:

PHP Code:
if(pnum 2) return 
it should ban, but it didn't. I added log after ban comand and log is in log file but ban don't work and it's strange. I tried your's ban command and mine (that work on client_disconnect) with no result.
lis_16 is offline
[PUPPETS] Scooter
Member
Join Date: May 2009
Old 07-20-2011 , 17:18   Re: Ban the worst player and map end
Reply With Quote #10

Which version of Amxbans are you using?
[PUPPETS] Scooter 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 00:48.


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