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


Raised This Month: $ Target: $400
 0% 

Plugin Show how many times player banned


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ant1Lamer
Senior Member
Join Date: Jul 2009
Old 06-02-2015 , 06:26   Plugin Show how many times player banned
Reply With Quote #1

So i found this can you if possible this to read bans on ini fail nick/ip and show only on admin how many times player is banned i use for advanced_bans with nvault

P.s: srry for bad english.....
Attached Files
File Type: sma Get Plugin or Get Source (check_player.sma - 487 views - 1.8 KB)
Ant1Lamer is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-02-2015 , 07:31   Re: Plugin Show how many times player banned
Reply With Quote #2

What??
__________________
fysiks is offline
wEight
BANNED
Join Date: Jan 2015
Old 06-02-2015 , 11:50   Re: Plugin Show how many times player banned
Reply With Quote #3

Post the full code please and delete the attachment, post the code between <php> and </php>
(replace <> with [])

@fysiks

He wants a plugin that counts player's bans (eg. amx_showbans "Markeloff", Markeloff has been banned 6 times)
wEight is offline
Ant1Lamer
Senior Member
Join Date: Jul 2009
Old 06-02-2015 , 13:19   Re: Plugin Show how many times player banned
Reply With Quote #4

Yes but automatic show with hud and not use sql if is possible

PHP Code:
public prebanned_check(id)
{
    if(
is_user_bot(id) || get_user_flags(id) & ADMIN_LEVEL_A)
        return 
PLUGIN_HANDLED
        
    
new player_steamid[32], player_ip[20]
    
get_user_authid(idplayer_steamid31)
    
get_user_ip(idplayer_ip191)
        
    new 
query[4096]
    new 
data[1]
    
    
format(query4096"SELECT ban_created,admin_nick FROM `%s` WHERE ( player_id='%s' AND ban_type='S' ) OR ( player_ip='%s' AND ban_type='SI' )",tbl_banhistplayer_steamidplayer_ip)

    
data[0] = id
    SQL_ThreadQuery
(g_SqlX"prebanned_check_"querydata1)
    
    return 
PLUGIN_HANDLED
}

public 
prebanned_check_(failstateHandle:queryerror[], errnumdata[], size)
{
    new 
id data[0]
    
    if (
failstate)
    {
        new 
szQuery[256]
        
MySqlX_ThreadError(szQueryerrorerrnumfailstate16)
    }
    else
    {
        if(!
SQL_NumResults(query))
        {
            return 
PLUGIN_HANDLED
        
}
        else
        {
            new 
admin_nick[32]
            new 
current_time_intban_countban_createdbanned_days_ago
            current_time_int 
get_systime(0)
            new 
preBanTime get_pcvar_num(max_time_to_show_preban)

            while (
SQL_MoreResults(query))
            {
                
ban_created SQL_ReadResult(query0)
                
SQL_ReadResult(query1admin_nick31)
                
                
banned_days_ago = (current_time_int ban_created) / 86400
                
                
if (banned_days_ago preBanTime)
                {
                }
                else
                {
                    
ban_count++
                }
                
                
SQL_NextRow(query)
            }
            
            new 
name[32], players[32], inum
            get_user_name
(idname31)
            
get_players(playersinum)
            
            for (new 
0inum; ++i)
            {
                if (
get_user_flags(players[i]) & ADMIN_CHAT)
                {
                    
set_hudmessage(255000.050.3006.010.0 0.50.15, -1)
                    
ShowSyncHudMsg(players[i], g_MyMsgSync"!!!! WARNING !!!!^n'%s' was banned '%i' times before!"nameban_count)
                }
            }
        }
    }
    return 
PLUGIN_HANDLED
}

