SkiZo Posted June 25, 2018 Share Posted June 25, 2018 (edited) So I created this Fonction wich is spawn timer.. what ever .. when i reconnect the timer gone . ? how can i fix it ? function bag.dx() if not isTimer(bag.timer) then removeEventHandler("onClientRender", root, bag.dx); return end local clock = convertToClock(bag.timer) dxDrawText("Time Left: "..clock, timerX, timerY, timerX+timerW, timerY+timerH, tocolor(255,255,255,225), 1, "default-bold", "left", "center") end function convertToClock(theTimer) if not isTimer(theTimer) then return false end local remaining = getTimerDetails(theTimer) local s = remaining/1000 --seconds from ms return string.format("%.2d:%.2d", s/60%60, s%60) end function bag.setupTimer(minutes) bag.timer = setTimer(function() bag.timer = nil end, (60*1000), 1) -- 1 min counting addEventHandler("onClientRender", root, bag.dx) end Help me :c is work perfectly no edit but in reconnect is gone ( and still in screen of other players ) Edited June 25, 2018 by Legend<3 Link to comment
Z4Zy Posted June 26, 2018 Share Posted June 26, 2018 (edited) Client Side timers are destroyed, when client / player disconnect from server. But if you set this timer to Server Side, it doesn't destroyed. 9 hours ago, Legend<3 said: and still in screen of other players I think this problem will fix if, you change the 2nd argument of event handler in line 16 to localPlayer, instead of root. Edited June 26, 2018 by DeadthStrock Link to comment
SkiZo Posted June 26, 2018 Author Share Posted June 26, 2018 13 hours ago, DeadthStrock said: Client Side timers are destroyed, when client / player disconnect from server. But if you set this timer to Server Side, it doesn't destroyed. I think this problem will fix if, you change the 2nd argument of event handler in line 16 to localPlayer, instead of root. Hello, everyone should see the Timer.. and dx timers always in client Side how i will make it in server ??? ! Link to comment
Dimos7 Posted June 26, 2018 Share Posted June 26, 2018 1 hour ago, Legend<3 said: Hello, everyone should see the Timer.. and dx timers always in client Side how i will make it in server ??? ! You can create the server side and saves it as element data and then pass it to client Link to comment
SkiZo Posted June 26, 2018 Author Share Posted June 26, 2018 13 minutes ago, Dimos7 said: You can create the server side and saves it as element data and then pass it to client looks difficult i mean.. i did not understand how it can be exactly ? u have an exmple like .. when BotWasted then start Timer etc.. and dX get that timer ? have u any suggestion ? ServerSide.lua function NemesisLS ( ) nemesils = exports [ "slothBot" ]:spawnBot ( 1641.2094726563, -1061.2463378906, 23.9, 90, 108, 0, 0, NemesisLS, 34, "hunting", true ) exports.extra_health:setElementExtraHealth ( nemesils, 6000 ) outputChatBox ("#FF0000Event: #00FF00The #FF0000BOSS #00FF00has returned to life. #FFFF00City Los Santos.",getRootElement(), 255, 255, 255, true ) BlipNemesisls = createBlipAttachedTo ( nemesils, 23 ) end addEvent("onBotWasted",true) addEventHandler("onBotWasted",getRootElement(), function (killer) if (source == nemesils) then killerName = getPlayerName(killer) givePlayerMoney(killer, (15000)) triggerClientEvent(getRootElement(), "createBagTimer1", getRootElement(), minutes) end end) then the timer . Link to comment
SkiZo Posted June 27, 2018 Author Share Posted June 27, 2018 Hello, Still looking for solution ? can somebody help me ? Link to comment
Dimos7 Posted June 27, 2018 Share Posted June 27, 2018 2 hours ago, Legend<3 said: Hello, Still looking for solution ? can somebody help me ? You want add timer in that code when bot die? Link to comment
SkiZo Posted June 27, 2018 Author Share Posted June 27, 2018 3 hours ago, Dimos7 said: You want add timer in that code when bot die? Yeah .. i mean when bot die Dxtimer start ( this already work ) but when i reconnect the timer gone . i mean it doesn't shown in the screen. Link to comment
Dimos7 Posted June 28, 2018 Share Posted June 28, 2018 11 hours ago, Legend<3 said: Yeah .. i mean when bot die Dxtimer start ( this already work ) but when i reconnect the timer gone . i mean it doesn't shown in the screen. You want that timer be on server time on killer kill that bot right? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now