SA-MP Forums Archive
Is this correct? - 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: Is this correct? (/showthread.php?tid=231401)



Is this correct? - OldDirtyBastard - 25.02.2011

I made a ping kicker, what it should do is, it should warn a player about his
ping that is exceeding the server limit, if the ping doesnt goes under the limit
in 10 seconds the player gets kicked:

pawn Код:
public pingkicker(playerid)
{
    if(GetPlayerPing(playerid) > 400)
    {
        pingwarning(playerid);
        SendClientMessage(playerid,COLOR_RED,"WARNING: Your ping exeeds the limit of 400 ms, you have 10 seconds to establish your ping or else you will be kicked.");
        pingkickz[playerid] = SetTimerEx("pingkick",9999,false,"i",playerid);
        if(GetPlayerPing(playerid) < 400)
        {
            KillTimer(pingkickz[playerid]);
            hidepingwarning(playerid);
        }
    }
    return 1;
}
But the problem is that......i cant test it myself, i tried to load
like 10 torrents at the same time but no success

So any good scripter might tell me if this is gonna work and if not,
please give me some advices how to fix it.
Thanks regards.


Re: Is this correct? - Jeffry - 25.02.2011

Hint:
Change the 400 to a lower value (less then your PING). Then you can test it.
Afterwards just set the value to 400 again.

Cheers!


Re: Is this correct? - OldDirtyBastard - 25.02.2011

Yea thats a great idea, thanks!


Re: Is this correct? - Jeffry - 25.02.2011

Quote:
Originally Posted by OldDirtyBastard
Посмотреть сообщение
Yea thats a great idea, thanks!
I always test my things like this.
Have fun.


Re: Is this correct? - Mean - 25.02.2011

You should make it, so it doesn't kick players with 65535 ping, because player gets 65535 when he connects for a few seconds, and he could get kicked for no reason.
pawn Код:
public pingkicker(playerid)
{
    if(GetPlayerPing(playerid) > 400 && GetPlayerPing(playerid) != 65535)
    {
        pingwarning(playerid);
        SendClientMessage(playerid,COLOR_RED,"WARNING: Your ping exeeds the limit of 400 ms, you have 10 seconds to establish your ping or else you will be kicked.");
        pingkickz[playerid] = SetTimerEx("pingkick",9999,false,"i",playerid);
        if(GetPlayerPing(playerid) < 400)
        {
            KillTimer(pingkickz[playerid]);
            hidepingwarning(playerid);
        }
    }
    return 1;
}