How to fix the SPAM?
#8

pawn Код:
//Set it as local, the default MaxPing is 1050
new MPing = 1050; //Change the 1050 to any number you want ( 300+ )


//OnPlayerConnect

SetTimerEx("PingTimer", 40000, true, "i", playerid); //Sets a 40second timer

//Anywhere at your script (Not in a callback!)

forward PingTimer(playerid);

public PingTimer(playerid)

for(new i = 0; i < MAX_PLAYERS; i ++)
{
    if(IsPlayerConnected(i))
    {
        new ping = GetPlayerPing(i); //Gets ping
    if(ping > MPing) //If players ping is higher than Max.Ping
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(i, name, sizeof(name));
        new string[128];
        format(string, sizeof(string), "* %s[%d] has been auto-kicked for having a high ping [%d/%d]", name, i, ping, MPing);
        SendClientMessageToAll(COLOR_YELLOW, string);
        SetTimerEx("KickTimer", 100, false, "i", i);
        return 1;
    }
    }
    return 1;
}

//KickTimer

public KickTimer(playerid)
{
    Kick(playerid);
    return 1;
}

//Additional command:

CMD:setping(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "* You need to be an admin to use this command!");
    new string[112];
    new newlimit;
    if(sscanf(params, "i", newlimit)) return SendClientMessage(playerid, COLOR_RED, "[USAGE] - /setping [PING-LIMIT]");
    MPing = newlimit;
    if(newlimit < 499) return SendClientMessage(playerid, COLOR_YELLOW, "[INFO] - The lowest ping limit is 500!"); //stuff
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[PING] - Admin %s[%d] has changed the ping-limit to %i!", pName, playerid, newlimit);
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;
}
..
Reply


Messages In This Thread
How to fix the SPAM? - by Ercha - 17.02.2014, 09:23
Re: How to fix the SPAM? - by ]Rafaellos[ - 17.02.2014, 09:25
Re: How to fix the SPAM? - by Ercha - 17.02.2014, 09:32
Re: How to fix the SPAM? - by iJumbo - 17.02.2014, 09:33
Re: How to fix the SPAM? - by [EnErGyS]KING - 17.02.2014, 09:35
Re: How to fix the SPAM? - by Ercha - 17.02.2014, 09:37
Re: How to fix the SPAM? - by Ercha - 17.02.2014, 09:45
Re: How to fix the SPAM? - by Kyance - 17.02.2014, 10:55
Re: How to fix the SPAM? - by ]Rafaellos[ - 17.02.2014, 12:08
Re: How to fix the SPAM? - by Vince - 17.02.2014, 13:58

Forum Jump:


Users browsing this thread: 3 Guest(s)