Raised This Month: $32 Target: $400
 8% 

there are a few problems in this plugin, can anyone solve it?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 03-25-2021 , 04:43   there are a few problems in this plugin, can anyone solve it?
Reply With Quote #1

The main purpose of this plugin is to start players vote kick with a drop-down menu but I get this problem during compilation. Who is there who can help? Also, I literally couldn't make the menu, and if anyone can help, I'll wait.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <geoip>
#define PLUGIN_VERSION "1.0"

public Plugin:myinfo 
{
    
name "L4D_Votekick",
    
author "DarkWob",
    
description "Votekick with menu",
    
version PLUGIN_VERSION,
    
url "regionz.ml/bans"
};

public 
OnPluginStart()
{
    
LoadTranslations("l4d_votekick.phrases");    
    
CreateConVar("l4d_votekick_version"PLUGIN_VERSION" Version of L4D Votekick on this server "FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
RegAdminCmd("votekick"Command_VotekickADMFLAG_GENERIC"votekick");
    
RegAdminCmd("sm_votekick"Command_VotekickADMFLAG_GENERIC"votekick");
    
RegAdminCmd("sm_vk"Command_VotekickADMFLAG_GENERIC"votekick");
    
RegAdminCmd"say"Command_SayADMFLAG_GENERIC"say");
    
RegAdminCmd("say_team"Command_SayADMFLAG_GENERIC"team");

public 
OnClientPostAdminCheck(client)
{
    if(!
IsFakeClient(client))
    {            
        
ClientCommand(client"bind 6 slot6");
        
ClientCommand(client"bind 7 slot7");
        
ClientCommand(client"bind 8 slot8");
        
ClientCommand(client"bind 9 slot9");
        
ClientCommand(client"bind 0 slot10");
    }
}

public 
Action:Command_Votekick(clientargs)
{
    if(
client!=0CreateVotekickMenu(client);        
    return 
Plugin_Handled;
}

CreateVotekickMenu(client)
{    
    new 
Handle:menu CreateMenu(Menu_Votekick);        
    new 
team=GetClientTeam(client);
    new 
String:name[MAX_NAME_LENGTH];
    new 
String:uid[12];
    new 
String:menuItem[64];
    new 
String:ip[16];
    new 
String:code[4];
    for(new 
i=1;i<=MaxClients;i++)
    {
        if(
IsClientInGame(i) && !IsFakeClient(i) && i!=client && GetClientTeam(i)==team)
        {            
            
Format(uid,sizeof(uid),"%i",GetClientUserId(i));
            if(
GetClientName(i,name,sizeof(name)))
            {
                if(
GetClientIP(iipsizeof(ip)))
                {
                    if(!
GeoipCode3(ipcode))
                        
strcopy(code,sizeof(code),"LAN");
                    
Format(menuItem,sizeof(menuItem),"%s (%s)",name,code);
                    
AddMenuItem(menuuidmenuItem);
                }
                else 
AddMenuItem(menuuidname);                
            }
        }        
    }
    
    
SetMenuTitle(menu"%T","Player To Kick",client);
    if (
menu == INVALID_HANDLE)
    {
        
LogMessage("Could not create menu for votekick");
    }
    else
    {
        
DisplayMenu(menuclientMENU_TIME_FOREVER);    
    }
}

public 
Menu_Votekick(Handle:menuMenuAction:actionparam1param2)
{
    if (
action == MenuAction_Select)
    {
        new 
String:info[12]; 
        
        if(
GetMenuItem(menuparam2infosizeof(info)))
        {
            
FakeClientCommand(param1,"callvote Kick %s",info);
        }        
    }
    else if (
action == MenuAction_End)
    {        
        
CloseHandle(menu);
    }
}

public 
Action:Command_Say(clientargs)
{
    
decl String:text[192], String:command[64];
    new 
startidx 0;
    if (
GetCmdArgString(textsizeof(text)) < 1)
    {
        return 
Plugin_Continue;
    }
    
    if (
text[strlen(text)-1] == '"')
    {
        
text[strlen(text)-1] = '\0';
        
startidx 1;
    }

    if (
strcmp(command"say2"false) == 0)
        
startidx += 4;

    if (
strcmp(text[startidx], "votekick"false) == 0)
    {
        if(
client!=0CreateVotekickMenu(client);        
    }
    return 
Plugin_Continue;

Quote:
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(1 : warning 234: symbol "FCVAR_PLUGIN" is marked as deprecated: No logic using this flag ever existed in a released game. It only ever appeared in the first hl2sdk.

/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(19) : error 017: undefined symbol "Command_Votekick"
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(20) : error 017: undefined symbol "Command_Votekick"
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(21) : error 017: undefined symbol "Command_Votekick"
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(22) : error 076: syntax error in the expression, or invalid function call
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(22) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(22) : error 017: undefined symbol "Command_Say"
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(22) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/phpOjhB2K.sp(22) : fatal error 190: too many error messages on one line
Darkwob is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 03-25-2021 , 07:35   Re: there are a few problems in this plugin, can anyone solve it?
Reply With Quote #2

Code:
#pragma semicolon 1
#include <sourcemod>
#include <geoip>
#define PLUGIN_VERSION "1.0"

public Plugin:myinfo = 
{
    name = "L4D_Votekick",
    author = "DarkWob",
    description = "Votekick with menu",
    version = PLUGIN_VERSION,
    url = "regionz.ml/bans"
};

public OnPluginStart()
{
    LoadTranslations("l4d_votekick.phrases");    
    CreateConVar("l4d_votekick_version", PLUGIN_VERSION, " Version of L4D Votekick on this server ", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    RegAdminCmd("votekick", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("sm_votekick", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("sm_vk", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("say", Command_Say, ADMFLAG_GENERIC, "say");
    RegAdminCmd("say_team", Command_Say, ADMFLAG_GENERIC, "team");
}

public OnClientPostAdminCheck(client)
{
    if(!IsFakeClient(client))
    {            
        ClientCommand(client, "bind 6 slot6");
        ClientCommand(client, "bind 7 slot7");
        ClientCommand(client, "bind 8 slot8");
        ClientCommand(client, "bind 9 slot9");
        ClientCommand(client, "bind 0 slot10");
    }
}

public Action:Command_Votekick(client, args)
{
    if(client!=0) CreateVotekickMenu(client);        
    return Plugin_Handled;
}

CreateVotekickMenu(client)
{    
    new Handle:menu = CreateMenu(Menu_Votekick);        
    new team=GetClientTeam(client);
    new String:name[MAX_NAME_LENGTH];
    new String:uid[12];
    new String:menuItem[64];
    new String:ip[16];
    new String:code[4];
    for(new i=1;i<=MaxClients;i++)
    {
        if(IsClientInGame(i) && !IsFakeClient(i) && i!=client && GetClientTeam(i)==team)
        {            
            Format(uid,sizeof(uid),"%i",GetClientUserId(i));
            if(GetClientName(i,name,sizeof(name)))
            {
                if(GetClientIP(i, ip, sizeof(ip)))
                {
                    if(!GeoipCode3(ip, code))
                        strcopy(code,sizeof(code),"LAN");
                    Format(menuItem,sizeof(menuItem),"%s (%s)",name,code);
                    AddMenuItem(menu, uid, menuItem);
                }
                else AddMenuItem(menu, uid, name);                
            }
        }        
    }
    
    SetMenuTitle(menu, "%T","Player To Kick",client);
    if (menu == INVALID_HANDLE)
    {
        LogMessage("Could not create menu for votekick");
    }
    else
    {
        DisplayMenu(menu, client, MENU_TIME_FOREVER);    
    }
}

public Menu_Votekick(Handle:menu, MenuAction:action, param1, param2)
{
    if (action == MenuAction_Select)
    {
        new String:info[12]; 
        
        if(GetMenuItem(menu, param2, info, sizeof(info)))
        {
            FakeClientCommand(param1,"callvote Kick %s",info);
        }        
    }
    else if (action == MenuAction_End)
    {        
        CloseHandle(menu);
    }
}

public Action:Command_Say(client, args)
{
    decl String:text[192], String:command[64];
    new startidx = 0;
    if (GetCmdArgString(text, sizeof(text)) < 1)
    {
        return Plugin_Continue;
    }
    
    if (text[strlen(text)-1] == '"')
    {
        text[strlen(text)-1] = '\0';
        startidx = 1;
    }

    if (strcmp(command, "say2", false) == 0)
        startidx += 4;

    if (strcmp(text[startidx], "votekick", false) == 0)
    {
        if(client!=0) CreateVotekickMenu(client);        
    }
    return Plugin_Continue;
}
I only fixed the errors.
Drixevel is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 03-25-2021 , 18:25   Re: there are a few problems in this plugin, can anyone solve it?
Reply With Quote #3

Quote:
Originally Posted by Drixevel View Post
Code:
#pragma semicolon 1
#include <sourcemod>
#include <geoip>
#define PLUGIN_VERSION "1.0"

public Plugin:myinfo = 
{
    name = "L4D_Votekick",
    author = "DarkWob",
    description = "Votekick with menu",
    version = PLUGIN_VERSION,
    url = "regionz.ml/bans"
};

public OnPluginStart()
{
    LoadTranslations("l4d_votekick.phrases");    
    CreateConVar("l4d_votekick_version", PLUGIN_VERSION, " Version of L4D Votekick on this server ", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    RegAdminCmd("votekick", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("sm_votekick", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("sm_vk", Command_Votekick, ADMFLAG_GENERIC, "votekick");
    RegAdminCmd("say", Command_Say, ADMFLAG_GENERIC, "say");
    RegAdminCmd("say_team", Command_Say, ADMFLAG_GENERIC, "team");
}

public OnClientPostAdminCheck(client)
{
    if(!IsFakeClient(client))
    {            
        ClientCommand(client, "bind 6 slot6");
        ClientCommand(client, "bind 7 slot7");
        ClientCommand(client, "bind 8 slot8");
        ClientCommand(client, "bind 9 slot9");
        ClientCommand(client, "bind 0 slot10");
    }
}

public Action:Command_Votekick(client, args)
{
    if(client!=0) CreateVotekickMenu(client);        
    return Plugin_Handled;
}

CreateVotekickMenu(client)
{    
    new Handle:menu = CreateMenu(Menu_Votekick);        
    new team=GetClientTeam(client);
    new String:name[MAX_NAME_LENGTH];
    new String:uid[12];
    new String:menuItem[64];
    new String:ip[16];
    new String:code[4];
    for(new i=1;i<=MaxClients;i++)
    {
        if(IsClientInGame(i) && !IsFakeClient(i) && i!=client && GetClientTeam(i)==team)
        {            
            Format(uid,sizeof(uid),"%i",GetClientUserId(i));
            if(GetClientName(i,name,sizeof(name)))
            {
                if(GetClientIP(i, ip, sizeof(ip)))
                {
                    if(!GeoipCode3(ip, code))
                        strcopy(code,sizeof(code),"LAN");
                    Format(menuItem,sizeof(menuItem),"%s (%s)",name,code);
                    AddMenuItem(menu, uid, menuItem);
                }
                else AddMenuItem(menu, uid, name);                
            }
        }        
    }
    
    SetMenuTitle(menu, "%T","Player To Kick",client);
    if (menu == INVALID_HANDLE)
    {
        LogMessage("Could not create menu for votekick");
    }
    else
    {
        DisplayMenu(menu, client, MENU_TIME_FOREVER);    
    }
}

public Menu_Votekick(Handle:menu, MenuAction:action, param1, param2)
{
    if (action == MenuAction_Select)
    {
        new String:info[12]; 
        
        if(GetMenuItem(menu, param2, info, sizeof(info)))
        {
            FakeClientCommand(param1,"callvote Kick %s",info);
        }        
    }
    else if (action == MenuAction_End)
    {        
        CloseHandle(menu);
    }
}

public Action:Command_Say(client, args)
{
    decl String:text[192], String:command[64];
    new startidx = 0;
    if (GetCmdArgString(text, sizeof(text)) < 1)
    {
        return Plugin_Continue;
    }
    
    if (text[strlen(text)-1] == '"')
    {
        text[strlen(text)-1] = '\0';
        startidx = 1;
    }

    if (strcmp(command, "say2", false) == 0)
        startidx += 4;

    if (strcmp(text[startidx], "votekick", false) == 0)
    {
        if(client!=0) CreateVotekickMenu(client);        
    }
    return Plugin_Continue;
}
I only fixed the errors.
ty bros. I'm thinking about doing this votekick other voting models. can I do it through the same codes.?
Darkwob 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 05:20.


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