SetupTimeleftTimer new time if GetMapTimeLeft time time new startTime

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
SetupTimeleftTimer()
{
new time;
if (GetMapTimeLeft(time) && time > 0)
{
new startTime = GetConVarInt(g_Cvar_StartTime) * 60;
if (time - startTime < 0 && GetConVarBool(g_Cvar_EndOfMapVote) && !g_MapVoteCompleted && !g_HasVoteStarted)
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
}
else
{
if (g_VoteTimer != INVALID_HANDLE)
{
KillTimer(g_VoteTimer);
g_VoteTimer = INVALID_HANDLE;
}
//g_VoteTimer = CreateTimer(float(time - startTime), Timer_StartMapVote, _, TIMER_FLAG_NO_MAPCHANGE);
new Handle:data;
CreateTimer(float((time - startTime) - 16), Timer_StartAnnounceVote, _, TIMER_FLAG_NO_MAPCHANGE);
g_VoteTimer = CreateDataTimer(float(time - startTime), Timer_StartMapVote, data, TIMER_FLAG_NO_MAPCHANGE);
WritePackCell(data, _:MapChange_MapEnd);
WritePackCell(data, _:INVALID_HANDLE);
ResetPack(data);
}
}
}
public Action:Timer_StartAnnounceVote(Handle:timer)
{
CreateTimer(1.00, Timer_SendAnnounce, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public Action:Timer_SendAnnounce(Handle:timer)
{
static cnt = 15;
if(cnt > 0)
{
PrintHintTextToAll("Голосование начнется через: %iсек.", cnt);
cnt--;
return Plugin_Continue;
}
else
{
cnt = 15;
return Plugin_Stop;
}
}