nikitafloy Posted May 1, 2014 Share Posted May 1, 2014 (edited) why its dont work? Which equation correctly for Timer? server: function sitPr ( thePlayer, cmd, timer, Psource ) local timer = getTickCount() + timer*60*1000 triggerClientEvent ( Psource, 'checkTimer', Psource, Psource, timer ) addCommandHandler ( 'sPr', sitPr ) Client: function check(Psource, timer) timerCheck = setTimer(function() outputChatBox('1 '..tonumber(timer)) outputChatBox('2 '..tonumber(current)) outputChatBox('3 '..tonumber(rezoneTimer)) if timer <= getTickCount() then triggerServerEvent( 'Vipustit', getLocalPlayer(), localPlayer ) killTimer( timerCheck ) end end, 1000, 0 ) end addEvent( 'checkTimer', true ) addEventHandler( 'checkTimer', getRootElement(), check ) Edited May 1, 2014 by Guest Link to comment
Moderators IIYAMA Posted May 1, 2014 Moderators Share Posted May 1, 2014 The client tickcount starts when the client starts. The server tickcount starts when the server starts. They never start at the same time, so you can't compare them. Link to comment
nikitafloy Posted May 1, 2014 Author Share Posted May 1, 2014 The client tickcount starts when the client starts.The server tickcount starts when the server starts. They never start at the same time, so you can't compare them. getTickCount () show the work of the server itself, no? 'This function returns amount of time that your system has been running in milliseconds. ' Link to comment
Moderators IIYAMA Posted May 1, 2014 Moderators Share Posted May 1, 2014 The mta server is the system it self. I mentioned the mta server not the machine. Link to comment
nikitafloy Posted May 1, 2014 Author Share Posted May 1, 2014 The mta server is the system it self.I mentioned the mta server not the machine. then, why does it work? server: function takeMoneyDet( thePlayer, money ) local accPlayer = getPlayerAccount( thePlayer ) local money = getTickCount() + money/210*60*1000 setAccountData ( accPlayer, "detector-have", money ) timerDetect = tonumber(getAccountData ( accPlayer, "detector-have" )) triggerClientEvent( thePlayer, 'rasschet', thePlayer, client, timerDetect ) end addEvent( 'takeMoneyDet', true ) addEventHandler( 'takeMoneyDet', getRootElement(), takeMoneyDet ) client: function rasschet( player, timerDetect ) timerCheck = setTimer(function() timerDetect = timerDetect-getTickCount() triggerServerEvent( 'update30', localPlayer, timerDetect ) if timerDetect <= 0 then triggerServerEvent( 'unableDetect', localPlayer ) killTimer( timerCheck ) end end, 30000, 0 ) end Link to comment
Moderators IIYAMA Posted May 1, 2014 Moderators Share Posted May 1, 2014 Didn't you read my post before? You can't compare them because they start at a different time. Link to comment
nikitafloy Posted May 1, 2014 Author Share Posted May 1, 2014 Didn't you read my post before?You can't compare them because they start at a different time. But this code works, but he is not. 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