15.12.2015, 13:05
Simply code this whole batch of code into a separate samp timer, if you don't know how to use regular timers then read it on samp wiki, it's easy.
pawn Код:
SetTimer("SecondTimer", 1000, true);
forward SecondTimer();
public SecondTimer()
{
for(new i = 0; i < MAX_ARENAS; i++)
{
if(PaintBallArena[i][pbActive] == 1)
{
if(PaintBallArena[i][pbGameType] == 3)
{
if(PaintBallArena[i][pbFlagRedActive] == 1)
{
if(PaintBallArena[i][pbFlagRedActiveTime] <= 0)
{
ResetFlagPaintballArena(i,1);
PaintBallArena[i][pbFlagRedActiveTime] = 0;
}
PaintBallArena[i][pbFlagRedActiveTime]--;
}
if(PaintBallArena[i][pbFlagBlueActive] == 1)
{
if(PaintBallArena[i][pbFlagBlueActiveTime] <= 0)
{
ResetFlagPaintballArena(i,2);
PaintBallArena[i][pbFlagBlueActiveTime] = 0;
}
PaintBallArena[i][pbFlagBlueActiveTime]--;
}
}
// Inactive Players Check
if(PaintBallArena[i][pbPlayers] > 1)
{
PaintBallArena[i][pbTimeLeft]--;
}
if(PaintBallArena[i][pbTimeLeft] == 300-1)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "Five minutes left in this round!");
//SendPaintballArenaSound(i, 1057);
////SendPaintballArenaAudio(i, 5, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 180)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "Three minutes left in this round!");
//SendPaintballArenaSound(i, 1057);
////SendPaintballArenaAudio(i, 4, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 120)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "Two minutes left in this round!");
//SendPaintballArenaSound(i, 1057);
//SendPaintballArenaAudio(i, 3, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 60)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "One minute left in this round!");
//SendPaintballArenaSound(i, 1057);
//SendPaintballArenaAudio(i, 2, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 30)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "30 seconds left in this round!");
//SendPaintballArenaSound(i, 1057);
//SendPaintballArenaAudio(i, 6, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 12)
{
SendPaintballArenaMessage(i, COLOR_RED, "Sudden death, 5 seconds left!");
//SendPaintballArenaSound(i, 1057);
//SendPaintballArenaAudio(i, 37, 100);
}
if(PaintBallArena[i][pbTimeLeft] == 7)
{
SendPaintballArenaMessage(i, COLOR_YELLOW, "Round Over!");
//SendPaintballArenaSound(i, 1057);
//SendPaintballArenaAudio(i, 20, 100);
}
if(PaintBallArena[i][pbTimeLeft] >= 1 && PaintBallArena[i][pbTimeLeft] <= 7)
{
foreach(Player, p)
{
new arenaid = GetPVarInt(p, "IsInArena");
if(arenaid == i)
{
TogglePlayerControllable(p, 0);
PaintballScoreboard(p, arenaid);
}
}
//SendPaintballArenaSound(i, 1057);
}
if(PaintBallArena[i][pbTimeLeft] <= 0)
{
new
winnerid = SortWinnerPaintballScores(i),
string[60 + MAX_PLAYER_NAME];
format(string, sizeof(string), "%s has won $%d from the Paintball Match, thanks for playing!",GetPlayerNameEx(winnerid),PaintBallArena[i][pbMoneyPool]);
GivePlayerMoney(winnerid,PaintBallArena[i][pbMoneyPool]);
SendPaintballArenaMessage(i, COLOR_YELLOW, string);
foreach(Player, p)
{
new arenaid = GetPVarInt(p, "IsInArena");
if(arenaid == i)
{
PaintballScoreboard(p, arenaid);
TogglePlayerControllable(p, 1);
}
}
foreach(Player, p)
{
new arenaid = GetPVarInt(p, "IsInArena");
if(arenaid == i)
{
LeavePaintballArena(p, arenaid);
}
}
ResetPaintballArena(i);
}
}
}
return 1;
}