This should be helpful as you said, especially for training purposes and other RP things. One thing though, can we have the option to save the the time period of the stopwatch so we can do comparisons at the end of a training or just to see how quick a car can go around the map etc. via different routes?Anyway Upvoted as it would be useful.
Well a simple stopwatch can contain a Reset feature, start feature, stop feature and close feature. If we use setTimer function, its minimum value is 50ms so it is possible in efficient way but if we use onClientPreRender, we can have it in better way like, we can count even 1ms.I made this:Code: Lualocal sw, sh = guiGetScreenSize()main_wnd = guiCreateWindow((sw/5 - 539/5), (sh/5 - 285/5), 214, 220, "CIT - Stopwatch", false) guiWindowSetSizable(main_wnd, false) guiSetAlpha(main_wnd, 0.92)watch_lbl = guiCreateLabel(9, 24, 195, 53, "Seconds: \nMinute(s): \nHour(s): \nMilliseconds: ", false, main_wnd) guiSetFont(watch_lbl, "default-bold-small")start_btn = guiCreateButton(9, 79, 195, 33, "Start", false, main_wnd) guiSetFont(start_btn, "default-bold-small")stop_btn = guiCreateButton(9, 112, 195, 33, "Stop", false, main_wnd) guiSetFont(stop_btn, "default-bold-small")reset_btn = guiCreateButton(9, 145, 195, 33, "Reset", false, main_wnd) guiSetFont(reset_btn, "default-bold-small")close_btn = guiCreateButton(9, 178, 195, 33, "Close", false, main_wnd) guiSetFont(close_btn, "default-bold-small") guiSetProperty(close_btn, "NormalTextColour", "FFFF0000") guiSetVisible(main_wnd, false) local milisec = 0local second = 0local minute = 0local hour = 0local handled = false function startFixing() guiSetText(watch_lbl,"Seconds: "..second.."\nMinute(s): "..minute.."\nHour(s): "..hour.."\nMilliseconds: "..milisec)endaddEventHandler("onClientResourceStart",root, startFixing) addCommandHandler("stopwatch",function() guiSetVisible(main_wnd,true) showCursor(true) guiSetEnabled(reset_btn, false) guiSetEnabled(stop_btn, false)end) function startTimer() timing = setTimer(startTime, 50, 0) guiSetEnabled(start_btn,false) guiSetEnabled(stop_btn,true) guiSetEnabled(reset_btn,true)endaddEventHandler("onClientGUIClick", start_btn, startTimer, false) function stopTimer() killTimer(timing) guiSetEnabled(stop_btn,false) guiSetEnabled(start_btn,true) guiSetEnabled(reset_btn,true)endaddEventHandler("onClientGUIClick", stop_btn, stopTimer, false) function resetTimer() if (timing) then killTimer(timing) else return end milisec = 0 second = 0 minute = 0 hour = 0 guiSetText(watch_lbl,"Seconds: "..second.."\nMinute(s): "..minute.."\nHour(s): "..hour.."\nMilliseconds: "..milisec)endaddEventHandler("onClientGUIClick", reset_btn, resetTimer, false) function closeGui() if (timing) then killTimer(timing) else return end guiSetVisible(main_wnd,false) showCursor(false) guiSetEnabled(stop_btn,false) guiSetEnabled(start_btn,true) guiSetEnabled(reset_btn,true)endaddEventHandler("onClientGUIClick", close_btn, closeGui, false) function startTime() handled=true if(milisec==1000)then milisec=0 second=second+1 if(second==59)then second=0 minute=minute+1 if(minute==59)then hour=hour+1 end end else milisec=milisec+50 end guiSetText(watch_lbl,"Seconds: "..second.."\nMinute(s): "..minute.."\nHour(s): "..hour.."\nMilliseconds: "..milisec)end addEventHandler("onClientResourceStop",root,function() removeEventHandler("onClientPreRender",root,startTime)end) Unfortunately, its unacceptable by Arran so I thought if someone's gonna make this feature, he might get help by this. Upvoting the suggestion anyways.This image would be good if this feature gets added in iPhone.
To stop the desperate use of "phone battery" as the only argument for why this should be added ingame:http://onlineclock.net/http://stopwatch.onlineclock.net/http://countdown.onlineclock.net/Has in-built alarm sound, so you can use it for farming as well. Just minimize MTA for 4 seconds, not that hard >.<. Anyways, upvoted cause I don't care
Well a simple stopwatch can contain a Reset feature, start feature, stop feature and close feature. If we use setTimer function, its minimum value is 50ms so it is possible in efficient way but if we use onClientPreRender, we can have it in better way like, we can count even 1ms.