20.11.2015, 15:05
I'm actually having problem with timer. This Timer given below is not showing player count down textdraws nor it is playing sound. Only SpawnTDMPlayers(); function is working.
One more thing that I would like to add is that IsPlayerInEvent(i); function is working, As I'm using it in other places also.
Things that are not working are-
I'm using Variable instead of KillTimer, as sometimes it doesn't work
One more thing that I would like to add is that IsPlayerInEvent(i); function is working, As I'm using it in other places also.
Things that are not working are-
Код:
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInEvent(i))
{
TogglePlayerControllable(i, false);
new str[129];
format(str,129,"%d seconds",countd);
PlayerTextDrawShow(i,Count_TXD[i][0]);
PlayerTextDrawShow(i,Count_TXD[i][1]);
PlayerTextDrawShow(i,Count_TXD[i][2]);
PlayerTextDrawShow(i,Count_TXD[i][3]);
PlayerTextDrawSetString(i, Count_TXD[i][1],str);
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
PlayerPlaySound(i,1054, x,y,z);
}
}
Код:
forward countdown();
public countdown()
{
countd--;
if(event_type==TDM)
{
if(countd==0)
{
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInEvent(i))
{
PlayerTextDrawHide(i,Count_TXD[i][0]);
PlayerTextDrawHide(i,Count_TXD[i][1]);
PlayerTextDrawHide(i,Count_TXD[i][2]);
PlayerTextDrawHide(i,Count_TXD[i][3]);
TogglePlayerControllable(i, true);
PlayerTextDrawShow(i,TDM_TXD[i][0]);
PlayerTextDrawShow(i,TDM_TXD[i][1]);
PlayerTextDrawShow(i,TDM_TXD[i][2]);
PlayerTextDrawShow(i,TDM_TXD[i][3]);
PlayerTextDrawShow(i,TDM_TXD[i][4]);
}
}
countd=15;
cd_timer=0;
}
else if(countd<6)
{
if(countd==5)
{
SpawnTDMPlayers();
}
cd_timer=1;
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInEvent(i))
{
TogglePlayerControllable(i, false);
new str[129];
format(str,129,"%d seconds",countd);
PlayerTextDrawShow(i,Count_TXD[i][0]);
PlayerTextDrawShow(i,Count_TXD[i][1]);
PlayerTextDrawShow(i,Count_TXD[i][2]);
PlayerTextDrawShow(i,Count_TXD[i][3]);
PlayerTextDrawSetString(i, Count_TXD[i][1],str);
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
PlayerPlaySound(i,1054, x,y,z);
}
}
}
}
if(cd_timer=1)
{
SetTimer("countdown",1000,0);
}
}

