How do I make an order you can do it every 10 minutes
#1

Hello,

I wan to know how do I make an order you can do it every 10 minutes even if He comes and goes.

sorry on my bad english.
Reply
#2

You can set a variable with getTickCount (which stores the current time) or you can set a timer of 10 minutes and then reset your variable.
Reply
#3

Can you give me exmaple? I want use dini for that's
Reply
#4

"Comes and goes" is entering and leaving the server?

then you can do something like this:
pawn Код:
OnConnect() {
 noOrder[playerid] = dini_Int("noOrder");
 if(noOrder[playerid] != 0) {
  timer = SetTimerEx("wait", noOrder[playerid] * 10000, "i", playerid); // mins * 10000 (because timer is in millisecs)
  print("You still had time left");
 }
}
OnCommand() {
CMD:order() {
 // I order now:
noOrder[playerid]=10;
timer = SetTimerEx("wait", 60000, 1, "i", playerid);
print("Wait 10 mins now");
}
}
forward wait(playerid);
public wait(playerid) {
if(noOrder != 0){
  noOrder -= 1; // every minute subtract 1 min
 } else {
  DestroyTimer(timer);
 }
}

OnDisconnect() {
 // use dini to save the variable
 dini_setInt("noOrder", noOrder[playerid]);
 if(timer) {
  DestroyTimer(timer);
 }
 // and your other saving stuff
}
Something like that xD It is far from complete and it doesnt look like anything even worthy of using, but I hope you catch the hint XD
Names from callbacks are shortened and the command is just where you order. Can be anything but you have to implement something like that.
Reply
#5

thank you very much!
(sorry on my bad english)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)