Hallo Leute,
Ich habe mich heute mal dran gesetzt ein Turf system zu erstellen...
Klappt auch alles so wie es soll aber jetzt das Problem Der check ob das Gebiet angegriffen wird, wird über einen Timer aufgerufen der alle 18 Sekunden oder was das war einen nervtötenden Lagg verursacht... Wie kann ich im dazugehörigem Callback den Lagg veringern sodass der Server nicht soviel auf einmal checken muss...
public ZoneTimer(playerid)
{
for(new i=0; i < sizeof(ZoneInfo); i++)
{
if(ZoneAttacker[i] != -1)
{
if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR)
{
ZoneAttackTime[i]++;
if(ZoneAttackTime[i] == TAKEOVER_TIME)
{
GameTextForAll("Gebiete wurden Ubernommen, guck auf deine Map!", 5000, 3 );
GangZoneStopFlashForAll(ZoneID[i]);
ZoneInfo[i][zTeam] = ZoneAttacker[i];
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
ZoneAttacker[i] = -1;
}
}
else
for(new m=0; m<MAX_PLAYERS; m++)
{
RemovePlayerMapIcon(mP[m], 12);
GameTextForAll("Eine Gang sicherte ein Gebiet", 5000, 3 );
GangZoneStopFlashForAll(ZoneID[i]);
ZoneAttacker[i] = -1;
}
}
else
{
for(new t=0; t < sizeof(Teams); t++)
for(new m=0; m<MAX_PLAYERS; m++)
{
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR)
{
ZoneAttacker[i] = Teams[t];
ZoneAttackTime[i] = 0;
GangZoneFlashForAll(ZoneID[i], 0xFF000055);
GameTextForAll("Gebiete sind unter ATTACKE", 5000, 3 );
}
}
}
}
}
public ZoneTimerA()
{
for(new m=0; m<MAX_PLAYERS; m++)
for(new i=0; i < sizeof(ZoneInfo); i++)
{
if(ZoneAttacker[i] != -1)
{
if(GetPlayersInZone(i, ZoneAttacker[i]) >= 1)
{
ZoneAttackTime[i]++;
if(ZoneAttackTime[i] == TAKEOVER_TIMEA)
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneInfo[i][zTeam] = ZoneAttacker[i];
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
ZoneAttacker[i] = -1;
}
}
else
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneAttacker[i] = -1;
}
}
}
}
Dazu kommen dann die SetTimerEx die bei onplayerconnect aufgerufen werden:
SetTimerEx("ZoneTimer", 16000,1,"i",playerid);
SetTimerEx("ZoneTimerA", 8000,1,"i",playerid);
Ich bitte um Schnelle Hilfe denn dieser Lagg nervt wirklich sehr
Danke im voraus
P.S Ich scripte seit 2 Wochen und hab damit erst heute angefangen