Author Topic: Some bug of my server !  (Read 753 times)

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Some bug of my server !
« on: April 11, 2010, 06:08:05 pm »
So ive found 2 bug in my server and i dont know how to fix it
When all player got infected i call a command /nextmap but i think that this command is repeathing , as you can see ... :(

Code: [Select]
►        Next map: htf_Nuclear
►        Zombie has been kicked.
►        Next map: htf_Void
►        Kamikaze has been kicked.
►        Next map: htf_Zajacz
►        Knifer zombie has been kicked.
►        Next map: Bridge
Ive attached the script that i use !

There is the most strange bug that i have seen...
At the end of the game (When all player got infected) all player got moved to alpha team and some of the player apear as blue but they are red how can i fix that (this is with the same script has the other script)

This is the script

Code: [Select]
const
 ZOMBIE_TEAM = 2;


type
  sPlayer = Record
  IsZombie : boolean;
end;

var
  Player: array[1..32] of sPlayer;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
 if((GetPlayerStat(Killer, 'Team') = ZOMBIE_TEAM) and (GetPlayerStat(Victim, 'Team') <> ZOMBIE_TEAM)) then begin
  Player[Victim].IsZombie := true;
  Command('/setteam' + IntToStr(ZOMBIE_TEAM) + ' ' + IntToStr(Victim));
  WriteConsole(0, 'Player ' + IdToName(Victim) + ' has been killed by an zombie and is now infected.', $FFFF0000);
  if(AlphaPlayers = 0)then Command('/nextmap');
 end;
end;

procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
begin
 if(GetPlayerStat(ID, 'Team') = ZOMBIE_TEAM) then ForceWeapon(ID, 15, 255, 0);
end;

procedure OnJoinGame(ID, Team: byte);
begin
 Player[ID].IsZombie := false;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
 if (Team = ZOMBIE_TEAM) and (Player[ID].IsZombie = false) then Command('/setteam1 ' + IntToStr(ID));
 if (Team = 1) and (Player[ID].IsZombie = true) then Command('/setteam2 ' + IntToStr(ID));
 if (Team <> 1) and (Team <> 2) then Command('/setteam1 ' + IntToStr(ID));
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
 Player[ID].IsZombie := false;
  if(AlphaPlayers = 0)then Command('/nextmap');
end;

procedure OnMapChange(NewMap: string);
var
i:integer;
begin
 for i := 1 to 32 do begin
  if GetPlayerStat(i, 'Human') = true then begin
    Player[i].IsZombie := false;
    Command('/setteam1 ' + IntToStr(i));
  end;
 end;
 Command('/kick Zombie');
Command('/kick Kamikaze');
Command('/kick Knifer zombie');
end;


Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Some bug of my server !
« Reply #1 on: April 12, 2010, 01:28:45 am »
No bug. Just a flaw in the way you're thinking about the problem. You see, whenever someone leaves or is kicked, you're checking to see if Alpha Team has no-one on it, and if so, you use /nextmap. You also kick all bots whenever the next map loads, too.

So, if someone leaves or if the round simply ends and Alpha is empty, then all the bots get kicked, and for each bot that is kicked, OnLeaveGame is called. The output you're therefore seeing is not surprising at all.

TL;DR: You're doing it wrong.
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Some bug of my server !
« Reply #2 on: April 14, 2010, 03:22:32 am »
about the colour bug: move the players to spec first and then to the needed team with an inverval of a second or two

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 558
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
Re: Some bug of my server !
« Reply #3 on: April 14, 2010, 04:38:49 am »
Ok thanks