Flood, big flood - 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: Flood, big flood (
/showthread.php?tid=418270)
Flood, big flood -
ancezas - 24.02.2013
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerPing(playerid) > MAX_PING)
{
new name[MAX_PLAYER_NAME],msg[150];
GetPlayerName(playerid, name, sizeof(name));
format(msg, sizeof(msg), "[Kick] Ћaidėjas %s buvo iљmestas uћ per didelį ping'ą. [Max - 400]", name);
SendClientMessageToAll(Raudona, msg);
SendClientMessage(playerid, Raudona, "Jūs iљmestas uћ per didelį pingą");
SetTimerEx("KickPublic", 10, 0, "i", playerid);
return 0;
}
after player gets kicked it's showing not one message but 7-8 messages, sometimes just one sometimes two or three
Re: Flood, big flood -
Roperr - 24.02.2013
Please post the content of your "public KickPublic()".
Re: Flood, big flood -
ancezas - 24.02.2013
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid)
{
Kick(playerid);
}
Re: Flood, big flood -
Roperr - 24.02.2013
I'm not really sure as to why this happens, but I'm assuming it's because of you checking player's ping in OnPlayerUpdate.
I might have a fix for you:
Somewhere below the #include <a_samp> and other includes, place this line.
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerPing(playerid) > MAX_PING && once[playerid] == 0)
{
new name[MAX_PLAYER_NAME],msg[150];
GetPlayerName(playerid, name, sizeof(name));
format(msg, sizeof(msg), "[Kick] Ћaidėjas %s buvo iљmestas uћ per didelį ping'ą. [Max - 400]", name);
SendClientMessageToAll(Raudona, msg);
SendClientMessage(playerid, Raudona, "Jūs iљmestas uћ per didelį pingą");
SetTimerEx("KickPublic", 10, 0, "i", playerid);
once[playerid]=1;
return 0;
}
Inside the timer.
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid)
{
once[playerid]=0;
Kick(playerid);
}
Re: Flood, big flood -
ancezas - 24.02.2013
Quote:
Originally Posted by Roperr
I'm not really sure as to why this happens, but I'm assuming it's because of you checking player's ping in OnPlayerUpdate.
I might have a fix for you:
Somewhere below the #include <a_samp> and other includes, place this line.
pawn Код:
public OnPlayerUpdate(playerid) { if(GetPlayerPing(playerid) > MAX_PING && once[playerid] == 0) { new name[MAX_PLAYER_NAME],msg[150]; GetPlayerName(playerid, name, sizeof(name)); format(msg, sizeof(msg), "[Kick] Ћaidėjas %s buvo iљmestas uћ per didelį ping'ą. [Max - 400]", name); SendClientMessageToAll(Raudona, msg); SendClientMessage(playerid, Raudona, "Jūs iљmestas uћ per didelį pingą"); SetTimerEx("KickPublic", 10, 0, "i", playerid); once[playerid]=1; return 0; }
Inside the timer.
pawn Код:
forward KickPublic(playerid); public KickPublic(playerid) { once[playerid]=0; Kick(playerid);
}
|
i'm gona try it, looks like it gona work
Re: Flood, big flood -
Roperr - 24.02.2013
To check it easily, create a command that manipulates the function for checking a player's ping & set it above the limit.
Re: Flood, big flood -
[NoV]LaZ - 24.02.2013
Why do you use OnPlayerUpdate in the first place? Use a 5 second timer and make it so that after 3 or more failed MAX_PING checks the player gets kicked.