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

Solved [CSGO] Advanced Basebans


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 10-24-2019 , 09:03   [CSGO] Advanced Basebans
Reply With Quote #1

Hello! I tried to edit basebans , but i got 2 problems (i think i made a retarded way to edit this , but okay )
This is the sp:
PHP Code:
/** 
 * vim: set ts=4 : 
 * ============================================================================= 
 * SourceMod Basecommands 
 * Functionality related to banning. 
 * 
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved. 
 * ============================================================================= 
 * 
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License, version 3.0, as published by the 
 * Free Software Foundation. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 * details. 
 * 
 * You should have received a copy of the GNU General Public License along with 
 * this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 * As a special exception, AlliedModders LLC gives you permission to link the 
 * code of this program (as well as its derivative works) to "Half-Life 2," the 
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software 
 * by the Valve Corporation.  You must obey the GNU General Public License in 
 * all respects for all other code used.  Additionally, AlliedModders LLC grants 
 * this exception to all derivative works.  AlliedModders LLC defines further 
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), 
 * or <http://www.sourcemod.net/license.php>. 
 * 
 * Version: $Id$ 
 */ 

void PrepareBan(int clientint targetint time, const char[] reason

    
int originalTarget GetClientOfUserId(g_BanTargetUserId[client]); 

    if (
originalTarget != target
    { 
        if (
client == 0
        { 
            
PrintToServer("[SM] %t""Player no longer available"); 
        } 
        else 
        { 
            
PrintToChat(client"[SM] %t""Player no longer available"); 
        } 

        return; 
    } 

    
char name[MAX_NAME_LENGTH]; 
    
GetClientName(targetnamesizeof(name)); 

    if (!
time
    { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason);  
        } 
    } else { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } 
    } 

    
LogAction(clienttarget"\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")"clienttargettimereason); 

    if (
reason[0] == '\0'
    { 
        
BanClient(targetBANFLAG_AUTO"You got banned. \nAdmin: %s \nTime: %s \nReason: N/A""sm_ban"clienttime); 
    } 
    else 
    { 
        
BanClient(targetBANFLAG_AUTO"You got banned. \nAdmin: %s \nTime: %s \nReason: %s""sm_ban"clienttimereason); 
    } 


void DisplayBanTargetMenu(int client

    
Menu menu = new Menu(MenuHandler_BanPlayerList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T:""Ban player"client); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanTimeMenu(int client

    
Menu menu = new Menu(MenuHandler_BanTimeList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban player"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
menu.AddItem("0""Permanent"); 
    
menu.AddItem("10""10 Minutes"); 
    
menu.AddItem("30""30 Minutes"); 
    
menu.AddItem("60""1 Hour"); 
    
menu.AddItem("240""4 Hours"); 
    
menu.AddItem("1440""1 Day"); 
    
menu.AddItem("10080""1 Week"); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanReasonMenu(int client

    
Menu menu = new Menu(MenuHandler_BanReasonList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true
     
    
//Add custom chat reason entry first 
    
menu.AddItem("""Custom reason (type in chat)"); 
     
    
//Loading configurable entries from the kv-file 
    
char reasonName[100]; 
    
char reasonFull[255]; 
     
    
//Iterate through the kv-file 
    
g_hKvBanReasons.GotoFirstSubKey(false); 
    do 
    { 
        
g_hKvBanReasons.GetSectionName(reasonNamesizeof(reasonName)); 
        
g_hKvBanReasons.GetString(NULL_STRINGreasonFullsizeof(reasonFull)); 
         
        
//Add entry 
        
menu.AddItem(reasonFullreasonName); 
         
    } while (
g_hKvBanReasons.GotoNextKey(false)); 
     
    
//Reset kvHandle 
    
g_hKvBanReasons.Rewind(); 

    
menu.Display(clientMENU_TIME_FOREVER); 


public 
void AdminMenu_Ban(TopMenu topmenu
                              
TopMenuAction action
                              
TopMenuObject object_id
                              
int param
                              
char[] buffer
                              
int maxlength

    
//Reset chat reason first 
    
g_IsWaitingForChatReason[param] = false
     
    if (
action == TopMenuAction_DisplayOption
    { 
        
Format(buffermaxlength"%T""Ban player"param); 
    } 
    else if (
action == TopMenuAction_SelectOption
    { 
        
DisplayBanTargetMenu(param); 
    } 


public 
int MenuHandler_BanReasonList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        if(
param2 == 0
        { 
            
//Chat reason 
            
g_IsWaitingForChatReason[param1] = true
            
PrintToChat(param1"[SM] %t""Custom ban reason explanation""sm_abortban"); 
        } 
        else 
        { 
            
char info[64]; 
             
            
menu.GetItem(param2infosizeof(info)); 
             
            
PrepareBan(param1g_BanTarget[param1], g_BanTime[param1], info); 
        } 
    } 


public 
int MenuHandler_BanPlayerList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32], name[32]; 
        
int useridtarget

        
menu.GetItem(param2infosizeof(info), _namesizeof(name)); 
        
userid StringToInt(info); 

        if ((
target GetClientOfUserId(userid)) == 0
        { 
            
PrintToChat(param1"[SM] %t""Player no longer available"); 
        } 
        else if (!
CanUserTarget(param1target)) 
        { 
            
PrintToChat(param1"[SM] %t""Unable to target"); 
        } 
        else 
        { 
            
g_BanTarget[param1] = target
            
g_BanTargetUserId[param1] = userid
            
DisplayBanTimeMenu(param1); 
        } 
    } 


public 
int MenuHandler_BanTimeList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32]; 

        
menu.GetItem(param2infosizeof(info)); 
        
g_BanTime[param1] = StringToInt(info); 

        
DisplayBanReasonMenu(param1); 
    } 


public 
Action Command_Ban(int clientint args

    if (
args 2
    { 
        
ReplyToCommand(client"[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]"); 
        return 
Plugin_Handled
    } 

    
int lennext_len
    
char Arguments[256]; 
    
GetCmdArgString(Argumentssizeof(Arguments)); 

    
char arg[65]; 
    
len BreakString(Argumentsargsizeof(arg)); 

    
int target FindTarget(clientargtrue); 
    if (
target == -1
    { 
        return 
Plugin_Handled
    } 

    
char s_time[12]; 
    if ((
next_len BreakString(Arguments[len], s_timesizeof(s_time))) != -1
    { 
        
len += next_len
    } 
    else 
    { 
        
len 0
        
Arguments[0] = '\0'
    } 

    
int time StringToInt(s_time); 

    
g_BanTargetUserId[client] = GetClientUserId(target); 

    
PrepareBan(clienttargettimeArguments[len]); 

    return 
Plugin_Handled

I wanted to to something like this:
PHP Code:
You got Banned.
Admin:
Time:
Reason
Errors:
PHP Code:
//// basebans.sp
//
// basebans/banfix.sp(76) : error 035: argument type mismatch (argument 3)
// basebans/banfix.sp(80) : error 035: argument type mismatch (argument 3) 
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908

Last edited by PorcusorulMagic; 10-31-2019 at 10:41. Reason: Solved
PorcusorulMagic is offline
Cruze
Veteran Member
Join Date: May 2017
Old 10-24-2019 , 09:48   Re: [CSGO] Advanced Basebans
Reply With Quote #2

PHP Code:
/**
 * vim: set ts=4 :
 * =============================================================================
 * SourceMod Basecommands
 * Functionality related to banning.
 *
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * As a special exception, AlliedModders LLC gives you permission to link the
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 * by the Valve Corporation.  You must obey the GNU General Public License in
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 * this exception to all derivative works.  AlliedModders LLC defines further
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 * or <http://www.sourcemod.net/license.php>.
 *
 * Version: $Id$
 */

void PrepareBan(int clientint targetint time, const char[] reason)
{
    
int originalTarget GetClientOfUserId(playerinfo[client].banTargetUserId);

    if (
originalTarget != target)
    {
        if (
client == 0)
        {
            
PrintToServer("[SM] %t""Player no longer available");
        }
        else
        {
            
PrintToChat(client"[SM] %t""Player no longer available");
        }

        return;
    }

    
char name[MAX_NAME_LENGTH];
    
GetClientName(targetnamesizeof(name));

    if (!
time)
    {
        if (
reason[0] == '\0')
        {
            
ShowActivity(client"%t""Permabanned player"name);
        }
        else
        {
            
ShowActivity(client"%t""Permabanned player reason"namereason);
        }
    }
    else
    {
        if (
reason[0] == '\0')
        {
            
ShowActivity(client"%t""Banned player"nametime);
        }
        else
        {
            
ShowActivity(client"%t""Banned player reason"nametimereason);
        }
    }

    
LogAction(clienttarget"\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")"clienttargettimereason);

    
char buffer[128];
    
    if (
reason[0] == '\0')
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: N/A"clienttime);
        
BanClient(targettimeBANFLAG_AUTO"Banned"buffer"sm_ban"client);
    }
    else
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: %s"clienttimereason);
        
BanClient(targettimeBANFLAG_AUTOreasonbuffer"sm_ban"client);
    }
}

void DisplayBanTargetMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanPlayerList);

    
char title[100];
    
Format(titlesizeof(title), "%T:""Ban player"client);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);

    
menu.Display(clientMENU_TIME_FOREVER);
}

void DisplayBanTimeMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanTimeList);

    
char title[100];
    
Format(titlesizeof(title), "%T: %N""Ban player"clientplayerinfo[client].banTarget);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;

    
menu.AddItem("0""Permanent");
    
menu.AddItem("10""10 Minutes");
    
menu.AddItem("30""30 Minutes");
    
menu.AddItem("60""1 Hour");
    
menu.AddItem("240""4 Hours");
    
menu.AddItem("1440""1 Day");
    
menu.AddItem("10080""1 Week");

    
menu.Display(clientMENU_TIME_FOREVER);
}

void DisplayBanReasonMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanReasonList);

    
char title[100];
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientplayerinfo[client].banTarget);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;
    
    
//Add custom chat reason entry first
    
menu.AddItem("""Custom reason (type in chat)");
    
    
//Loading configurable entries from the kv-file
    
char reasonName[100];
    
char reasonFull[255];
    
    
//Iterate through the kv-file
    
g_hKvBanReasons.GotoFirstSubKey(false);
    do
    {
        
g_hKvBanReasons.GetSectionName(reasonNamesizeof(reasonName));
        
g_hKvBanReasons.GetString(NULL_STRINGreasonFullsizeof(reasonFull));
        
        
//Add entry
        
menu.AddItem(reasonFullreasonName);
        
    } while (
g_hKvBanReasons.GotoNextKey(false));
    
    
//Reset kvHandle
    
g_hKvBanReasons.Rewind();

    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
void AdminMenu_Ban(TopMenu topmenu,
                              
TopMenuAction action,
                              
TopMenuObject object_id,
                              
int param,
                              
char[] buffer,
                              
int maxlength)
{
    
//Reset chat reason first
    
playerinfo[param].isWaitingForChatReason false;
    
    if (
action == TopMenuAction_DisplayOption)
    {
        
Format(buffermaxlength"%T""Ban player"param);
    }
    else if (
action == TopMenuAction_SelectOption)
    {
        
DisplayBanTargetMenu(param);
    }
}

public 
int MenuHandler_BanReasonList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        if(
param2 == 0)
        {
            
//Chat reason
            
playerinfo[param1].isWaitingForChatReason true;
            
PrintToChat(param1"[SM] %t""Custom ban reason explanation""sm_abortban");
        }
        else
        {
            
char info[64];
            
            
menu.GetItem(param2infosizeof(info));
            
            
PrepareBan(param1playerinfo[param1].banTargetplayerinfo[param1].banTimeinfo);
        }
    }
}

public 
int MenuHandler_BanPlayerList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
char info[32], name[32];
        
int useridtarget;

        
menu.GetItem(param2infosizeof(info), _namesizeof(name));
        
userid StringToInt(info);

        if ((
target GetClientOfUserId(userid)) == 0)
        {
            
PrintToChat(param1"[SM] %t""Player no longer available");
        }
        else if (!
CanUserTarget(param1target))
        {
            
PrintToChat(param1"[SM] %t""Unable to target");
        }
        else
        {
            
playerinfo[param1].banTarget target;
            
playerinfo[param1].banTargetUserId userid;
            
DisplayBanTimeMenu(param1);
        }
    }
}

public 
int MenuHandler_BanTimeList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
char info[32];

        
menu.GetItem(param2infosizeof(info));
        
playerinfo[param1].banTime StringToInt(info);

        
DisplayBanReasonMenu(param1);
    }
}

public 
Action Command_Ban(int clientint args)
{
    if (
args 2)
    {
        if ((
GetCmdReplySource() == SM_REPLY_TO_CHAT) && (client != 0) && (args == 0))
        {
            
DisplayBanTargetMenu(client);
        }
        else
        {
            
ReplyToCommand(client"[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]");
        }
        
        return 
Plugin_Handled;
    }

    
int lennext_len;
    
char Arguments[256];
    
GetCmdArgString(Argumentssizeof(Arguments));

    
char arg[65];
    
len BreakString(Argumentsargsizeof(arg));

    
int target FindTarget(clientargtrue);
    if (
target == -1)
    {
        return 
Plugin_Handled;
    }

    
char s_time[12];
    if ((
next_len BreakString(Arguments[len], s_timesizeof(s_time))) != -1)
    {
        
len += next_len;
    }
    else
    {
        
len 0;
        
Arguments[0] = '\0';
    }

    
playerinfo[client].banTargetUserId GetClientUserId(target);

    
int time StringToInt(s_time);
    
PrepareBan(clienttargettimeArguments[len]);

    return 
Plugin_Handled;

Try this. Untested.
__________________
Taking paid private requests! Contact me

Last edited by Cruze; 10-24-2019 at 09:50.
Cruze is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 10-24-2019 , 10:14   Re: [CSGO] Advanced Basebans
Reply With Quote #3

Quote:
Originally Posted by Cruze View Post
PHP Code:
/**
 * vim: set ts=4 :
 * =============================================================================
 * SourceMod Basecommands
 * Functionality related to banning.
 *
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
 * =============================================================================
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, version 3.0, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * As a special exception, AlliedModders LLC gives you permission to link the
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 * by the Valve Corporation.  You must obey the GNU General Public License in
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 * this exception to all derivative works.  AlliedModders LLC defines further
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 * or <http://www.sourcemod.net/license.php>.
 *
 * Version: $Id$
 */

void PrepareBan(int clientint targetint time, const char[] reason)
{
    
int originalTarget GetClientOfUserId(playerinfo[client].banTargetUserId);

    if (
originalTarget != target)
    {
        if (
client == 0)
        {
            
PrintToServer("[SM] %t""Player no longer available");
        }
        else
        {
            
PrintToChat(client"[SM] %t""Player no longer available");
        }

        return;
    }

    
char name[MAX_NAME_LENGTH];
    
GetClientName(targetnamesizeof(name));

    if (!
time)
    {
        if (
reason[0] == '\0')
        {
            
ShowActivity(client"%t""Permabanned player"name);
        }
        else
        {
            
ShowActivity(client"%t""Permabanned player reason"namereason);
        }
    }
    else
    {
        if (
reason[0] == '\0')
        {
            
ShowActivity(client"%t""Banned player"nametime);
        }
        else
        {
            
ShowActivity(client"%t""Banned player reason"nametimereason);
        }
    }

    
LogAction(clienttarget"\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")"clienttargettimereason);

    
char buffer[128];
    
    if (
reason[0] == '\0')
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: N/A"clienttime);
        
BanClient(targettimeBANFLAG_AUTO"Banned"buffer"sm_ban"client);
    }
    else
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: %s"clienttimereason);
        
BanClient(targettimeBANFLAG_AUTOreasonbuffer"sm_ban"client);
    }
}

void DisplayBanTargetMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanPlayerList);

    
char title[100];
    
