17.10.2016, 07:18
Quote:
From where can I take the incldue
#include <a_timers> // Here the name of the include.? I put this Code:
stock Timer:operator = (t) return Timer:t; stock StartTimer(&Timer:timer, const TimerTime) { timer = ((gettime())+(TimerTime)); return 1; } stock ObtainTimer(Timer:timer) { new CurrentTime = gettime(); return (_:timer-CurrentTime <= 0) ? (0) : (_:timer-CurrentTime); } stock bool:TimerHasHappened(Timer:timer) { return (ObtainTimer(_:timer) <= 0) ? (true) : (false); } And i have error tag mishmatch at this StartTimer(reported[playerid], 60000); |
You should write tag before your var name:
pawn Code:
new Timer:reported[MAX_PLAYERS];
pawn Code:
#define StartTimer(%1,%2) %1 = gettime() + %2
#define GetTimerLeft(%1) ((%1 - gettime() <= 0) ? (0) : (_:%1 - gettime()))
pawn Code:
#include <a_samp>
#include <ZCMD>
static MoneyTimer[MAX_PLAYERS];
#define StartTimer(%1,%2) %1 = gettime() + %2
#define GetTimerRemaining(%1) ((%1 - gettime() <= 0) ? (0) : (%1 - gettime()))
CMD:money(playerid)
{
if(GetTimerRemaining(MoneyTimer[playerid]) != 0) return SendClientMessage(playerid, -1, "* You can't use this command now.");
GivePlayerMoney(playerid, 5000);
StartTimer(MoneyTimer[playerid], 5 * 60); // 5s * 60s = 5m
return 1;
}
This old thread make me cry