PDA

View Full Version : Problem with system


ZoneKiller
01/10/2016, 01:50 PM
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 (c) 1997-2006, ITB CompuPhase


4 Errors.

i have already defined the #include <foreach> lel

Pls help !

Thx!!!

Yaa
01/10/2016, 01:51 PM
u need to include foreach or YSI

ZoneKiller
01/10/2016, 01:52 PM
how ?

pls tell me :)

Yaa
01/10/2016, 01:55 PM
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;
}

Yaa
01/10/2016, 01:57 PM
if no replace just include

just download this https://github.com/Misiur/YSI-Includes/archive/YSI.tl.zip

and add this in u script #include <YSI/y_iterate>

ZoneKiller
01/10/2016, 02:14 PM
any other ideas?

ActionTanki91
01/10/2016, 02:29 PM
Use include y_iterate, or update your foreach.

#include <YSI\y_iterate> // This is a foreach

ZoneKiller
01/10/2016, 05:57 PM
thx ! +REP