Format(titlesizeof(title), "%T:""Ban player"client);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);

    
menu.Display(clientMENU_TIME_FOREVER);
}

void DisplayBanTimeMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanTimeList);

    
char title[100];
    
Format(titlesizeof(title), "%T: %N""Ban player"clientplayerinfo[client].banTarget);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;

    
menu.AddItem("0""Permanent");
    
menu.AddItem("10""10 Minutes");
    
menu.AddItem("30""30 Minutes");
    
menu.AddItem("60""1 Hour");
    
menu.AddItem("240""4 Hours");
    
menu.AddItem("1440""1 Day");
    
menu.AddItem("10080""1 Week");

    
menu.Display(clientMENU_TIME_FOREVER);
}

void DisplayBanReasonMenu(int client)
{
    
Menu menu = new Menu(MenuHandler_BanReasonList);

    
char title[100];
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientplayerinfo[client].banTarget);
    
menu.SetTitle(title);
    
menu.ExitBackButton true;
    
    
//Add custom chat reason entry first
    
menu.AddItem("""Custom reason (type in chat)");
    
    
//Loading configurable entries from the kv-file
    
char reasonName[100];
    
char reasonFull[255];
    
    
//Iterate through the kv-file
    
g_hKvBanReasons.GotoFirstSubKey(false);
    do
    {
        
g_hKvBanReasons.GetSectionName(reasonNamesizeof(reasonName));
        
g_hKvBanReasons.GetString(NULL_STRINGreasonFullsizeof(reasonFull));
        
        
//Add entry
        
menu.AddItem(reasonFullreasonName);
        
    } while (
g_hKvBanReasons.GotoNextKey(false));
    
    
//Reset kvHandle
    
g_hKvBanReasons.Rewind();

    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
void AdminMenu_Ban(TopMenu topmenu,
                              
TopMenuAction action,
                              
TopMenuObject object_id,
                              
int param,
                              
char[] buffer,
                              
int maxlength)
{
    
//Reset chat reason first
    
playerinfo[param].isWaitingForChatReason false;
    
    if (
action == TopMenuAction_DisplayOption)
    {
        
Format(buffermaxlength"%T""Ban player"param);
    }
    else if (
action == TopMenuAction_SelectOption)
    {
        
DisplayBanTargetMenu(param);
    }
}

public 
int MenuHandler_BanReasonList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        if(
param2 == 0)
        {
            
//Chat reason
            
playerinfo[param1].isWaitingForChatReason true;
            
PrintToChat(param1"[SM] %t""Custom ban reason explanation""sm_abortban");
        }
        else
        {
            
char info[64];
            
            
menu.GetItem(param2infosizeof(info));
            
            
PrepareBan(param1playerinfo[param1].banTargetplayerinfo[param1].banTimeinfo);
        }
    }
}

public 
int MenuHandler_BanPlayerList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
char info[32], name[32];
        
int useridtarget;

        
menu.GetItem(param2infosizeof(info), _namesizeof(name));
        
userid StringToInt(info);

        if ((
target GetClientOfUserId(userid)) == 0)
        {
            
PrintToChat(param1"[SM] %t""Player no longer available");
        }
        else if (!
CanUserTarget(param1target))
        {
            
PrintToChat(param1"[SM] %t""Unable to target");
        }
        else
        {
            
playerinfo[param1].banTarget target;
            
playerinfo[param1].banTargetUserId userid;
            
DisplayBanTimeMenu(param1);
        }
    }
}

public 
int MenuHandler_BanTimeList(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu)
        {
            
hTopMenu.Display(param1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
char info[32];

        
menu.GetItem(param2infosizeof(info));
        
playerinfo[param1].banTime StringToInt(info);

        
DisplayBanReasonMenu(param1);
    }
}

public 
Action Command_Ban(int clientint args)
{
    if (
args 2)
    {
        if ((
GetCmdReplySource() == SM_REPLY_TO_CHAT) && (client != 0) && (args == 0))
        {
            
DisplayBanTargetMenu(client);
        }
        else
        {
            
ReplyToCommand(client"[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]");
        }
        
        return 
Plugin_Handled;
    }

    
int lennext_len;
    
char Arguments[256];
    
GetCmdArgString(Argumentssizeof(Arguments));

    
char arg[65];
    
len BreakString(Argumentsargsizeof(arg));

    
int target FindTarget(clientargtrue);
    if (
target == -1)
    {
        return 
Plugin_Handled;
    }

    
char s_time[12];
    if ((
next_len BreakString(Arguments[len], s_timesizeof(s_time))) != -1)
    {
        
len += next_len;
    }
    else
    {
        
len 0;
        
Arguments[0] = '\0';
    }

    
playerinfo[client].banTargetUserId GetClientUserId(target);

    
int time StringToInt(s_time);
    
PrepareBan(clienttargettimeArguments[len]);

    return 
Plugin_Handled;

Try this. Untested.
I got this error:
PHP Code:
//// basebans.sp
//
// basebans/banarena.sp(36) : error 017: undefined symbol "playerinfo"
// basebans/banarena.sp(36) : warning 215: expression has no effect
// basebans/banarena.sp(36) : error 001: expected token: ";", but found "]"
// basebans/banarena.sp(36) : error 029: invalid expression, assumed zero
// basebans/banarena.sp(36) : fatal error 190: too many error messages on one line
// 
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908
PorcusorulMagic is offline
Cruze
Veteran Member
Join Date: May 2017
Old 10-24-2019 , 13:31   Re: [CSGO] Advanced Basebans
Reply With Quote #4

PHP Code:
/** 
 * vim: set ts=4 : 
 * ============================================================================= 
 * SourceMod Basecommands 
 * Functionality related to banning. 
 * 
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved. 
 * ============================================================================= 
 * 
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License, version 3.0, as published by the 
 * Free Software Foundation. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 * details. 
 * 
 * You should have received a copy of the GNU General Public License along with 
 * this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 * As a special exception, AlliedModders LLC gives you permission to link the 
 * code of this program (as well as its derivative works) to "Half-Life 2," the 
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software 
 * by the Valve Corporation.  You must obey the GNU General Public License in 
 * all respects for all other code used.  Additionally, AlliedModders LLC grants 
 * this exception to all derivative works.  AlliedModders LLC defines further 
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), 
 * or <http://www.sourcemod.net/license.php>. 
 * 
 * Version: $Id$ 
 */ 

void PrepareBan(int clientint targetint time, const char[] reason

    
int originalTarget GetClientOfUserId(g_BanTargetUserId[client]); 

    if (
originalTarget != target
    { 
        if (
client == 0
        { 
            
PrintToServer("[SM] %t""Player no longer available"); 
        } 
        else 
        { 
            
PrintToChat(client"[SM] %t""Player no longer available"); 
        } 

        return; 
    } 

    
char name[MAX_NAME_LENGTH]; 
    
GetClientName(targetnamesizeof(name)); 

    if (!
time
    { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason);  
        } 
    } else { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } 
    } 

    
LogAction(clienttarget"\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")"clienttargettimereason); 

    
char buffer[128];
    
    if (
reason[0] == '\0')
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: N/A"clienttime);
        
BanClient(targettimeBANFLAG_AUTO"Banned"buffer"sm_ban"client);
    }
    else
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: %s"clienttimereason);
        
BanClient(targettimeBANFLAG_AUTOreasonbuffer"sm_ban"client);
    }


void DisplayBanTargetMenu(int client

    
Menu menu = new Menu(MenuHandler_BanPlayerList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T:""Ban player"client); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanTimeMenu(int client

    
Menu menu = new Menu(MenuHandler_BanTimeList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban player"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
menu.AddItem("0""Permanent"); 
    
menu.AddItem("10""10 Minutes"); 
    
menu.AddItem("30""30 Minutes"); 
    
menu.AddItem("60""1 Hour"); 
    
menu.AddItem("240""4 Hours"); 
    
menu.AddItem("1440""1 Day"); 
    
menu.AddItem("10080""1 Week"); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanReasonMenu(int client

    
Menu menu = new Menu(MenuHandler_BanReasonList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true
     
    
//Add custom chat reason entry first 
    
menu.AddItem("""Custom reason (type in chat)"); 
     
    
//Loading configurable entries from the kv-file 
    
char reasonName[100]; 
    
char reasonFull[255]; 
     
    
//Iterate through the kv-file 
    
g_hKvBanReasons.GotoFirstSubKey(false); 
    do 
    { 
        
g_hKvBanReasons.GetSectionName(reasonNamesizeof(reasonName)); 
        
g_hKvBanReasons.GetString(NULL_STRINGreasonFullsizeof(reasonFull)); 
         
        
//Add entry 
        
menu.AddItem(reasonFullreasonName); 
         
    } while (
g_hKvBanReasons.GotoNextKey(false)); 
     
    
//Reset kvHandle 
    
g_hKvBanReasons.Rewind(); 

    
menu.Display(clientMENU_TIME_FOREVER); 


public 
void AdminMenu_Ban(TopMenu topmenu
                              
TopMenuAction action
                              
TopMenuObject object_id
                              
int param
                              
char[] buffer
                              
int maxlength

    
//Reset chat reason first 
    
g_IsWaitingForChatReason[param] = false
     
    if (
action == TopMenuAction_DisplayOption
    { 
        
Format(buffermaxlength"%T""Ban player"param); 
    } 
    else if (
action == TopMenuAction_SelectOption
    { 
        
DisplayBanTargetMenu(param); 
    } 


public 
int MenuHandler_BanReasonList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        if(
param2 == 0
        { 
            
//Chat reason 
            
g_IsWaitingForChatReason[param1] = true
            
PrintToChat(param1"[SM] %t""Custom ban reason explanation""sm_abortban"); 
        } 
        else 
        { 
            
char info[64]; 
             
            
menu.GetItem(param2infosizeof(info)); 
             
            
PrepareBan(param1g_BanTarget[param1], g_BanTime[param1], info); 
        } 
    } 


public 
int MenuHandler_BanPlayerList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32], name[32]; 
        
int useridtarget

        
menu.GetItem(param2infosizeof(info), _namesizeof(name)); 
        
userid StringToInt(info); 

        if ((
target GetClientOfUserId(userid)) == 0
        { 
            
PrintToChat(param1"[SM] %t""Player no longer available"); 
        } 
        else if (!
CanUserTarget(param1target)) 
        { 
            
PrintToChat(param1"[SM] %t""Unable to target"); 
        } 
        else 
        { 
            
g_BanTarget[param1] = target
            
g_BanTargetUserId[param1] = userid
            
DisplayBanTimeMenu(param1); 
        } 
    } 


public 
int MenuHandler_BanTimeList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32]; 

        
menu.GetItem(param2infosizeof(info)); 
        
g_BanTime[param1] = StringToInt(info); 

        
DisplayBanReasonMenu(param1); 
    } 


public 
Action Command_Ban(int clientint args

    if (
args 2
    { 
        
ReplyToCommand(client"[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]"); 
        return 
Plugin_Handled
    } 

    
int lennext_len
    
char Arguments[256]; 
    
GetCmdArgString(Argumentssizeof(Arguments)); 

    
char arg[65]; 
    
len BreakString(Argumentsargsizeof(arg)); 

    
int target FindTarget(clientargtrue); 
    if (
target == -1
    { 
        return 
Plugin_Handled
    } 

    
char s_time[12]; 
    if ((
next_len BreakString(Arguments[len], s_timesizeof(s_time))) != -1
    { 
        
len += next_len
    } 
    else 
    { 
        
len 0
        
Arguments[0] = '\0'
    } 

    
int time StringToInt(s_time); 

    
g_BanTargetUserId[client] = GetClientUserId(target); 

    
PrepareBan(clienttargettimeArguments[len]); 

    return 
Plugin_Handled

__________________
Taking paid private requests! Contact me
Cruze is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-24-2019 , 14:52   Re: [CSGO] Advanced Basebans
Reply With Quote #5

Why mark this post as CS:GO? I don't see any code unique to CS:GO
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
PorcusorulMagic
Member
Join Date: Dec 2018
Location: Romania
Old 10-31-2019 , 10:41   Re: [CSGO] Advanced Basebans
Reply With Quote #6

Quote:
Originally Posted by Cruze View Post
PHP Code:
/** 
 * vim: set ts=4 : 
 * ============================================================================= 
 * SourceMod Basecommands 
 * Functionality related to banning. 
 * 
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved. 
 * ============================================================================= 
 * 
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License, version 3.0, as published by the 
 * Free Software Foundation. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 * details. 
 * 
 * You should have received a copy of the GNU General Public License along with 
 * this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 * As a special exception, AlliedModders LLC gives you permission to link the 
 * code of this program (as well as its derivative works) to "Half-Life 2," the 
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software 
 * by the Valve Corporation.  You must obey the GNU General Public License in 
 * all respects for all other code used.  Additionally, AlliedModders LLC grants 
 * this exception to all derivative works.  AlliedModders LLC defines further 
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), 
 * or <http://www.sourcemod.net/license.php>. 
 * 
 * Version: $Id$ 
 */ 

void PrepareBan(int clientint targetint time, const char[] reason

    
int originalTarget GetClientOfUserId(g_BanTargetUserId[client]); 

    if (
originalTarget != target
    { 
        if (
client == 0
        { 
            
PrintToServer("[SM] %t""Player no longer available"); 
        } 
        else 
        { 
            
PrintToChat(client"[SM] %t""Player no longer available"); 
        } 

        return; 
    } 

    
char name[MAX_NAME_LENGTH]; 
    
GetClientName(targetnamesizeof(name)); 

    if (!
time
    { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04Permanent\x01) (\x07Reason: \x04%s\x01)"clienttargetreason);  
        } 
    } else { 
        if (
reason[0] == '\0'
        { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } else { 
        
PrintToChatAll("★ \x04[USP] \x07ADMIN \x02%N \x01banned \x04%N\x01. (\x07Time: \x04{%d} minutes\x01) (\x07Reason: \x04%s\x01)"clienttargettimereason); 
        } 
    } 

    
LogAction(clienttarget"\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")"clienttargettimereason); 

    
char buffer[128];
    
    if (
reason[0] == '\0')
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: N/A"clienttime);
        
BanClient(targettimeBANFLAG_AUTO"Banned"buffer"sm_ban"client);
    }
    else
    {
        
Format(buffersizeof(buffer), "You got banned.\nAdmin: %N\nTime: %d\nReason: %s"clienttimereason);
        
BanClient(targettimeBANFLAG_AUTOreasonbuffer"sm_ban"client);
    }


void DisplayBanTargetMenu(int client

    
Menu menu = new Menu(MenuHandler_BanPlayerList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T:""Ban player"client); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanTimeMenu(int client

    
Menu menu = new Menu(MenuHandler_BanTimeList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban player"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true

    
menu.AddItem("0""Permanent"); 
    
menu.AddItem("10""10 Minutes"); 
    
menu.AddItem("30""30 Minutes"); 
    
menu.AddItem("60""1 Hour"); 
    
menu.AddItem("240""4 Hours"); 
    
menu.AddItem("1440""1 Day"); 
    
menu.AddItem("10080""1 Week"); 

    
menu.Display(clientMENU_TIME_FOREVER); 


void DisplayBanReasonMenu(int client

    
Menu menu = new Menu(MenuHandler_BanReasonList); 

    
char title[100]; 
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientg_BanTarget[client]); 
    
menu.SetTitle(title); 
    
menu.ExitBackButton true
     
    
//Add custom chat reason entry first 
    
menu.AddItem("""Custom reason (type in chat)"); 
     
    
//Loading configurable entries from the kv-file 
    
char reasonName[100]; 
    
char reasonFull[255]; 
     
    
//Iterate through the kv-file 
    
g_hKvBanReasons.GotoFirstSubKey(false); 
    do 
    { 
        
g_hKvBanReasons.GetSectionName(reasonNamesizeof(reasonName)); 
        
g_hKvBanReasons.GetString(NULL_STRINGreasonFullsizeof(reasonFull)); 
         
        
//Add entry 
        
menu.AddItem(reasonFullreasonName); 
         
    } while (
g_hKvBanReasons.GotoNextKey(false)); 
     
    
//Reset kvHandle 
    
g_hKvBanReasons.Rewind(); 

    
menu.Display(clientMENU_TIME_FOREVER); 


public 
void AdminMenu_Ban(TopMenu topmenu
                              
TopMenuAction action
                              
TopMenuObject object_id
                              
int param
                              
char[] buffer
                              
int maxlength

    
//Reset chat reason first 
    
g_IsWaitingForChatReason[param] = false
     
    if (
action == TopMenuAction_DisplayOption
    { 
        
Format(buffermaxlength"%T""Ban player"param); 
    } 
    else if (
action == TopMenuAction_SelectOption
    { 
        
DisplayBanTargetMenu(param); 
    } 


public 
int MenuHandler_BanReasonList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        if(
param2 == 0
        { 
            
//Chat reason 
            
g_IsWaitingForChatReason[param1] = true
            
PrintToChat(param1"[SM] %t""Custom ban reason explanation""sm_abortban"); 
        } 
        else 
        { 
            
char info[64]; 
             
            
menu.GetItem(param2infosizeof(info)); 
             
            
PrepareBan(param1g_BanTarget[param1], g_BanTime[param1], info); 
        } 
    } 


public 
int MenuHandler_BanPlayerList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32], name[32]; 
        
int useridtarget

        
menu.GetItem(param2infosizeof(info), _namesizeof(name)); 
        
userid StringToInt(info); 

        if ((
target GetClientOfUserId(userid)) == 0
        { 
            
PrintToChat(param1"[SM] %t""Player no longer available"); 
        } 
        else if (!
CanUserTarget(param1target)) 
        { 
            
PrintToChat(param1"[SM] %t""Unable to target"); 
        } 
        else 
        { 
            
g_BanTarget[param1] = target
            
g_BanTargetUserId[param1] = userid
            
DisplayBanTimeMenu(param1); 
        } 
    } 


public 
int MenuHandler_BanTimeList(Menu menuMenuAction actionint param1int param2

    if (
action == MenuAction_End
    { 
        
delete menu
    } 
    else if (
action == MenuAction_Cancel
    { 
        if (
param2 == MenuCancel_ExitBack && hTopMenu
        { 
            
hTopMenu.Display(param1TopMenuPosition_LastCategory); 
        } 
    } 
    else if (
action == MenuAction_Select
    { 
        
char info[32]; 

        
menu.GetItem(param2infosizeof(info)); 
        
g_BanTime[param1] = StringToInt(info); 

        
DisplayBanReasonMenu(param1); 
    } 


public 
Action Command_Ban(int clientint args

    if (
args 2
    { 
        
ReplyToCommand(client"[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]"); 
        return 
Plugin_Handled
    } 

    
int lennext_len
    
char Arguments[256]; 
    
GetCmdArgString(Argumentssizeof(Arguments)); 

    
char arg[65]; 
    
len BreakString(Argumentsargsizeof(arg)); 

    
int target FindTarget(clientargtrue); 
    if (
target == -1
    { 
        return 
Plugin_Handled
    } 

    
char s_time[12]; 
    if ((
next_len BreakString(Arguments[len], s_timesizeof(s_time))) != -1
    { 
        
len += next_len
    } 
    else 
    { 
        
len 0
        
Arguments[0] = '\0'
    } 

    
int time StringToInt(s_time); 

    
g_BanTargetUserId[client] = GetClientUserId(target); 

    
PrepareBan(clienttargettimeArguments[len]); 

    return 
Plugin_Handled

It works! Thank you
__________________
Steam - https://steamcommunity.com/id/porcusorulmagic
Discord - PorcusorulMagic#4908
PorcusorulMagic 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 16:08.


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