Jump to content

Send Serversite Timer to Clientsite DxDraw


Alex1002

Recommended Posts

Posted

How i can show the Timer Clientside in 02:00 -> 01:59 -> 01:58… ¿¿¿

Serversite:

function teamMemberGroupTimer () 
  if (countPlayersInTeam(getTeamFromName("TeamOne")) >= 1) and (countPlayersInTeam(getTeamFromName("TeamTwo")) >= 1) then 
     if not isTimer (playTimerOneTwo) then 
       playTimerOneTwo = setTimer(function() outputChatBox("Timer Works") end, 6000, 9) 
       triggerClientEvent("timeOneTwoRecieve", source, playTimerOneTwo) 
    end 
  end 
end 

Client

addEvent("timeOneTwoRecieve", true) 
addEventHandler("timeOneTwoRecieve", root, function() 
  outputChatBox("Timer Clientsite") -- <--  It Works 
    addEventHandler("onClientRender", root, function() 
      local tone, ttwo, tthree = getTimerDetails(playTimerOneTwo) 
      if (tone) then 
      dxDrawText(tone, 874, 20, 1179, 74, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) 
    end 
  end) 
end) 

M.f.G

Alex.W

Posted

Okay, has not helped me :D

I would leave only one timer with the client by DxDrawText.

Server-Timer -> Send To Client -> DxDrawText , like (02:00, 01:59, 01:58…)

No one who knows, how i can do that¿¿¿

M.f.G

Alex.W

Posted

So it Works.

Serversite

local  sekunde = 10 --Times to Count here 10 Sec. 
        playTime = setTimer(function() 
        triggerClientEvent("timeRecieve",resourceRoot, sekunde) 
        sekunde = sekunde -1 
      end,1000,0) 

Clientsite

local savedSekunde = 10 -- Times to Count(Control) here 10 Sec. 
addEvent("timeRecieve", true) 
addEventHandler("timeRecieve", resourceRoot, function(newSekunde) 
  savedSekunde = newSekunde 
end) 
  
addEventHandler("onClientRender",root, function() 
  dxDrawText(savedSekunde, 400, 400, 0, 0) 
end) 

M.f.G

Alex.W

Posted

I wouldn't use setTimer, since it wouldn't be exactly the same for every client? Why not triggering a start time to count from to the client, and from there getTickCount?

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...