Raised This Month: $ Target: $400
 0% 

remake this plugin to 2.0 Sourcebans {HELP}


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[email protected]
Senior Member
Join Date: Jun 2009
Location: Sweden
Old 02-01-2019 , 14:08   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$.
sixten_8_9@ is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-02-2019 , 09:12   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #2

You're requesting an AMXX code to be modified to work for SourceMod. Obviously you need to request it in the SourceMod section, not in the AMXX one. Also, nobody will do anything about it unless you explain what you want.
__________________

Last edited by OciXCrom; 02-02-2019 at 09:13.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mr Misw
Member
Join Date: Aug 2018
Location: India
Old 02-02-2019 , 10:11   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #3

I think he is trying to put Sourceban 2.0 fuctions to His AMXX Plugin
__________________
Facebook ==> Here
ScrewedUP's Website :
Main Website
My Ranking System [Skin Version] :
ScrewedUP Ranking System
My Ranking System [Without Skin Version] :
ScrewedUP Ranking System
Mr Misw is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-02-2019 , 15:23   Re: remake this plugin to 2.0 Sourcebans {HELP}
Reply With Quote #4

He gave an AMXX code and clearly said that he wants it converted for SourceBans.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 18:22.


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