if statement problem
#1

so i made a point war to capture it i put
in top
Код:
new StartWar=2*60;
new PointCount=0;
Код:
CMD:cap(playerid, params[])
{
capture[playerid]=1;
}
and a time count
Код:
SetTimer("cap1",1000,1);
Код:
public cap1()
{ 
	if (StartWar==0){
	PointCount=30;
	SendClientMessageToAll(-1,"Point Is Ready To cap");
	}
    foreach(new i: Player)
    {
		if(PointCount ==1 && capture[i]==1)
		{
		SendClientMessageToAll(-1,"PlayerA Has Captured The point");
		}
		else
		{
		SendClientMessageToAll(-1,"No ONe Could Capture Point");
		}
    }
}
so my problem is when i run this code it spaming
No ONe Could Capture Point
Reply
#2

Probably because you did not stop the timer under the "no one could capture" send client message.

Search ****** for killtimer.

I hope I helped you!

Edit: ****** "continue" statement aswell
Reply
#3

pawn Код:
CMD:cap(playerid)
{
    capture[playerid] = true;
    SetTimerEx("cap1", 1000, false, "i", playerid);
    return true;
}

forward public cap1();
public cap1()
{
    if (StartWar == 0)
    {
        PointCount= 30;
        SendClientMessageToAll(-1, "Point Is Ready To cap");
    }
   
    foreach(new i: Player)
    {
        if(PointCount ==1 && capture[i]==1)
        {
            SendClientMessageToAll(-1, "PlayerA Has Captured The point");
        }
        else
        {
            SendClientMessageToAll(-1, "No ONe Could Capture Point");
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)