Hello guys i write script, everything works fine, but if there 2-3 the last time, 3d-text show doubles time(http://imgur.com/cSI4ub5) How i can fix that?
Sorry for bad english.
local drag = {}
local deftext=" Last time:"
local t = createElement("text")
setElementPosition(t,2225.85,-1742.41,15)
setElementData(t,"text",deftext)
setElementData(t,"scale",1.0)
local function addText()
local t = createElement("text")
setElementPosition(t,2225.85,-1742.41,14.56)
setElementData(t,"text",table.concat(drag))
setElementData(t,"scale",1)
setElementData(t,"1stAdd",true)
end
function registered(plr,vehicleP,timeP)
if vehicleP and timeP then
local text = getPlayerName(plr).."-"..getVehicleNameFromModel(vehicleP).." time: "..string.format("%.2f",timeP).."\n"
if text then
table.insert(drag,text)
addText()
end
end
if #drag > 5 then
table.remove(drag, 1)
end --addText()
end
addEvent("registerPredkosc",true)
addEventHandler("registerPredkosc",resourceRoot,registered)