ping kicker
#1

Hai all,i need simple anti high ping kicker.

Ex: If player have +500 ping,he got kicked
Reply
#2

pawn Код:
if (GetPlayerPing(playerid) > 500) {
SendClientMessage(playerid, COLOR, "You have been kicked for having a high ping.");
Kick(playerid);
}
Reply
#3

I want to show the message to all player,here is the code:

Код:
public OnPlayerUpdate(playerid)
{
    new string[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    if((GetPlayerPing(playerid) >= 400 && GetPlayerPing(playerid) != 65535))
    SendClientMessage(playerid,COLOR_GREEN,"Kicked - High Ping limit - Max 400.", playername);
    SendClientMessageToAll(COLOR_GREEN, "%s has been kicked because he excedeed max ping limit (400).");
    Kick(playerid);
    return 1;
}
What's wrong?
Reply
#4

logitech, i thought u needed to use static for onplayerupdate..
else everytime a player moves or does something the variables getting called..
also why not make a timer every 10-15 seconds repeating checking the ping and then kick..
else ur server will lagg like hell ;P
I did every minute a timer to save the player's position
Reply
#5

This was your code:

pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    if((GetPlayerPing(playerid) >= 400 && GetPlayerPing(playerid) != 65535))
    SendClientMessage(playerid,COLOR_GREEN,"Kicked - High Ping limit - Max 400.", playername);
    SendClientMessageToAll(COLOR_GREEN, "%s has been kicked because he excedeed max ping limit (400).");
    Kick(playerid);
    return 1;
}
These lines I don't understand:

pawn Код:
1.) --> SendClientMessage(playerid,COLOR_GREEN,"Kicked - High Ping limit - Max 400.", playername);
    2.) --> SendClientMessageToAll(COLOR_GREEN, "%s has been kicked because he excedeed max ping limit (400).");
1.) Why that ,playername in SendClientMessage
That should be like this:
pawn Код:
SendClientMessage(playerid,COLOR_GREEN,"Kicked - High Ping limit - Max 400.");
2.) Here you have %s in SendClienMessage...You can't actually do that..
That should be like this:
pawn Код:
new string[128];
format(string, sizeof(string), "%s has been kicked because he excedeed max ping limit (400).",playerame);
SendClientMessageToAll(COLOR_GREEN, string);
Reply
#6

So it will look like this:

pawn Код:
public OnPlayerUpdate(playerid)
{
    new playername[MAX_PLAYER_NAME], string[128];
    if(GetPlayerPing(playerid) > 400 && GetPlayerPing(playerid) != 65535){
        GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
        SendClientMessage(playerid, COLOR_GREEN, "[KICKED] Max ping exceeded <400>");
        Kick(playerid);
        format(string, 128, "[KICK] %s has been kicked: Max Ping <400>", playername);
        SendClientMessageToAll(COLOR_GREEN, string);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)