AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   remake this plugin to 2.0 Sourcebans {HELP} (https://forums.alliedmods.net/showthread.php?t=314028)

sixten_8_9@ 02-01-2019 00:29

remake this plugin to 2.0 Sourcebans {HELP}
 
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
    



OciXCrom 02-01-2019 09:55

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
This is not the SourceMod section.

CrazY. 02-01-2019 10:11

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
The plugin between [php] looks amxx. If I do not misunderstand, you want a AMX Mod X version of Sourcebans plugin, is that right?

sixten_8_9@ 02-01-2019 13:29

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
Quote:

Originally Posted by OciXCrom (Post 2637623)
This is not the SourceMod section.

it is amx plugins

sixten_8_9@ 02-01-2019 13:31

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
Quote:

Originally Posted by CrazY. (Post 2637629)
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

CrazY. 02-01-2019 13:52

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
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

sixten_8_9@ 02-01-2019 14:11

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
thx.

OciXCrom 02-02-2019 09:11

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
Quote:

Originally Posted by sixten_8_9@ (Post 2637664)
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?!

Mordekay 02-02-2019 14:49

Re: remake this plugin to 2.0 Sourcebans {HELP}
 
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.


All times are GMT -4. The time now is 07:36.

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