script_name("Capture timer")
script_dependencies("CLEO", "SAMP", "SAMPFUNCS")
---------------------------------------------------------------------------
require "lib.moonloader"
require "lib.sampfuncs"
---------------------------------------------------------------------------
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
sampRegisterChatCommand("ctimer", cmd)
fMin = 15
fSec = 0
while true do
if isPlayerPlaying(playerHandle) and enabled then
---------------------------------------------------------------------------
wait(1000)
if fSec > 0 then
fSec = fSec - 1
elseif fmin > 0
then
fMin = fMin - 1
fSec = 59
else
enabled = false
sampTextdrawDelete(420)
printTextNow('Capture ended', 1000, 1)
end
if sampTextdrawIsExists(420) then
sampTextdrawSetString(420, string.format("%02d:%02d", fMin, fSec))
end
---------------------------------------------------------------------------
else wait(0)
end
end
end
function cmd(param)
enabled = not enabled
if enabled then
sampTextdrawCreate(420, "15:00", 70.0, 200.0)
sampTextdrawSetStyle(420, 2)
else if sampTextdrawIsExists(420) then
sampTextdrawDelete(420)
end
end
end