nikitafloy Posted May 1, 2014 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 Нужен скриптер?Benuff Server - Russian Site MTA:SA - Updating, Client, Game, Problem Solving, Help for Russian Players and etc.
Moderators IIYAMA Posted May 1, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
nikitafloy Posted May 1, 2014 Author 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. ' Нужен скриптер?Benuff Server - Russian Site MTA:SA - Updating, Client, Game, Problem Solving, Help for Russian Players and etc.
Moderators IIYAMA Posted May 1, 2014 Moderators Posted May 1, 2014 The mta server is the system it self. I mentioned the mta server not the machine. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
nikitafloy Posted May 1, 2014 Author 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 Нужен скриптер?Benuff Server - Russian Site MTA:SA - Updating, Client, Game, Problem Solving, Help for Russian Players and etc.
Moderators IIYAMA Posted May 1, 2014 Moderators Posted May 1, 2014 Didn't you read my post before? You can't compare them because they start at a different time. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
nikitafloy Posted May 1, 2014 Author 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. Нужен скриптер?Benuff Server - Russian Site MTA:SA - Updating, Client, Game, Problem Solving, Help for Russian Players and etc.
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