/deposit timer
#1

Hey

I would like to know how I can set a timer to a command.
Like:

/deposit 76546
*You have to wait 10 minutes before you can use this command again.

flow.
Reply
#2

Have you searched?

Try search for "command delay" -> http://forum.sa-mp.com/index.php?top...7028#msg417028
Reply
#3

Thank you 0rb, can you tell me where I have to put this in?
Iґve tried to put it somewhere in the script and it gives me some errors.

Код:
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(59) : error 017: undefined symbol "dini_Exists"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(69) : error 017: undefined symbol "dini_Int"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(87) : error 017: undefined symbol "dini_Exists"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(92) : error 017: undefined symbol "dini_Create"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(93) : error 017: undefined symbol "dini_IntSet"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(94) : error 017: undefined symbol "dini_IntSet"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(112) : error 017: undefined symbol "dini_Exists"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(123) : error 017: undefined symbol "dini_Int"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(140) : error 029: invalid expression, assumed zero
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(140) : error 029: invalid expression, assumed zero
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(148) : error 017: undefined symbol "String"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(148) : error 017: undefined symbol "String"
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(148) : error 029: invalid expression, assumed zero
C:\DOKUME~1\Kriss\Desktop\delay\bank.pwn(148) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


14 Errors.
Reply
#4

This at the top of your script:
pawn Код:
new Delay[MAX_PLAYERS];
new String[128];
And this under your OnPlayerCommandText callback:
pawn Код:
if (!strcmp(cmdtext,"/command"))
{
  new player_delay = gettime() - Delay[playerid];

  if (player_delay < 600) //600 = 10 minutes
  {
    format(String, sizeof(String), "You need to wait %d seconds!", command_delay - player_delay);
    SendClientMessage(playerid, 0xFF0000FF, String);
  }
  else
  {
    SendClientMessage(playerid, 0x00FF00FF, "Ok!");
    Delay[playerid] = gettime();
  }
  return true;
}
Other than that, errors can't be related to this part of code.
Reply
#5

Allright, it works now, thank you 0rb!

Thereґs only one thing left, they can use the /deposit commands now only every 10 minutes, but if they type /deposit <amount of money> thereґs no limit, they can use the commands as much as they wont. I want that the player canґt /deposit <amount> any money for 10 minutes after he has used the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)