SA-MP Forums Archive
How can I do it? - 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: How can I do it? (/showthread.php?tid=454732)



How can I do it? - GuyYahood1 - 30.07.2013

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.


Re: How can I do it? - Jstylezzz - 30.07.2013

You can do it with a timer and a global variable, something like this:
pawn Код:
new CanDoOrder[MAX_PLAYERS]; //On top of your script
public OrderCompletedCallback(playerid) // Think of this of the callback or code where the order is completed
{
    CanDoOrder[playerid] = 0;
    SetTimerEx("CanDoOrderAgain",600000,0,"i",playerid);
}
public CanDoOrderAgain(playerid) //This is the callback which will enable the orders again
{
    CanDoOrder[playerid] = 1;
}
Then just check before the player attempts to do the order if the CanDoOrder variable is 1, if it isn't, send a message to the player that he has to wait.
If you're using the idea from above, be sure to add CanDoOrder[playerid] = 1; under OnPlayerConnect.
Also, please note that timers are slightly out of sync, to fix this, czech the fixes2 plugin.


Re: How can I do it? - GuyYahood1 - 30.07.2013

Quote:
Originally Posted by Jstylezzz
Посмотреть сообщение
You can do it with a timer and a global variable, something like this:
pawn Код:
new CanDoOrder[MAX_PLAYERS]; //On top of your script
public OrderCompletedCallback(playerid) // Think of this of the callback or code where the order is completed
{
    CanDoOrder[playerid] = 0;
    SetTimerEx("CanDoOrderAgain",600000,0,"i",playerid);
}
public CanDoOrderAgain(playerid) //This is the callback which will enable the orders again
{
    CanDoOrder[playerid] = 1;
}
Then just check before the player attempts to do the order if the CanDoOrder variable is 1, if it isn't, send a message to the player that he has to wait.
If you're using the idea from above, be sure to add CanDoOrder[playerid] = 1; under OnPlayerConnect.
Also, please note that timers are slightly out of sync, to fix this, czech the fixes2 plugin.
Thanks, but look what I had write, I wanna this turn on when he comes and goes (dini,DOF2....)


Re: How can I do it? - Jstylezzz - 30.07.2013

Comes and goes like, how? Going offline and online?


Re: How can I do it? - GuyYahood1 - 30.07.2013

Yes, sorry on my bad English..


Re: How can I do it? - GuyYahood1 - 24.08.2013

Please help?