|
Member
|
06-27-2015
, 13:52
Re: Compile error and i don't know why.
|
#11
|
Quote:
Originally Posted by ESK0
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_Kick, ADMFLAG_KICK)
}
public PerformKick(int client,int target)
{
if (target != -1)
{
char name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
LogAction(client, target, "\"%N\" kicked \"%N\" due high ping.", client, target);
KickClient(target, "You were kicked from server due high ping");
}
}
public Action Command_Kick(int client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[CGI] Usage: sm_kickping <playerid|name>");
return Plugin_Handled;
}
char Arguments[256];
GetCmdArgString(Arguments, sizeof(Arguments));
char arg[65];
int len = BreakString(Arguments, arg, sizeof(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 = 0; i < target_count; i++)
{
if (target_list[i] == client)
{
kick_self = client;
}
else
{
PerformKick(client, target_list[i]);
}
}
if (kick_self)
{
PerformKick(client, client);
}
}
else
{
ReplyToTargetError(client, target_count);
}
return Plugin_Handled;
}
|
Thank you very much!
|
|
|
|