Jump to content

[HELP] time left to complete race problem


kuwalda

Recommended Posts

Hello.

I have made script that automalicly ends race for player after defined time, but it does not work(I belive clientside is wrong).

Can anyone please find where did I go wrong?

  
--trigger it from serverSide 
triggerClientEvent(thePlayer, "showTimeLeft", thePlayer, getTickCount() + 60000) 
  
--handle it from clientSide 
addEvent( "showTimeLeft", true ) 
addEventHandler( "showTimeLeft", getRootElement(), 
function (timeLeft) 
    dxDrawText("Time left:", 19, 210, 185, 228, tocolor(0, 0, 0, 255), 1.20, "sans", "left", "top", false, false, true, false, false) 
    dxDrawText(""..timeLeft.."", 19, 228, 165, 247, tocolor(0, 0, 0, 255), 1.25, "sans", "right", "top", false, false, true, false, false) 
    addEventHandler("onClientRender", root, showTimeLeft) 
    if timeLeft =< getTickCount() then 
        removeEventHandler("onClientRender", root, showTimeLeft) 
        triggerServerEvent("endRaceForPlayer", localPlayer) 
    end 
end) 
  

Link to comment
  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...