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

Compile error and i don't know why.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
goldenbuick707
Member
Join Date: Jun 2015
Old 06-27-2015 , 10:05   Compile error and i don't know why.
Reply With Quote #1

SOLVED

Last edited by goldenbuick707; 06-30-2015 at 14:27.
goldenbuick707 is offline
goldenbuick707
Member
Join Date: Jun 2015
Old 06-27-2015 , 10:07   Re: Compile error and i don't know why.
Reply With Quote #2

Mistake reply.

Last edited by goldenbuick707; 06-27-2015 at 10:08. Reason: Mistake reply.
goldenbuick707 is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 06-27-2015 , 10:33   Re: Compile error and i don't know why.
Reply With Quote #3

Change your

PHP Code:
public Plugin:myinfo 

        
name "kick ping" 
        
author "cgi" 
        
description "Kick player by high ping" 
        
version "0.1" 

to this:

PHP Code:
public Plugin:myinfo = {
    
name "kick ping",
    
author "cgi",
    
description "Kick player by high ping",
    
version "0.1",
}; 
xines is offline
goldenbuick707
Member
Join Date: Jun 2015
Old 06-27-2015 , 11:13   Re: Compile error and i don't know why.
Reply With Quote #4

Quote:
Originally Posted by xines View Post
Change your

PHP Code:
public Plugin:myinfo 

        
name "kick ping" 
        
author "cgi" 
        
description "Kick player by high ping" 
        
version "0.1" 

to this:

PHP Code:
public Plugin:myinfo = {
    
name "kick ping",
    
author "cgi",
    
description "Kick player by high ping",
    
version "0.1",
}; 
Thanks, but now when i'm trying to kick someone with the command /kickping, it doesn't do nothing.

I added it:
PHP Code:
new target FindTarget(client);
    if (
target == -1)
    {
        
/* FindTarget() automatically replies with the 
         * failure reason.
         */
        
return Plugin_Handled;
    }
 
    
KickClient(target);
 
    new 
String:name[MAX_NAME_LENGTH];
 
    
GetClientName(targetnamesizeof(name)); 
Now my code looks like that:

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "kick ping"
    
author "cgi"
    
description "Kick player by high ping"
    
version "0.1"
};  

public 
OnPluginStart()
{
    
RegAdminCmd("sm_kickping"Command_KickADMFLAG_KICK)
    new 
String:argsString:arg;
    new 
String:clientString:targetString:reason;
}

PerformKick(clienttargetString:reason[])
{
    new 
target FindTarget(client);
    if (
target == -1)
    {
        
/* FindTarget() automatically replies with the 
         * failure reason.
         */
        
return Plugin_Handled;
    }
 
    
KickClient(target);
 
    new 
String:name[MAX_NAME_LENGTH];
 
    
GetClientName(targetnamesizeof(name));
    
    
LogAction(clienttarget"\"%L\" kicked \"%L\" due high ping."clienttargetreason);

    if (
reason[0] == '\0')
    {
        
KickClient(target"%t""You're lagging our server, Please fix your connection.");
    }
    else
    {
        
KickClient(target"%s You're lagging our server, Please fix your connection.");
    }
}

public 
Action:Command_Kick(clientargs)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[CGI] Usage: sm_kickping <playerid|name>");
        return 
Plugin_Handled;
    }

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

    
decl String:arg[65];
    new 
len BreakString(Argumentsargsizeof(arg));
    
    if (
len == -1)
    {
        
/* Safely null terminate */
        
len 0;
        
Arguments[0] = '\0';
    }

    
decl String:target_name[MAX_TARGET_LENGTH];
    
decl target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    
    if ((
target_count ProcessTargetString(
            
arg,
            
client
            
target_list
            
MAXPLAYERS
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) > 0)
    {
        
decl String:reason[64];
        
Format(reasonsizeof(reason), Arguments[len]);

        if (
tn_is_ml)
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target"target_name);
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason"target_namereason);
            }
        }
        else
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target""_s"target_name);            
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason""_s"target_namereason);
            }
        }
        
        new 
