01.06.2012, 07:53
Hello,
I need help with my Ping Checker,
it warns me even i set the max ping to 0
How to fix with this issue?
I need help with my Ping Checker,
it warns me even i set the max ping to 0
How to fix with this issue?
pawn Код:
//OnGameModeInit
Ping = SetTimer("PingChecker", 5000, true);
//OnGameModeExit
KillTimer(Ping);
forward PingChecker();
public PingChecker()
{
new str[128];
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
if(GetPlayerPing(i) > dini_Int("Clan/Config/serverconfg.cfg", "MaxPing"))
{
if(pData[i][Warn] == MAX_WARNINGS)
{
format(str, sizeof(str), "%s(%d) has been kicked from the server for Reaching Maxium Ping (Ping: %d | Maxium Ping: %d)", GetpName(i), i, GetPlayerPing(i), dini_Int("Clan/Config/serverconfg.cfg", "MaxPing"));
SendClientMessageToAll(COLOR_RED, str);
Kick(i);
}
pData[i][Warn]++;
format(str, sizeof(str), "[PING] %s(%d) has recieved a Ping Warning (Warnings: %d/%d)", GetpName(i), i, pData[i][Warn], MAX_WARNINGS);
SendClientMessageToAll(COLOR_YELLOW, str);
}
}
}
return 1;
}
CMD:setmaxping(playerid, params[])
{
new str[128], maxping;
if(pData[playerid][Login] == 0) return SendClientMessage(playerid, COLOR_RED, "*** Please login first! ***");
if(pData[playerid][Admin] >= 4 || IsPlayerAdmin(playerid))
{
if(sscanf(params, "i", maxping))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /setmaxping [Ping]");
SendClientMessage(playerid, COLOR_RED, "Note: "white"If you want to disable the Ping Kicker just do /setmaxping 0");
return 1;
}
sData[MaxPing] = maxping;
dini_IntSet("Clan/Config/serverconfg.cfg", "MaxPing", sData[MaxPing]);
foreach(Player, i)
{
format(str, sizeof(str), "~w~Max Ping ~r~set ~w~to ~y~%d", maxping);
GameTextForPlayer(i, str, 4000, 3);
PlayerPlaySound(i,1057,0.0,0.0,0.0);
}
if(maxping == 0)
{
format(str, sizeof(str), "Administrator %s(%d) has disable maxium ping!", GetpName(playerid), playerid);
SendClientMessageToAll(COLOR_YELLOW, str);
return 1;
}
format(str, sizeof(str), "Administrator %s(%d) has set maxium ping to %d", GetpName(playerid), playerid, maxping);
SendClientMessageToAll(COLOR_RED, str);
format(str, sizeof(str), "ADMMSG: Administrator %s(%d) has use /setmaxping", GetpName(playerid), playerid);
ReadADMCMD(playerid, COLOR_BLUE, str);
}
else return SendClientMessage(playerid, COLOR_RED, "*** You are not Head Administrator ***");
return 1;
}