SA-MP Forums Archive
Ping limit script - 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)
+--- Thread: Ping limit script (/showthread.php?tid=495353)



Ping limit script - Jimmy0wns - 16.02.2014

So, I've been having problems with my ping limit script, i hope one of you can help (:

This is my checkping script:
pawn Код:
k
But it doesn't work, neither gives the player any warnings when the player should get them.
The /setping works fine and also works with MySQL.


Re: Ping limit script - Cvnnor - 16.02.2014

pawn Код:
if(pInfo[playerid][pAdmin] < 1)
I'm guessing you want this function to be for players... Not administrators? If you want it to be for players remove that line.


Re: Ping limit script - Jimmy0wns - 16.02.2014

Quote:
Originally Posted by Cvnnor
Посмотреть сообщение
pawn Код:
if(pInfo[playerid][pAdmin] < 1)
I'm guessing you want this function to be for players... Not administrators? If you want it to be for players remove that line.
If the player is not an administrator, then it will try to give out warnings and then kick the player, but still it doesn't fix anything.


Re: Ping limit script - Jimmy0wns - 16.02.2014

Fixed it, totally did something wrong


Re: Ping limit script - CuervO - 17.02.2014

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
Fixed it, totally did something wrong
You defined (and used) the 'i' variable, while you were supposed to use the playerid parameter that the function header has defined?


Re: Ping limit script - Threshold - 17.02.2014

Just to tidy up your code:

pawn Код:
public CheckPing(playerid)
{
    if(pInfo[playerid][pAdmin] > 0) return 0;
    if(GetPlayerPing(playerid) <= MaxPing) return 0;
    new string[90];
    PingWarnings[playerid] += 1;
    if(PingWarnings[playerid] >= 3)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "%s(%d) has been kicked due to reaching 3/3 ping warnings.", name, playerid);
        SCMToALL(COLOR_GREY, string);
        format(string, sizeof(string), "You have been kicked due to reaching the maximum amount of ping warnings (3/3)");
        SCM(playerid, COLOR_RED, string);
        SetTimerEx("KickPlayerEx", 1000, false, "i", playerid);
        return 1;
    }  
    format(string, sizeof(string), "You have received a ping warning (%d/3)", PingWarnings[playerid]);
    SCM(playerid, COLOR_GREY, string);
    return 1;
}