10.04.2013, 16:14
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:
You would then add an if-statement to check the boolean:
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.
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;
}
pawn Код:
if( g_bRob )
return SendClientMessage( playerid, 0xFF0000AA, "[ERROR] This shop has recently been robbed. You can't rob this shop yet." );