155. sor
SMA Forráskód: [ Mindet kijelol ]server_cmd("kick #%d", uID)
És még azt meglehetne csinálni, hogy ne időre kickelje, hanem simán egy kick.. Tehát az hülyeség, hogy 1percre kickeli..
Csak simán egy kick kellene.
#include <amxmodx>
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
static message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
message[192] = '^0';
static team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
message_begin(type, get_user_msgid("SayText"), _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
message_begin(type, get_user_msgid("TeamInfo"), _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
static i;
i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
{
return i;
}
}
return -1;
}
new const gName[] = "^x04[PING]^x01 ";
new HIGHPING_MAX = 100 // Bannolja X ping ut n
new HIGHPING_TIME = 3 // Bannol si ellen rz sek id k z t jelenti.
new HIGHPING_TESTS = 2 // Bannol s el tt tesztek sz ma
new iNumTests[33]
public plugin_init() {
register_plugin("Ping ban","1.0"," wassair & insatiors")
if (HIGHPING_TIME < 3) HIGHPING_TIME = 3
if (HIGHPING_TESTS < 2) HIGHPING_TESTS = 2
return PLUGIN_CONTINUE
}
public client_disconnect(id) {
remove_task(id)
return PLUGIN_CONTINUE
}
public client_putinserver(id) {
iNumTests[id] = 0
if (!is_user_bot(id)) {
new param[1]
param[0] = id
set_task(30.0, "showWarn", id, param, 1)
}
return PLUGIN_CONTINUE
}
kickPlayer(id) {
new name[32]
get_user_name(id, name, 31)
new uID = get_user_userid(id)
server_cmd("kick #%d", uID)
client_cmd(id, "echo ^"[PING] Magas ping miatt kickelve 1 percre!^"; disconnect")
ColorChat(0, GREEN, "%s^x03 %s^x01 kickelve nagy ping miatt.", gName, name)
return PLUGIN_CONTINUE
}
public checkPing(param[]) {
new id = param[0]
if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
remove_task(id)
ColorChat(id, GREEN, "%s Nincs ping ellenőrzés, mert admin vagy!", gName)
return PLUGIN_CONTINUE
}
new p, l
get_user_ping(id, p, l)
if (p > HIGHPING_MAX)
++iNumTests[id]
else
if (iNumTests[id] > 0) --iNumTests[id]
if (iNumTests[id] > HIGHPING_TESTS)
kickPlayer(id)
return PLUGIN_CONTINUE
}
public showWarn(param[]) {
ColorChat(param[0], GREEN, "%s A pinged maximum ^x04 %d ^x01 lehet, ha nagyobb kickelve leszel!", gName, HIGHPING_MAX)
set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
return PLUGIN_CONTINUE
}