[UNSOLVED]Command Delay Problem
#1

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;
        }


     }
Reply
#2

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

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)