kick_self 0;
        
        for (new 
0target_counti++)
        {
            
/* Kick everyone else first */
            
if (target_list[i] == client)
            {
                
kick_self client;
            }
            else
            {
                
PerformKick(clienttarget_list[i], reason);
            }
        }
        
        if (
kick_self)
        {
            
PerformKick(clientclientreason);
        }
    }
    else
    {
        
ReplyToTargetError(clienttarget_count);
    }

    return 
Plugin_Handled;

And now i got a compile error:
/home/groups/sourcemod/upload_tmp/phpt5r0Ps.sp(19) : error 092: number of arguments does not match definition

Can someone help? =)
btw, i wanted here to do command /kickping <player>
and it will kick him with reason "You're lagging our server, please check your connection."
if i did something wrong, I would happy if someone will tell me what to fix

Last edited by goldenbuick707; 06-27-2015 at 11:20.
goldenbuick707 is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 06-27-2015 , 11:33   Re: Compile error and i don't know why.
Reply With Quote #5

This plugin seems to have everything u need ? .

https://forums.alliedmods.net/showth...69939?p=769939

- Also i don't get why ping is "lagging your server" since it should only Lag their connection? And not the server or other players which is not affected other than they can see "he laggs" ?
xines is offline
goldenbuick707
Member
Join Date: Jun 2015
Old 06-27-2015 , 11:40   Re: Compile error and i don't know why.
Reply With Quote #6

Quote:
Originally Posted by xines View Post
This plugin seems to have everything u need ? .

https://forums.alliedmods.net/showth...69939?p=769939

- Also i don't get why ping is "lagging your server" since it should only Lag their connection? And not the server or other players which is not affected other than they can see "he laggs" ?
On my server i have it and it works bad, that's why i decided to make plugin,
Please Help!
goldenbuick707 is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 06-27-2015 , 11:42   Re: Compile error and i don't know why.
Reply With Quote #7

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "kick ping",
    
author "cgi",
    
description "Kick player by high ping",
    
version "0.1",
};

public 
OnPluginStart()
{
    
RegAdminCmd("sm_kickping"Command_KickADMFLAG_KICK)
}

public 
PerformKick(int client,int target, const char[] reason)
{
    if (
target != -1)
    {
      
KickClient(target);
      
char name[MAX_NAME_LENGTH];
      
GetClientName(targetnamesizeof(name));
      
LogAction(clienttarget"\"%N\" kicked \"%N\" due high ping."clienttargetreason);
      if (
reason[0] == '\0')
      {
          
// Are you using translate ?
          
KickClient(target"You were kicked from server: %s"reason);
          
//KickClient(target, "%T", "You're lagging our server, Please fix your connection.");
      
}
      else
      {
          
KickClient(target"You were kicked from server: %s"reason);
      }
    }
}

public 
Action Command_Kick(int clientargs)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[CGI] Usage: sm_kickping <playerid|name>");
        return 
Plugin_Handled;
    }

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

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

    if (
len == -1)
    {
        
len 0;
        
Arguments[0] = '\0';
    }

    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS];
    
int target_count;
    
bool tn_is_ml;

    if ((
target_count ProcessTargetString(
            
arg,
            
client,
            
target_list,
            
MAXPLAYERS,
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) > 0)
    {
        
char reason[64];
        
Format(reasonsizeof(reason), Arguments[len]);
        if (
tn_is_ml)
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target"target_name);
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason"target_namereason);
            }
        }
        else
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target""_s"target_name);
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason""_s"target_namereason);
            }
        }

        
int kick_self 0;

        for (
int i 0target_counti++)
        {
            
/* Kick everyone else first */
            
if (target_list[i] == client)
            {
                
kick_self client;
            }
            else
            {
                
PerformKick(clienttarget_list[i], reason);
            }
        }
        if (
kick_self)
        {
            
PerformKick(clientclientreason);
        }
    }
    else
    {
        
ReplyToTargetError(clienttarget_count);
    }
    return 
Plugin_Handled;

Tested and works..
ESK0 is offline
goldenbuick707
Member
Join Date: Jun 2015
Old 06-27-2015 , 12:03   Re: Compile error and i don't know why.
Reply With Quote #8

Quote:
Originally Posted by ESK0 View Post
PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "kick ping",
    
author "cgi",
    
description "Kick player by high ping",
    
version "0.1",
};

public 
OnPluginStart()
{
    
RegAdminCmd("sm_kickping"Command_KickADMFLAG_KICK)
}

