[Tutorial] To optimize our GM and our Server improves.
#35

Quote:
Originally Posted by Mister0
View Post
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);
Sorry for late reply.

You should write tag before your var name:

pawn Code:
new Timer:reported[MAX_PLAYERS];
Also, here is a best version:

pawn Code:
#define StartTimer(%1,%2) %1 = gettime() + %2
#define GetTimerLeft(%1) ((%1 - gettime() <= 0) ? (0) : (_:%1 - gettime()))
This version doesn't need tag:

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
Reply


Messages In This Thread
To optimize our GM and our Server improves. - by Swedky - 23.12.2013, 05:37
Re: To optimize our GM and our Server improves. - by nGen.SoNNy - 23.12.2013, 06:14
Re: To optimize our GM and our Server improves. - by Emmet_ - 23.12.2013, 06:54
Re: To optimize our GM and our Server improves. - by Ada32 - 23.12.2013, 07:02
Re: To optimize our GM and our Server improves. - by Bakr - 23.12.2013, 07:16
Respuesta: Re: To optimize our GM and our Server improves. - by Swedky - 23.12.2013, 10:29
Re: To optimize our GM and our Server improves. - by Konstantinos - 23.12.2013, 11:07
Respuesta: Re: To optimize our GM and our Server improves. - by Swedky - 23.12.2013, 11:38
Re: To optimize our GM and our Server improves. - by xVIP3Rx - 23.12.2013, 11:43
Re: To optimize our GM and our Server improves. - by Patrick - 23.12.2013, 11:50
Re: To optimize our GM and our Server improves. - by Konstantinos - 23.12.2013, 11:54
Re: To optimize our GM and our Server improves. - by Bakr - 23.12.2013, 12:11
Re: To optimize our GM and our Server improves. - by Ada32 - 23.12.2013, 12:14
Re: To optimize our GM and our Server improves. - by xVIP3Rx - 23.12.2013, 12:21
Re: To optimize our GM and our Server improves. - by Riddick94 - 23.12.2013, 12:25
Re: To optimize our GM and our Server improves. - by Konstantinos - 23.12.2013, 12:27
Re: To optimize our GM and our Server improves. - by Riddick94 - 23.12.2013, 12:31
Re: To optimize our GM and our Server improves. - by newbienoob - 23.12.2013, 14:14
Re: To optimize our GM and our Server improves. - by Patrick - 23.12.2013, 14:29
Re: To optimize our GM and our Server improves. - by newbienoob - 23.12.2013, 14:40
Re: To optimize our GM and our Server improves. - by xVIP3Rx - 23.12.2013, 14:42
Re: To optimize our GM and our Server improves. - by Patrick - 23.12.2013, 14:44
Re: To optimize our GM and our Server improves. - by SuperViper - 23.12.2013, 14:50
Re: To optimize our GM and our Server improves. - by xVIP3Rx - 23.12.2013, 14:56
Re: To optimize our GM and our Server improves. - by Konstantinos - 23.12.2013, 15:07
Re: To optimize our GM and our Server improves. - by Patrick - 23.12.2013, 15:12
Re: To optimize our GM and our Server improves. - by PowerPC603 - 23.12.2013, 16:03
Re: To optimize our GM and our Server improves. - by Bakr - 23.12.2013, 20:10
Re: To optimize our GM and our Server improves. - by Djole1337 - 23.12.2013, 20:32
Re: To optimize our GM and our Server improves. - by SuperViper - 23.12.2013, 22:35
Respuesta: To optimize our GM and our Server improves. - by Swedky - 24.12.2013, 18:09
Re: To optimize our GM and our Server improves. - by Patrick - 24.12.2013, 20:21
Respuesta: To optimize our GM and our Server improves. - by Swedky - 24.12.2013, 20:27
Re: To optimize our GM and our Server improves. - by Mister0 - 15.08.2016, 10:56
Respuesta: Re: To optimize our GM and our Server improves. - by Swedky - 17.10.2016, 07:18

Forum Jump:


Users browsing this thread: 8 Guest(s)