Doffy Posted April 10, 2019 Share Posted April 10, 2019 (edited) السلام عليكم اليوم واجهتني مشكلة في حفظ التايمر علي الحساب TimerMoneyRateb = { } addEventHandler("onPlayerLogin",root, function( ) local acc = getPlayerAccount(source) local dataMoney = getAccountData(acc, "MoneyTimer") if dataMoney ~= false then triggerClientEvent(source, "closeButtonRateb", source) TimerMoneyRateb[source] = setTimer(function(source) setAccountData(source, "MoneyTimer", false) triggerClientEvent(source, "openButtonRateb", source) end,tonumber(dataMoney),1,source) end end ) function onStart( ) for i,v in ipairs ( getElementsByType("player") ) do if not isGuestAccount(getPlayerAccount(v)) then local acc = getPlayerAccount(v) local dataMoney = getAccountData(acc, "MoneyTimer") if dataMoney ~= false then triggerClientEvent(v, "closeButtonRateb", v) outputChatBox(dataMoney,v,255,0,0,true) -- for test TimerMoneyRateb[v] = setTimer(function(v) setAccountData(acc, "MoneyTimer", false) triggerClientEvent(v, "openButtonRateb", v) end,tonumber(dataMoney),1,v) end end end end setTimer(onStart, 1000,1) function onStop( ) for i,v in ipairs ( getElementsByType("player") ) do if not isGuestAccount(getPlayerAccount(v)) then local acc = getPlayerAccount(v) if isTimer( TimerMoneyRateb[v] ) then local timer = getTimerDetails ( TimerMoneyRateb [ v ] ) if ( timer ) then setAccountData(acc, "MoneyTimer", myTimer) end end end end end setTimer(onStop, 1000,1) addEventHandler("onPlayerQuit",root, function( ) if not isGuestAccount(getPlayerAccount(source)) then local acc = getPlayerAccount(source) if isTimer( TimerMoneyRateb[source] ) then local timer = getTimerDetails ( TimerMoneyRateb [ source ] ) if ( timer ) then setAccountData(acc, "MoneyTimer", myTimer) end end end end ) والمشكلة كمان انو مافي ديبق فمب عارف المشكلة وين والتايمر ما ينحفظ الا لو خرجت ودخلت وسجلت دخول يشتغل اما لو رسترت المود ما ينحفظ انا ابيه ينحفظ بس يتقفل المود او يخرج اللاعب ويوم يسجل او يشتغل يكمل التايمر ولاكن ما يظبط Edited April 10, 2019 by !#DesTroyeR_,) Link to comment
nxFairlywell Posted April 10, 2019 Share Posted April 10, 2019 سطر 43 و 58 وش يعني myTimer Link to comment
nxFairlywell Posted April 10, 2019 Share Posted April 10, 2019 (edited) لازم تحط زر الإغلاق بعد ما يضغط اللاعب على زر الحصول على الراتب يعني تحطه بجانب كلينت مايحتاج سيرفر وهذا الكود مو مجرب ولكن غالباً راح يشتغل جربه ووريني اذا فيه خطأ TimerMoneyRateb = { } visibleButton=function( player ) if isElement(player) and getElementType(player) == "player" then triggerClientEvent(player, "openButtonRateb", player); end end addEventHandler('onResourceStart',resourceRoot, function() local players = getElementsByType('player'); for k, player in ipairs (players) do local acc = getPlayerAccount(player); local data = getAccountData(acc,'MoneyTimer'); if data then local milliseconds = data; setAccountData(acc,'MoneyTimer',false); if isTimer(TimerMoneyRateb[player]) then return end TimerMoneyRateb[player]=setTimer(visibleButton, milliseconds, 1, player); else TimerMoneyRateb[player]=setTimer(visibleButton, 1000, 1, player); end end end ) function onQuit() local account = getPlayerAccount(source); if account then local data = getAccountData(account, 'MoneyTimer'); if not data then if isTimer(TimerMoneyRateb[source]) then local remaining=getTimerDetails(TimerMoneyRateb[source]); setAccountData(account,'MoneyTimer',remaining); killTimer(TimerMoneyRateb[source]); TimerMoneyRateb[source]=nil; end else return end else return end end function onLogin(_, account) if account then local data = getAccountData(account,'MoneyTimer'); if data then local milliseconds = data; setAccountData(account,'MoneyTimer',false); if isTimer(TimerMoneyRateb[source]) then killTimer(TimerMoneyRateb[source]); return end TimerMoneyRateb[source]=setTimer(visibleButton, milliseconds, 1, source); else TimerMoneyRateb[source]=setTimer(visibleButton, 1000, 1, source); end else return end end function onLogout() local account = getPlayerAccount(source); if account then local data = getAccountData(account, 'MoneyTimer'); if not data then if isTimer(TimerMoneyRateb[source]) then local remaining=getTimerDetails(TimerMoneyRateb[source]); setAccountData(account,'MoneyTimer',remaining); killTimer(TimerMoneyRateb[source]); TimerMoneyRateb[source]=nil; end else return end else return end end function onStop() local players = getElementsByType('player'); for k, player in ipairs(players) do local account = getPlayerAccount(player); if isTimer(TimerMoneyRateb[player]) then local remaining=getTimerDetails(TimerMoneyRateb[player]); setAccountData(account,'MoneyTimer',remaining); killTimer(TimerMoneyRateb[player]); TimerMoneyRateb[player]=nil; return end end end addEventHandler("onPlayerQuit",root,onQuit); addEventHandler("onPlayerLogin",root,onLogin); addEventHandler("onPlayerLogout",root,onLogout); addEventHandler("onResourceStop",resourceRoot,onStop); Edited April 10, 2019 by NX_CI Link to comment
Abdul KariM Posted April 10, 2019 Share Posted April 10, 2019 @NX_CI يوقف اللوب return ال 1 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