How can I do time limit here ?
#2

Declare a global boolean.
At the end of your command, set the boolean to true and run a timer.
Inside the timer callback, reset the boolean variable's value to false.

Example:

pawn Код:
//globally
new
    bool:g_bRob
;

//command
g_bRob = true;
SetTimer( "RobShopResetTimer", YOUR_INTERVAL_HERE_IN_MS, false );

//bottom
forward RobShopResetTimer()
public RobShopResetTimer()
{
    if( g_bRob ) //in case you have a manual method for resetting
        g_bRob = false;
    return true;
}
You would then add an if-statement to check the boolean:

pawn Код:
if( g_bRob )
    return SendClientMessage( playerid, 0xFF0000AA, "[ERROR] This shop has recently been robbed. You can't rob this shop yet." );
Currently this is only working with one shop. To get it to work with more than one, use a boolean-array instead, and use a unique ID for each shop as the index.
Reply


Messages In This Thread
How can I do time limit here ? - by yaron0600 - 10.04.2013, 15:43
Re: How can I do time limit here ? - by LarzI - 10.04.2013, 16:14
Re: How can I do time limit here ? - by yaron0600 - 10.04.2013, 16:49
Re: How can I do time limit here ? - by FalconX - 10.04.2013, 16:50
Re: How can I do time limit here ? - by LarzI - 10.04.2013, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)