Problem with system - 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: Problem with system (
/showthread.php?tid=618122)
Problem with system -
ZoneKiller - 01.10.2016
Hi.
I have a problem with my system pls check it.
Код:
public PingKick()
{
if(ServerInfo[MaxPing] != 0)
{
PingPos++;
PingPos %= PING_MAX_EXCEEDS;
foreach (new i : Player) {
if(IsPlayerConnected(i)) {
PlayerInfo[i][pPing][PingPos] = GetPlayerPing(i);
if(GetPlayerPing(i) > ServerInfo[MaxPing])
{
if(PlayerInfo[i][PingCount] == 0) PlayerInfo[i][PingTime] = TimeStamp();
PlayerInfo[i][PingCount]++;
if(TimeStamp() - PlayerInfo[i][PingTime] > PING_TIMELIMIT)
{
PlayerInfo[i][PingTime] = TimeStamp();
PlayerInfo[i][PingCount] = 1;
}
else if(PlayerInfo[i][PingCount] >= PING_MAX_EXCEEDS)
{
new Sum, Average, x, string[128];
while (x < PING_MAX_EXCEEDS) {
Sum += PlayerInfo[i][pPing][x];
x++;
}
Average = (Sum / PING_MAX_EXCEEDS);
format(string,sizeof(string),"%s has been kicked from the server. (Reason: High Ping (%d) | Average (%d) | Max Allowed (%d) )", pName(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] );
SendClientMessageToAll(COLOR_GREY,string);
SaveToFile("KickLog",string);
SetTimerEx("kickplayer", 2000, false, "i",i);
}
}
}
}
}
}
The errors are
Код:
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\samp037_svr_R2-1-1_win32\gamemodes\FDSTDMpwn(5264) : error 017: undefined symbol "foreach"
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\samp037_svr_R2-1-1_win32\gamemodes\FDSTDMpwn(5264) : error 029: invalid expression, assumed zero
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\samp037_svr_R2-1-1_win32\gamemodes\FDSTDM.pwn(5264) : error 017: undefined symbol "i"
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\samp037_svr_R2-1-1_win32\gamemodes\FDSTDM.pwn(5264) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
i have already defined the #include <foreach> lel
Pls help !
Thx!!!
Re: Problem with system -
Yaa - 01.10.2016
u need to include foreach or YSI
Re: Problem with system -
ZoneKiller - 01.10.2016
how ?
pls tell me
Re: Problem with system -
Yaa - 01.10.2016
And You can replace this with
OnPlayerUpdate Callback better than this long code
if the principal is kick after Ping +500
OnPlayerUpdate(playerid)
{
if(GetPlayerPing(playerid) == 500);
// SendClient Message bla blablabala
Kick(playerid);
return 1;
}
Re: Problem with system -
Yaa - 01.10.2016
if no replace just include
just download this
https://github.com/Misiur/YSI-Includ...ive/YSI.tl.zip
and add this in u script #include <YSI/y_iterate>
Re: Problem with system -
ZoneKiller - 01.10.2016
any other ideas?
Re: Problem with system -
ActionTanki91 - 01.10.2016
Use include y_iterate, or update your foreach.
Код:
#include <YSI\y_iterate> // This is a foreach
Re: Problem with system -
ZoneKiller - 01.10.2016
thx ! +REP