0 Members and 1 Guest are viewing this topic.
const Color = $00EE76; AllowedDistFromSpawn = 200; MaxSpawnID = 254;var IDsToCheck: Array of Byte; Size: integer; function NearestSpawn(ID: Byte; var Distance: Single): Byte;vartimer: integer;pTeam: Byte;NearestDist, CurrentDist: Single;pX, pY, sX, sY: Single;begin NearestDist := 999999; Result := 0; pTeam := GetPlayerStat(ID, 'Team'); for timer := 1 to MaxSpawnID do begin if (GetSpawnStat(timer, 'Active') = true) and (GetSpawnStat(timer, 'Style') = pTeam) then begin GetPlayerXY(ID, pX, pY); sX := GetSpawnStat(timer, 'X'); sY := GetSpawnStat(timer, 'Y'); sX := sX - pX; sY := sY - pY; CurrentDist := sX * sX + sY * sY; CurrentDist := Iif(CurrentDist < 0, CurrentDist * (-1), CurrentDist); //WriteConsole(0, 'SpawnID: ' + IntToStr(timer) + ' cDist: ' + IntToStr(Round(CurrentDist)), Color); if CurrentDist < NearestDist then begin NearestDist := CurrentDist; Result := timer; end; end; end; Distance := NearestDist;end;procedure ActivateServer();begin Size := 0;end;procedure OnPlayerRespawn(ID: byte);begin Size := Size + 1; SetArrayLength(IDsToCheck, Size); IDsToCheck[Size - 1] := ID;end;procedure AppOnIdle(Ticks: integer);vartimer: integer;Dist: Single;begin if Ticks mod 60 = 0 then begin for timer := 0 to Size - 1 do begin if GetPlayerStat(IDsToCheck[timer], 'Alive') = true then begin NearestSpawn(IDsToCheck[timer], Dist); WriteConsole(0, IntToStr(Round(Dist)) + ' ' + IntToStr(AllowedDistFromSpawn*AllowedDistFromSpawn), Color); if Round(Dist) > AllowedDistFromSpawn*AllowedDistFromSpawn then begin DoDamage(IDsToCheck[timer],4000); WriteConsole(IDsToCheck[timer], 'Possible spawnbug, player killed.',Color); WriteLn('Possible spawnbug detected, player '+IDToName(IDsToCheck[timer])+' killed.'); end; IDsToCheck[timer] := 0; end; end; Size := 0; SetArrayLength(IDsToCheck, Size); end;end;
13-06-02 16:16:51 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:52 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:53 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:54 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:55 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:56 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:57 [ale urwal] !stats13-06-02 16:16:57 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:58 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:59 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:16:59 [ale urwal] !top13-06-02 16:17:00 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:01 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:02 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:03 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:04 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:05 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:06 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:06 Possible spawnbug detected, player |*~RP~*| Szczepan killed.13-06-02 16:17:07 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:07 Possible spawnbug detected, player |*~RP~*| Szczepan killed.13-06-02 16:17:08 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:08 Possible spawnbug detected, player |*~RP~*| Szczepan killed.13-06-02 16:17:09 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:09 Possible spawnbug detected, player |*~RP~*| Szczepan killed.13-06-02 16:17:10 Possible spawnbug detected, player *Saint| Emrys killed.13-06-02 16:17:10 Possible spawnbug detected, player |*~RP~*| Szczepan killed.13-06-02 16:17:11 Possible spawnbug detected, player *Saint| Emrys killed.