Raised This Month: $51 Target: $400
 12% 

remake this plugin to 2.0 Sourcebans {HELP}


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 02-01-2019 , 00:29   remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #1

Need help to recode this to Sourcebans 2.0
here is the link to sourcebans 2.0
https://forums.alliedmods.net/showthread.php?t=219657

OBS!! THIS IS AMX PLUGINS!

PHP Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
public VertifyBan(id)
{
    if(
do_connection())
    {
        new 
iSteam[32]
        
get_user_authid(idiSteam31) ; trim(iSteam)
        
        if(
equal("STEAM_ID_PEDING"iSteam) )
        {
            
set_task(4.0"VertifyBan"id)
            return 
PLUGIN_CONTINUE
        
}
        new 
iIp[32] ; get_user_ip(idiIp31) ; trim(iIp)
        new 
Handle:query SQL_PrepareQuery(sqlconnect"SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^^%s$') OR (type = 1 AND ip = '%s')) AND (length = '0' OR ends > UNIX_TIMESTAMP()) AND RemoveType IS NULL",prefixiSteamiIp )
        
        
SQL_Execute(query)
        
        new 
Result
        
        
if(SQL_MoreResults(query))
            
Result SQL_ReadResult(query0)
        
        if(!
Result)
        {
            
log_to_file(LOG_FILE"No Result found on : %s (Result : %d)"iSteamResult)
            
            
SQL_FreeHandle(query) ; SQL_FreeHandle(sqlconnect)
            
            return 
PLUGIN_CONTINUE
        
}
        
        new 
iName[32] ; get_user_name(idiName31) ; trim(iName)
        
        new 
iName2[32] ; MakeStringSQLSafe(iNameiName231)
        
        new 
iQuery[512]        
        
formatex(iQuery511"INSERT INTO %s_banlog (sid ,time ,name ,bid) VALUES   ((SELECT sid FROM %s_servers WHERE ip = '%s' AND port = '%s' LIMIT 0,1), UNIX_TIMESTAMP(), '%s', (SELECT bid FROM %s_bans WHERE ((type = 0 AND authid REGEXP '^^%s$') OR (type = 1 AND ip = '%s')) AND RemoveType IS NULL LIMIT 0,1))"prefixprefixServerIpServerPortiName2prefixiSteamiIp)  
        
        
trim(iQuery) ; query Empty_Handle
        
        query 
SQL_PrepareQuery(sqlconnect"%s"iQuery)
        
        
SQL_Execute(query) ; SQL_FreeHandle(query) ; SQL_FreeHandle(sqlconnect)
        
        
log_to_file(LOG_FILE"AMXX Sourcebans Kicked : (Name : %s | STEAM : %s | IP : %s)"iNameiSteamiIp)
        
        
server_cmd("kick #%i ^"You are banned from this serverVisit %for info^""get_user_userid(id), WEBSITE)
        
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public UTIL_InsertBan(banTimeid, const Name[], const Authid[], const Ip[], const Reason[], const AdminAuthid[], const AdminIp[])
{
    if(
do_connection())
    {
        new 
iQ[1024]
        
        
formatex(iQ,1023,"INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid, country) VALUES  ('%s', '%s', '%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + %d, %d, '%s', IFNULL((SELECT aid FROM %s_admins WHERE authid = '%s' OR authid REGEXP '^^%s$'),'0'), '%s', (SELECT sid FROM %s_servers WHERE ip = '%s' AND port='%s' LIMIT 0,1), ' ')"prefixIpAuthidName, (banTime*60), (banTime*60), ReasonprefixAdminAuthidAdminAuthidAdminIpprefixServerIpServerPort)
        
        
log_to_file(LOG_FILE"iQ : %s"iQ)
        
        new 
Handle:query SQL_PrepareQuery(sqlconnect"%s"iQ )
        
        
SQL_Execute(query) ; SQL_FreeHandle(query) ; SQL_FreeHandle(sqlconnect)
        
        if(!
id)
            return 
1
        
        server_cmd
("kick #%d ^"BANNEDReason: >%s< - Visit %for info^""get_user_userid(id), ReasonWEBSITE)
        
        return 
1
    
}
    return 
0
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanMenu(id)
{
    new 
menu menu_create("\rAMXX Sourcebans menu:""BanMenu_handler")
    
    new 
players[32], pnumtempid
    
    
new szName[32], szTempid[10]
    
    
get_players(playerspnum)
    
    for( new 
ii<pnumi++ )
    {
        
tempid players[i]
        
        if(
is_user_bot(tempid))
            continue
        
        
get_user_name(tempidszName31)
        
num_to_str(tempidszTempid9)
        
        
menu_additem(menuszNameszTempidADMIN_BAN)
    }
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata5iName63callback)

    new 
tempid str_to_num(data)
    
    
AdminTarget[id] = tempid
    
    menu_destroy
(menu)
    
    
BanTimeMenu(id)
    
    return 
PLUGIN_HANDLED;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanTimeMenu(id)
{
    new 
menu menu_create("\rPick Time To Ban:""BanTimeMenu_handler")
    
    for(new 
sizeof BanTimesStr ++)
    {
        new 
str[4] ; num_to_str(rstr3)
        
menu_additem(menuBanTimesStr[r], strADMIN_BAN)
    }
    
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanTimeMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
iAccesscallback
    menu_item_getinfo
(menuitemiAccessdata,5iName63callback);
    
    new 
key str_to_num(data)
    
    
AdminBanTime[id] = BanTimesInt[key] ; AdminBanTimeStrNum[id] = key
    
    BanReasonMenu
(id)
    
    return 
PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanReasonMenu(id)
{
    new 
menu menu_create("\rPick Ban Reason:""BanReasonMenu_handler");
    
    for(new 
sizeof BanReasons ++)
    {
        new 
str[4] ; num_to_str(rstr3)
        
menu_additem(menuBanReasons[r], strADMIN_BAN);
    }
    
    
menu_display(idmenu0)
    
    return 
PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public BanReasonMenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu)
        
AdminBanTime[id] = 1
        
        
return PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
iAccesscallback
    menu_item_getinfo
(menuitemiAccessdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    new 
iReason[64] ; formatex(iReason63"%s"BanReasons[key])
    new 
iReason2[64] ; MakeStringSQLSafe(iReasoniReason263)
    
    new 
szName[32] ; get_user_name(AdminTarget[id], szName31)
    
    
client_print(id3"Client : %s | BanTime : %d | Reason : %s"szNameAdminBanTime[id], iReason)
    
    
//////////////////////////////////////////////////////////////
    
new AdminId[32] ; get_user_authid(idAdminId31)
    new 
AdminIp[32] ; get_user_ip(idAdminIp311)
    new 
AdminName[32] ; get_user_name(idAdminName31)
    
    new 
BannedId[32] ; get_user_authid(AdminTarget[id], BannedId31)
    new 
BannedIp[32] ; get_user_ip(AdminTarget[id], BannedIp311
    new 
BannedName[32] ; get_user_name(AdminTarget[id], BannedName31)
    
    new 
BannedName2[32] ; MakeStringSQLSafe(BannedNameBannedName231)
    
    
log_to_file(LOG_FILE"Admin: %s(%s) Banned %s(%s) %s -> Reason: %s"AdminNameAdminIdBannedNameBannedIdBanTimesStr[AdminBanTimeStrNum[id]], iReason)
    
/////////////////////////////////////
    
new HudMessage[128]
    
formatex(HudMessage127" - Admin:%s^n - Banned:%s^n - Ban Time:%s^n - Reason:%s"AdminNameBannedNameBanTimesStr[AdminBanTimeStrNum[id]], iReason)
    
set_hudmessage(255000.030.1521.515.00.06)
    
show_hudmessage(0"%s"HudMessage)
    
/////////////////////////////////////
    
client_print(0print_console"[SERVER CONSOLE] Admin: %s Banned %s (%s) %s"AdminNameBannedNameBannedIdBanTimesStr[AdminBanTimeStrNum[id]])
    
client_print(0print_console"[SERVER CONSOLE] -> Ban Reason: %s"iReason)
    
/////////////////////////////////////
    
client_print(AdminTarget[id], print_console"*************************************")
    
client_print(AdminTarget[id], print_console"---------------------- BANNED -------------------")
    
client_print(AdminTarget[id], print_console"* -> Ban Reason: %s"iReason)
    
client_print(AdminTarget[id], print_console"* -> Ban Time: %s"BanTimesStr[AdminBanTimeStrNum[id]])
    
client_print(AdminTarget[id], print_console"* If you think you where treated unfair you can *")
    
client_print(AdminTarget[id], print_console"---------- protest @ %s ------------"WEBSITE)
    
client_print(AdminTarget[id], print_console"*************************************")
    
/////////////////////////////////////
    
    
if(!UTIL_InsertBan(AdminBanTime[id], AdminTarget[id], BannedName2BannedIdBannedIpiReason2AdminIdAdminIp))
        
server_cmd("banid %d #%d kick;writeid"AdminBanTime[id], BannedId)
    
    
server_cmd("banid %d #%d ;writeid"AdminBanTime[id], get_user_userid(id))
    
    
server_exec()
    
    
AdminBanTime[id] = AdminBanTimeStrNum[id] = 0
    
    
return PLUGIN_HANDLED
    

__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.

Last edited by sixten_8_9@; 02-01-2019 at 13:49.
sixten_8_9@ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-01-2019 , 09:55   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #2

This is not the SourceMod section.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-01-2019 , 10:11   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #3

The plugin between [php] looks amxx. If I do not misunderstand, you want a AMX Mod X version of Sourcebans plugin, is that right?
__________________









Last edited by CrazY.; 02-01-2019 at 10:11.
CrazY. is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 02-01-2019 , 13:29   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
This is not the SourceMod section.
it is amx plugins
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.
sixten_8_9@ is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 02-01-2019 , 13:31   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #5

Quote:
Originally Posted by CrazY. View Post
The plugin between [php] looks amxx. If I do not misunderstand, you want a AMX Mod X version of Sourcebans plugin, is that right?
correct it is amx plugins ,
i want amx version so it work with sourcebans 2.0
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.
sixten_8_9@ is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-01-2019 , 13:52   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #6

https://dictionary.cambridge.org/dic...nglish/request
Quote:
Requests
When we make a request, we ask someone for something, or we ask someone to do something. …
https://dictionary.cambridge.org/dic...y/english/help
Quote:
Help
to make it possible or easier for someone to do something, by doing part of the work YOURSELF or by providing advice, money, support, etc.:
You're in wrong section, ask here instead.
https://forums.alliedmods.net/forumdisplay.php?f=12
__________________









Last edited by CrazY.; 02-01-2019 at 13:52.
CrazY. is offline
sixten_8_9@
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 02-01-2019 , 14:11   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #7

thx.
__________________
My Nick name is Nouton^
i have played cs for around 12years+
have build servers for about 12years
my website and my servers are: http://Nouton.se

i host at home did build my own server station for around 1300$.

Last edited by sixten_8_9@; 02-01-2019 at 14:17.
sixten_8_9@ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-02-2019 , 09:11   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #8

Quote:
Originally Posted by sixten_8_9@ View Post
correct it is amx plugins ,
i want amx version so it work with sourcebans 2.0
What are you talking about? How can an AMXX version work with SourceBans?!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 02-02-2019 , 14:49   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #9

I guess he wants to have an amxx plugin that checks his sourcebans Database for banned players and remove them from his gold source based server.
__________________

Mordekay 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 08:37.


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