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

Compile Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oehmie
Junior Member
Join Date: Oct 2013
Location: Germany
Old 10-18-2013 , 10:53   Compile Error
Reply With Quote #1

PHP Code:
PrepareBan(clienttargettime, const String:reason[])
{
    new 
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;
    }

    new 
String:name[32];
    
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);

    if (
reason[0] == '\0')
    {
        
BanClient(targettimeBANFLAG_AUTO"Banned""Banned""sm_ban"client);
    }
    else
    {
        
BanClient(targettimeBANFLAG_AUTOreasonreason"sm_ban"client);
    }
}

DisplayBanTargetMenu(client)
{
    new 
Handle:menu CreateMenu(MenuHandler_BanPlayerList);

    
decl String:title[100];
    
Format(titlesizeof(title), "%T:""Ban player"client);
    
SetMenuTitle(menutitle);
    
SetMenuExitBackButton(menutrue);

    
AddTargetsToMenu2(menuclientCOMMAND_FILTER_NO_BOTS|COMMAND_FILTER_CONNECTED);

    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

DisplayBanTimeMenu(client)
{
    new 
Handle:menu CreateMenu(MenuHandler_BanTimeList);

    
decl String:title[100];
    
Format(titlesizeof(title), "%T: %N""Ban player"clientg_BanTarget[client]);
    
SetMenuTitle(menutitle);
    
SetMenuExitBackButton(menutrue);

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

    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

DisplayBanReasonMenu(client)
{
    new 
Handle:menu CreateMenu(MenuHandler_BanReasonList);

    
decl String:title[100];
    
Format(titlesizeof(title), "%T: %N""Ban reason"clientg_BanTarget[client]);
    
SetMenuTitle(menutitle);
    
SetMenuExitBackButton(menutrue);

    
/* :TODO: we should either remove this or make it configurable */

    
AddMenuItem(menu"Abusive""Abusive - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Racism""Racism");
    
AddMenuItem(menu"General cheating/exploits""General cheating/exploits - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Wallhack""Wallhack - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Aimbot""Aimbot - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Speedhacking""Speedhacking - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Mic spamming""Mic spamming - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Admin disrespect""Admin disrespect - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Camping""Camping - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Team killing""Team killing - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Unacceptable Spray""Unacceptable Spray - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Breaking Server Rules""Breaking Server Rules - Visit www.ban.wildlife-wdc.de to manage your Ban");
    
AddMenuItem(menu"Other""Other - Visit www.ban.wildlife-wdc.de to manage your Ban");

    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
AdminMenu_Ban(Handle:topmenu,
                              
TopMenuAction:action,
                              
TopMenuObject:object_id,
                              
param,
                              
String:buffer[],
                              
maxlength)
{
    if (
action == TopMenuAction_DisplayOption)
    {
        
Format(buffermaxlength"%T""Ban player"param);
    }
    else if (
action == TopMenuAction_SelectOption)
    {
        
DisplayBanTargetMenu(param);
    }
}

public 
MenuHandler_BanReasonList(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
        {
            
DisplayTopMenu(hTopMenuparam1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
decl String:info[64];

        
GetMenuItem(menuparam2infosizeof(info));

        
PrepareBan(param1g_BanTarget[param1], g_BanTime[param1], info);
    }
}

public 
MenuHandler_BanPlayerList(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
        {
            
DisplayTopMenu(hTopMenuparam1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
decl String:info[32], String:name[32];
        new 
useridtarget;

        
GetMenuItem(menuparam2infosizeof(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 
MenuHandler_BanTimeList(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_End)
    {
        
CloseHandle(menu);
    }
    else if (
action == MenuAction_Cancel)
    {
        if (
param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
        {
            
DisplayTopMenu(hTopMenuparam1TopMenuPosition_LastCategory);
        }
    }
    else if (
action == MenuAction_Select)
    {
        
decl String:info[32];

        
GetMenuItem(menuparam2infosizeof(info));
        
g_BanTime[param1] = StringToInt(info);

        
DisplayBanReasonMenu(param1);
    }
}


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

    
decl lennext_len;
    
decl String:Arguments[256];
    
GetCmdArgString(Argumentssizeof(Arguments));

    
decl String:arg[65];
    
len BreakString(Argumentsargsizeof(arg));

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

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

    new 
time StringToInt(s_time);

    
g_BanTargetUserId[client] = GetClientUserId(target);

    
PrepareBan(clienttargettimeArguments[len]);

    return 
Plugin_Handled;

On Line 3 I got an Error: undefinded Symbol: g_BanTargetUserId

Please Help me
Oehmie is offline
Send a message via Skype™ to Oehmie
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-18-2013 , 10:55   Re: Compile Error
Reply With Quote #2

Do you have a
PHP Code:
new g_BanTargetUserId[MAXPLAYERS+1]; 
somewhere above this in the code?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Oehmie
Junior Member
Join Date: Oct 2013
Location: Germany
Old 10-18-2013 , 11:02   Re: Compile Error
Reply With Quote #3

Thanks for your Answer.
Im new to Scripting in Sourcemod

Now I got these Errors:

PHP Code:
undefined SymbolAddTargetsToMenu2 
on Line 94

And this:

PHP Code:
undefined Symbolg_BanTarget 
on Line 104
Oehmie is offline
Send a message via Skype™ to Oehmie
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-18-2013 , 11:36   Re: Compile Error
Reply With Quote #4

is that your entire code? You are missing stuff if it is
__________________
View my Plugins | Donate
TnTSCS is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 10-18-2013 , 12:26   Re: Compile Error
Reply With Quote #5

Use sourcemod 1.6. It includes a patch I have submitted a few month ago that added configurable ban reasons via a keyvalue-file.
https://bugs.alliedmods.net/show_bug.cgi?id=5762

EDIT: Or do not use sourcemod 1.6, but instead use its "basebans.smx"-file from the "plugins"-folder, and the "banreasonssomething"-file from its "configs"-folder.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 10-18-2013 at 12:28.
Dr. Greg House 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 02:08.


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