SA-MP Forums Archive
ping kicker - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ping kicker (/showthread.php?tid=188166)



ping kicker - Face9000 - 06.11.2010

Hai all,i need simple anti high ping kicker.

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


Re: ping kicker - ••• ĤБĶБM ••• - 06.11.2010

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



Re: ping kicker - Face9000 - 06.11.2010

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?


Re: ping kicker - Mike_Peterson - 06.11.2010

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


Re: ping kicker - Alex_Valde - 06.11.2010

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);



Re: ping kicker - Kwarde - 07.11.2010

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);
    }
}