public 
check_player(id)
{
    if(
is_user_bot(id) || get_user_flags(id) & ADMIN_LEVEL_A)
        return 
PLUGIN_HANDLED
    
    
new player_steamid[32], player_ip[20]
    
get_user_authid(idplayer_steamid31)
    
get_user_ip(idplayer_ip191)
    
    
get_user_info(id"lanka"sInfo[id], 20);
    
    if(
containi(sInfo[id], lan_sql_server) != -1)
    {
        
server_cmd("kick #%d ^"[Server NameYou are banned :( Check your console.^""get_user_userid(id));
    }
    
    new 
query[4096]
    new 
data[1]
    
format(query4095"SELECT bid,ban_created,ban_length,ban_reason,admin_nick,admin_ip,player_nick,player_id,player_ip,server_name,ban_type FROM `%s` WHERE ( player_id='%s' AND ban_type='S' ) OR ( player_ip='%s' AND ban_type='SI' )",tbl_bansplayer_steamidplayer_ip)

    
data[0] = id
    SQL_ThreadQuery
(g_SqlX"check_player_"querydata1)
    
    return 
PLUGIN_HANDLED
}

public 
check_player_(failstateHandle:queryerror[], errnumdata[], size)
{
    new 
id data[0]

    if (
failstate)
    {
        new 
szQuery[256]
        
MySqlX_ThreadErrorszQueryerrorerrnumfailstate17 )
    }
    else
    {
        if(!
SQL_NumResults(query))
        {
            return 
PLUGIN_HANDLED
        
}
        else
        {
            new 
bid[20], ban_created[20], ban_length[50], ban_reason[255], admin_nick[100],admin_ip[30],ban_type[4]
            new 
player_nick[50],player_steamid[50],player_ip[30],server_name[100]

            new 
Qbid SQL_FieldNameToNum(query"bid")
            new 
Qplayer_ip SQL_FieldNameToNum(query"player_ip")
            new 
Qplayer_id SQL_FieldNameToNum(query"player_id")
            new 
Qplayer_nick SQL_FieldNameToNum(query"player_nick")
            new 
Qadmin_ip SQL_FieldNameToNum(query"admin_ip")
            new 
Qadmin_nick SQL_FieldNameToNum(query"admin_nick")
            new 
Qban_type SQL_FieldNameToNum(query"ban_type")
            new 
Qban_reason SQL_FieldNameToNum(query"ban_reason")
            new 
Qban_created SQL_FieldNameToNum(query"ban_created")
            new 
Qban_length SQL_FieldNameToNum(query"ban_length")
            new 
Qserver_name SQL_FieldNameToNum(query"server_name")
            
            
SQL_ReadResult(queryQbidbidsizeof(bid)-1);
            
SQL_ReadResult(queryQplayer_ipplayer_ipsizeof(player_ip)-1);
            
SQL_ReadResult(queryQplayer_idplayer_steamidsizeof(player_steamid)-1);
            
SQL_ReadResult(queryQplayer_nickplayer_nicksizeof(player_nick)-1);
            
SQL_ReadResult(queryQadmin_ipadmin_ipsizeof(admin_ip)-1);
            
SQL_ReadResult(queryQadmin_nickadmin_nicksizeof(admin_nick)-1);
            
SQL_ReadResult(queryQban_typeban_typesizeof(ban_type)-1);
            
SQL_ReadResult(queryQban_reasonban_reasonsizeof(ban_reason)-1);
            
SQL_ReadResult(queryQban_createdban_createdsizeof(ban_created)-1);
            
SQL_ReadResult(queryQban_lengthban_lengthsizeof(ban_length)-1);
            
SQL_ReadResult(queryQserver_nameserver_namesizeof(server_name)-1);
            
            new 
current_time_int get_systime(0)
            new 
bid_int str_to_num(bid)
            new 
ban_created_int str_to_num(ban_created)
            new 
ban_length_int str_to_num(ban_length) * 60 // in secs
    
            
log_amx("%i"ban_length_int)
            
            
// A ban was found for the connecting player!! Lets see how long it is or if it has expired
            
if ((ban_length_int == 0) || (ban_created_int == 0) || (ban_created_int+ban_length_int current_time_int))
            {
                new 
complain_url[256]
                
get_pcvar_string(complainurl ,complain_url,255)
                
                
client_cmd(id"echo [Server Name] ===============================================")
                
client_cmd(id"echo [Server Name] %L",LANG_PLAYER,"MSG_8"admin_nick)
                if (
ban_length_int==0)
                {
                    
client_cmd(id"echo [Server Name] %L",LANG_PLAYER,"MSG_10")
                }
                else
                {
                    new 
cTimeLength[128]
                    new 
iSecondsLeft = (ban_created_int ban_length_int current_time_int)
                    
get_time_length(idiSecondsLefttimeunit_secondscTimeLength127)
                    
client_cmd(id"echo [Server Name] %L" ,LANG_PLAYER"MSG_12"cTimeLength)
                }
                
client_cmd(id"echo [Server Name] %L"LANG_PLAYER"MSG_13"player_nick)
                
client_cmd(id"echo [Server Name] %L"LANG_PLAYER"MSG_2"ban_reason)
                
client_cmd(id"echo [Server Name] %L"LANG_PLAYER"MSG_7"complain_url)
                
client_cmd(id"echo [Server Name] %L"LANG_PLAYER"MSG_4"player_steamid)
                
client_cmd(id"echo [Server Name] %L"LANG_PLAYER"MSG_5"player_ip)
                
client_cmd(id"echo [Server Name] ===============================================")
    
                new 
kick_message[128]
                new 
userid get_user_userid(id)
                
format(kick_message,127,"%L"LANG_PLAYER,"KICK_MESSAGE")
                
server_cmd("kick #%d  %s",useridkick_message)
        
                return 
PLUGIN_HANDLED
            
}
            else 
// The ban has expired
            
{
                
client_cmd(id"echo [Server Name] %L",LANG_PLAYER,"MSG_11")
    
                new 
unban_created get_systime(0)
    
                
//make sure there are no single quotes in these 4 vars
                
replace_all(player_nick49"\", "")
                replace_all(player_nick, 49, "'", "ґ")
    
                replace_all(admin_nick, 99, "\", "")
                replace_all(admin_nick, 99, "'", "
&#1169;")
    
                
replace_all(ban_reason254"\", "")
                replace_all(ban_reason, 254, "'", "ґ")
    
                replace_all(server_name, 99, "\", "")
                replace_all(server_name, 99, "'", "
&#1169;")
                
                
new query[512]
    
                
format(query511"INSERT INTO `%s` (player_id,player_ip,player_nick,admin_nick,admin_ip,ban_type,ban_reason,ban_created,ban_length,server_name,unban_created,unban_reason,unban_admin_nick) VALUES('%s','%s','%s','%s','%s','%s','%s','%d','%s','%s','%i','Bantime expired','amxbans')",tbl_banhistplayer_steamidplayer_ipplayer_nickadmin_nickadmin_ipban_typeban_reasonban_created_intban_lengthserver_nameunban_created)
                
                new 
data[2]
                
data[0] = id
                data
[1] = bid_int
                SQL_ThreadQuery
(g_SqlX"insert_to_banhistory"querydata2)

                
log_amx("%i"bid_int)
            }
        }
    }
    return 
PLUGIN_HANDLED
}

public 
insert_to_banhistory(failstateHandle:queryerror[], errnumdata[], size)
{
    new 
id data[0]
    new 
bid data[1]

    if (
failstate)
    {
        new 
szQuery[256]
        
MySqlX_ThreadErrorszQueryerrorerrnumfailstate18 )
    }
    else
    {
        new 
query[512]
        new 
data[1]
    
        
format(query511,"DELETE FROM `%s` WHERE bid='%d'",tbl_bansbid)
        
        
data[0] = id
        SQL_ThreadQuery
(g_SqlX"delete_expired_ban"querydata1)
    }
    
    return 
PLUGIN_HANDLED
}

public 
delete_expired_ban(failstateHandle:queryerror[], errnumdata[], size)
{
    if (
failstate)
    {
        new 
szQuery[256]
        
MySqlX_ThreadError(szQueryerrorerrnumfailstate19)
    }


Last edited by Ant1Lamer; 06-02-2015 at 13:22.
Ant1Lamer is offline
Ant1Lamer
Senior Member
Join Date: Jul 2009
Old 09-13-2015 , 08:02   Re: Plugin Show how many times player banned
Reply With Quote #5

up with nvalut its possible ? or if plugin read logs ?

Last edited by Ant1Lamer; 09-13-2015 at 08:08.
Ant1Lamer 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 04:04.


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