Silentdeaths wrote:Guys u dont understand.. i live in south africa.. South African server's can not handle players from overseas, they get constant pings of 1000, and i do know how to code, im asking for 1 sentence THATS ALL,
how can it be fun to play, if u can not move????? all you see is you respawning, you guys may like a free practise dummy on your servers, but i dont okay?
Finaly here is the code, change the gametype of the server you are not allowed to use DM, TDM oder CTF.
***** Add in variables.hpp:
MACRO_CONFIG_INT(sv_highpingkick, 1, 0, 1, CFGFLAG_SERVER, "Enable (1) or disable (0) kicking players with high ping")
MACRO_CONFIG_INT(sv_highpingkick_maxping, 400, 0, 1000, CFGFLAG_SERVER, "Max ping")
MACRO_CONFIG_INT(sv_highpingkick_waitingtime, 5000, 1000, 999999, CFGFLAG_SERVER, "Time to wait before kicking the player (ms, 1000 ms = 1 s)")
***** Add in game/server/player.hpp:
int highpingtick;
int start_tick;
after
***** Add in game/server/player.cpp:
this->highpingtick = 0;
this->start_tick = 250;
after
this->client_id = client_id;
***** In game/server/player.cpp replace the PLAYER::tick() function with this here :
void PLAYER::tick()
{
server_setclientscore(client_id, score);
// do latency stuff
{
CLIENT_INFO info;
if(server_getclientinfo(client_id, &info))
{
latency.accum += info.latency;
latency.accum_max = max(latency.accum_max, info.latency);
latency.accum_min = min(latency.accum_min, info.latency);
}
if(server_tick()%server_tickspeed() == 0)
{
latency.avg = latency.accum/server_tickspeed();
latency.max = latency.accum_max;
latency.min = latency.accum_min;
latency.accum = 0;
latency.accum_min = 1000;
latency.accum_max = 0;
}
}
if(start_tick > 0)
start_tick--;
char buf1[256];
char buf2[256];
char buf3[256];
if(config.sv_highpingkick && latency.min >= config.sv_highpingkick_maxping && start_tick == 0)
{
str_format(buf1, sizeof(buf1), "W A R N I N G\nYour ping is higher than %d!\nFix it or you will be kicked in %2.2f Seconds!", config.sv_highpingkick_maxping, config.sv_highpingkick_waitingtime/1000.0-highpingtick/50.0);
game.send_broadcast(buf1, client_id);
highpingtick++;
}
else
{
if(highpingtick > 0 && start_tick == 0)
game.send_broadcast("Ping fixed!", client_id);
highpingtick = 0;
}
if(highpingtick/50.0*1000.0 >= config.sv_highpingkick_waitingtime)
{
str_format(buf2, sizeof(buf2), "%s got kicked due to a too high ping. (%d)", server_clientname(client_id), latency.min);
game.send_chat_target(-1, buf2);
str_format(buf3, sizeof(buf3), "You got kicked due to a to high ping. (%d)", latency.min);
server_kick(client_id, buf3);
return;
}
if(!character && die_tick+server_tickspeed()*3 <= server_tick())
spawning = true;
if(character)
{
if(character->alive)
{
view_pos = character->pos;
}
else
{
delete character;
character = 0;
}
}
else if(spawning && respawn_tick <= server_tick())
try_respawn();
}
This should be all, if you really want to do this.
And dont forget to change the gametype!