SA-MP Forums Archive
[UNSOLVED]Command Delay 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [UNSOLVED]Command Delay Problem (/showthread.php?tid=131768)



[UNSOLVED]Command Delay Problem - Hijolion - 04.03.2010

Everything works fine. But I get no errors; the command does not delay I can't figure out the problem.

pawn Код:
if (!strcmp(cmdtext,"/airstrike",true))
  {
    new player_delay = gettime() - Delay[playerid];
    if (player_delay < command_delay)
    {
            new String[128];
      format(String, sizeof(String), "You need to wait %d seconds!", command_delay - player_delay);
      SendClientMessage(playerid,COLOR_RED,String);
    }

    if(GetPlayerScore(playerid) >=250)
      {
      GivePlayerMoney(playerid,-950);
        SendClientMessage(playerid, COLOR_RED, "You payed $1000 money for the airstrike!");
          new Float:X,Float:Y,Float:Z;
          GetPlayerPos(playerid, X,Y,Z);
      CreateExplosion(X, Y, Z, 6, 20.0);
      CreateExplosion(X+10, Y, Z, 6, 20.0);
      CreateExplosion(X+20, Y, Z, 11, 20.0);
      CreateExplosion(X+40, Y, Z, 11, 20.0);
      CreateExplosion(X, Y+10, Z, 6, 20.0);
      CreateExplosion(X, Y+20, Z, 11, 20.0);
      CreateExplosion(X, Y+40, Z, 11, 20.0);
            return 1;
        }


     }



Re: [UNSOLVED]Command Delay Problem - Michael_Sund - 04.03.2010

Use
Код:
"[ code][ /code]"
When you're insterting code, it's much easier to read then.


Re: [UNSOLVED]Command Delay Problem - kaisersouse - 04.03.2010

at the very least, you need to "return 1;" after the "you haveto wait" message.

Add some debug code that displays the values of player_delay and command_delay. I suspect that you might want to switch your < to > or something.


Re: [UNSOLVED]Command Delay Problem - Hijolion - 04.03.2010

Quote:
Originally Posted by kaisersouse
at the very least, you need to "return 1;" after the "you haveto wait" message.

Add some debug code that displays the values of player_delay and command_delay. I suspect that you might want to switch your < to > or something.
Thanks for the info.