SA-MP Forums Archive
StopWatch - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: StopWatch (/showthread.php?tid=159289)



StopWatch - rapido300 - 12.07.2010

Hi, To all I seek to create voila a timer to clock the Delta MD-match but I think nothing could you help me thank you, It's kind / brand then go 0.00 and one second by one second and / Stop

Thank you


Re: StopWatch - Grim_ - 12.07.2010

I do not understand what you are asking, please try to be a little more clear.


Re: StopWatch - rapido300 - 12.07.2010

I look for a chronomйtre for races(shopping) of cars


Re: StopWatch - Venturas - 12.07.2010

SetTimerEx?


Re: StopWatch - MikkelGutten - 12.07.2010

I think he means a stopwatch.

You do /start and it's start going 0.01 - 0.02 ...
And when you do /stop it shows the amount of seconds it took.


Re: StopWatch - DJDhan - 12.07.2010

At the top of the script:
Код:
new sec,min,sttimer;
Under OnPlayerCommandText(playerid,cmdtext[])
Starting the count:
Код:
if(!strcmp(cmdtext,"/start",true))
{
	sec = 0;
	min = 0;
	sttimer = SetTimer("stopwatch",1000,1);
	return 1;
}
Stopping code:
Код:
if(!strcmp(cmdtext,"/stop",true))
{
	KillTimer(sttimer);
	new string[256];
	format(string,256,"Time elapsed : %d minutes and %d seconds",min,sec);
	SendClientMessage(playerid,0xffff00aa,string);
	return 1;
}
Anywhere in the script, but outside a callback:
Код:
forward stopwatch();

public stopwatch()
{
	sec++;
	if(sec>59)
	{
		sec = 0;
		min++;
	}
	return 1;
}
It's pretty basic.

I made it quick, so if there is any error, kindly let me know.


Re: StopWatch - RyDeR` - 12.07.2010

Using GetTickCount(); will give you exact values.


Re: StopWatch - rapido300 - 12.07.2010

HO yes Thank You all