if statement problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: if statement problem (
/showthread.php?tid=478903)
if statement problem -
omidi - 01.12.2013
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
Re: if statement problem -
Voxel - 01.12.2013
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
Re: if statement problem -
iZN - 01.12.2013
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");
    }
  }
}