Hey Leute,
ich habe ein Problem mit einem Timer.
Undzwar wird die Variable "Zeit" irgendwie ganz komisch abgezogen bzw. geändert.
Habt ihr eine Idee wieso?
Hier der Timer (Code):
forward UpdateZones();
public UpdateZones()
{
for(new player; player < MAX_PLAYERS; player++)
{
for(new i; i<sizeof(Zonen); i++)
{
GangZoneHideForPlayer(player,Zone[i]);
new color;
if(Zonen[i][gOwner] == 0){color=0xFEFEFEA8;}
if(Zonen[i][gOwner] == 10){color=0x007600A8;}
if(Zonen[i][gOwner] == 11){color=0x8C00FFA8;}
if(Zonen[i][gOwner] == 12){color=0x6E6E6EA8;}
if(Zonen[i][gOwner] == 13){color=0x000000A8;}
GangZoneShowForPlayer(player, Zone[i], color);
if(Zonen[i][gOn] == 1)
{
if(Zonen[i][gAngreifer] == 0){color=0xFEFEFEA8;}
if(Zonen[i][gAngreifer] == 10){color=0x007600A8;}
if(Zonen[i][gAngreifer] == 11){color=0x8C00FFA8;}
if(Zonen[i][gAngreifer] == 12){color=0x6E6E6EA8;}
if(Zonen[i][gAngreifer] == 13){color=0x000000A8;}
GangZoneFlashForPlayer(player,Zone[i],color);
}
if(Zonen[i][gCoolDown] > 0)
{
Zonen[i][gCoolDown] --;
}
if(Zonen[i][capture_cd] > 0)
{
Zonen[i][capture_cd] --;
}
if(Zonen[i][gZeit] > 0)
{
Zonen[i][gZeit] --;
new minutes;
new seconds;
new ktimestr[32];
new kstr[16];
if(Zonen[i][gZeit] > 59)
{
minutes = floatround(Zonen[i][gZeit]/60);
seconds = floatround(Zonen[i][gZeit] - minutes*60);
if(seconds>9)format(kstr,sizeof(kstr),"%d:%d",minutes,seconds);
else format(kstr,sizeof(kstr),"%d:0%d",minutes,seconds);
}
else
{
seconds = floatround(Zonen[i][gZeit]);
if(seconds>9)format(kstr,sizeof(kstr),"0:%d",seconds);
else format(kstr,sizeof(kstr),"0:0%d",seconds);
}
format(ktimestr, sizeof ktimestr, "%s",kstr);
TextDrawSetString(GWZeit[player],ktimestr);
}
if(Zonen[i][gZeit] == 0)
{
Zonen[i][gOn] = 0;
if(Zonen[i][gStand2] > Zonen[i][gStand1])
{
Zonen[i][gOwner] = Zonen[i][gAngreifer];
}
new fname[20];
switch(Zonen[i][gOwner])
{
case 10:{fname = "Grove Street";}
case 11:{fname = "Ballas";}
case 12:{fname = "Al Quaida";}
case 13:{fname = "La Cosa Nostra";}
}
new string[128];
format(string,sizeof(string),"[GANGFIGHT Der Gewinner des Gangwars ist: %s, die mit %d : %d gewonnen haben.",fname,Zonen[i][gStand1],Zonen[i][gStand2]);
SCMTA(COLOR_YELLOW,string);
Zonen[i][gStand2] = 0;
Zonen[i][gStand1] = 0;
Zonen[i][gZeit] = -1;
Zonen[i][gAngreifer]=0;
Zonen[i][gCoolDown] = 4200;
TextDrawHideForPlayer(player,GWBox[player]);
TextDrawHideForPlayer(player,GWText[player]);
TextDrawHideForPlayer(player,GWAngreifer[player]);
TextDrawHideForPlayer(player,GWVerteidiger[player]);
TextDrawHideForPlayer(player,GWAngrPunkte[player]);
TextDrawHideForPlayer(player,GWVertPunkte[player]);
TextDrawHideForPlayer(player,GWZeit[player]);
TextDrawHideForPlayer(player,GWZeitText[player]);
GangwarAktiv --;
}
}
}
return 1;
}