public 
PerformKick(int client,int target, const char[] reason)
{
    if (
target != -1)
    {
      
KickClient(target);
      
char name[MAX_NAME_LENGTH];
      
GetClientName(targetnamesizeof(name));
      
LogAction(clienttarget"\"%N\" kicked \"%N\" due high ping."clienttargetreason);
      if (
reason[0] == '\0')
      {
          
// Are you using translate ?
          
KickClient(target"You were kicked from server: %s"reason);
          
//KickClient(target, "%T", "You're lagging our server, Please fix your connection.");
      
}
      else
      {
          
KickClient(target"You were kicked from server: %s"reason);
      }
    }
}

public 
Action Command_Kick(int clientargs)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[CGI] Usage: sm_kickping <playerid|name>");
        return 
Plugin_Handled;
    }

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

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

    if (
len == -1)
    {
        
len 0;
        
Arguments[0] = '\0';
    }

    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS];
    
int target_count;
    
bool tn_is_ml;

    if ((
target_count ProcessTargetString(
            
arg,
            
client,
            
target_list,
            
MAXPLAYERS,
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) > 0)
    {
        
char reason[64];
        
Format(reasonsizeof(reason), Arguments[len]);
        if (
tn_is_ml)
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target"target_name);
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason"target_namereason);
            }
        }
        else
        {
            if (
reason[0] == '\0')
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target""_s"target_name);
            }
            else
            {
                
ShowActivity2(client"[SM] ""%t""Kicked target reason""_s"target_namereason);
            }
        }

        
int kick_self 0;

        for (
int i 0target_counti++)
        {
            
/* Kick everyone else first */
            
if (target_list[i] == client)
            {
                
kick_self client;
            }
            else
            {
                
PerformKick(clienttarget_list[i], reason);
            }
        }
        if (
kick_self)
        {
            
PerformKick(clientclientreason);
        }
    }
    else
    {
        
ReplyToTargetError(clienttarget_count);
    }
    return 
Plugin_Handled;

Tested and works..
still doesn't do anything, please help!
goldenbuick707 is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 06-27-2015 , 13:00   Re: Compile error and i don't know why.
Reply With Quote #9

Quote:
Originally Posted by goldenbuick707 View Post
still doesn't do anything, please help!
... omg so you are so ueseless ? Idk why are you using translations.. that's the issue.. remove them end everything will works.
ESK0 is offline
ESK0
BANNED
Join Date: May 2014
Location: Czech Republic
Old 06-27-2015 , 13:38   Re: Compile error and i don't know why.
Reply With Quote #10

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "kick ping",
    
author "cgi",
    
description "Kick player by high ping",
    
version "0.1",
};

public 
OnPluginStart()
{
    
RegAdminCmd("sm_kickping"Command_KickADMFLAG_KICK)
}

public 
PerformKick(int client,int target)
{
    if (
target != -1)
    {
      
char name[MAX_NAME_LENGTH];
      
GetClientName(targetnamesizeof(name));
      
LogAction(clienttarget"\"%N\" kicked \"%N\" due high ping."clienttarget);
      
KickClient(target"You were kicked from server due high ping");
    }
}

public 
Action Command_Kick(int clientargs)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[CGI] Usage: sm_kickping <playerid|name>");
        return 
Plugin_Handled;
    }

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

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

    if (
len == -1)
    {
        
len 0;
        
Arguments[0] = '\0';
    }

    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS];
    
int target_count;
    
bool tn_is_ml;

    if ((
target_count ProcessTargetString(
            
arg,
            
client,
            
target_list,
            
MAXPLAYERS,
            
COMMAND_FILTER_CONNECTED,
            
target_name,
            
sizeof(target_name),
            
tn_is_ml)) > 0)
    {
      
int kick_self 0;
      for (
int i 0target_counti++)
      {
          if (
target_list[i] == client)
          {
              
kick_self client;
          }
          else
          {
              
PerformKick(clienttarget_list[i]);
          }
      }
      if (
kick_self)
      {
          
PerformKick(clientclient);
      }
    }
    else
    {
        
ReplyToTargetError(clienttarget_count);
    }
    return 
Plugin_Handled;


Last edited by ESK0; 06-27-2015 at 13:46.
ESK0 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 11:13.


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