Ping limit script
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

Fixed it, totally did something wrong
Reply
#5

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?
Reply
#6

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


Forum Jump:


Users browsing this thread: 2 Guest(s)