Hamza Elsayed Posted June 30, 2015 Share Posted June 30, 2015 (edited) السلام عليكم أريد كود يحول الوقت من milliseconds إلي ثواني لأني أريد أن يظهر الوقت المتبقي للسجين في مود السجن بالثواني أرجو الناس تكون فهمتني وشكراً Edited July 12, 2015 by Guest Link to comment
</Mr.Tn6eL> Posted July 1, 2015 Share Posted July 1, 2015 millisecond/1000 مثال print(60000/1000) -- 60.0 60000 = دقيقة او 60 ثانية 1000 = ثانية تبي تحذف الفاصلة math.floor(millisecond/1000) Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 millisecond/1000 مثال print(60000/1000) -- 60.0 60000 = دقيقة او 60 ثانية 1000 = ثانية تبي تحذف الفاصلة math.floor(millisecond/1000) أخي جاري التجربة بس علي ما أظن الوقت ما راح يقل Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 أخي لما سويت هيك سيرفر addEventHandler('onPlayerDamage',root,function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then setElementPosition (source, unpack(jaja[math.random( #jaja )])) if getPlayerWantedLevel(source) == 6 then ngo = setTimer ( setElementPosition, 360000, 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) remaining, executesRemaining, totalExecutes = getTimerDetails(ngo) triggerClientEvent (source,"moka",getRootElement(), remaining) elseif getPlayerWantedLevel(source) == 5 then ngo1 = setTimer ( setElementPosition, 300000, 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) remaining, executesRemaining, totalExecutes = getTimerDetails(ngo1) triggerClientEvent (source,"moka1",getRootElement(), remaining) elseif getPlayerWantedLevel(source) == 4 then ngo2 = setTimer ( setElementPosition, 240000, 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) remaining, executesRemaining, totalExecutes = getTimerDetails(ngo2) triggerClientEvent (source,"moka2",getRootElement(), remaining) elseif getPlayerWantedLevel(source) <= 3 then ngo3 = setTimer ( setElementPosition, 180000, 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) remaining, executesRemaining, totalExecutes = getTimerDetails(ngo3) triggerClientEvent (source,"moka3",getRootElement(), remaining) end end end end end ) وكلينت function bobuao(remaining) dxDrawText("Time : "..remaining/1000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuao) function bobuao1(remaining) dxDrawText("Time : "..remaining/1000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) end addEvent("moka1", true) addEventHandler("moka1", getRootElement(), bobuao1) function bobuao2(remaining) dxDrawText("Time : "..remaining/1000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) end addEvent("moka2", true) addEventHandler("moka2", getRootElement(), bobuao2) function bobuao3(remaining) dxDrawText("Time : "..remaining/1000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) end addEvent("moka3", true) addEventHandler("moka3", getRootElement(), bobuao3) يظهر الـ DxDrawText ويختفي في حينها ما المشكلة ؟؟ Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 استخدم افنت'onClientRender' ممكن توضحلي علي الكود الي أنا كتبته Link to comment
Simple. Posted July 1, 2015 Share Posted July 1, 2015 سو فنكشن ثاني للتكست وحطه بدون افنت ولما يصير تريقر حط addEventHandler -- 'onClientRender' لفنكشن التكست Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 سو فنكشن ثاني للتكست وحطه بدون افنتولما يصير تريقر حط addEventHandler -- 'onClientRender' لفنكشن التكست تقصد هيك ؟؟ function bobuaou(remaining) addEventHandler ( "onClientRender", source, bobuao ) end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuao(remaining) dxDrawText("Time : "..remaining/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) end Link to comment
</Mr.Tn6eL> Posted July 1, 2015 Share Posted July 1, 2015 function bobuaou(remaining) addEventHandler ( "onClientRender", root, bobuao ) rem = remaining end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuao( ) if math.floor(rem) > 0 then dxDrawText("Time : "..rem/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao) -- هنا كمل اكوادك end end Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 function bobuaou(remaining) addEventHandler ( "onClientRender", root, bobuao ) rem = remaining end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuao( ) if math.floor(rem) > 0 then dxDrawText("Time : "..rem/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao) -- هنا كمل اكوادك end end لو كل الأكواد صارت في فنكشن bobuao وين أودي باقي التريقرات Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 سو لكل تريقر فنكشن شكلك مش واخد بالك هوا بيقولي --هنا تكمل أكوادك في فنكشن واحد Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 وأيضاً الكود لا يعمل يقولي Got nil علي Rem :3 Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 يسميها نفس اسم mokaوخلاص أنا مبتدئ :3 هيا مين دي الي أسميها :3 Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 تم حل المشكلة سويت كده وأشتغل function bobuaou3(remaining3) rem3 = remaining3 addEventHandler('onClientRender',root,function ( ) if rem3 > 0 then dxDrawText("Time : "..rem3/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao3) end end) end addEvent("moka3", true) addEventHandler("moka3", getRootElement(), bobuaou3) function bobuaou(remaining) rem = remaining addEventHandler('onClientRender',root,function ( ) if rem > 0 then dxDrawText("Time : "..rem/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao) end end) end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuaou1(remaining1) rem1 = remaining1 addEventHandler('onClientRender',root,function ( ) if rem1 > 0 then dxDrawText("Time : "..rem1/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao1) end end) end addEvent("moka1", true) addEventHandler("moka1", getRootElement(), bobuaou1) function bobuaou2(remaining2) rem2 = remaining2 addEventHandler('onClientRender',root,function ( ) if rem2 > 0 then dxDrawText("Time : "..rem2/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao2) end end) end addEvent("moka2", true) addEventHandler("moka2", getRootElement(), bobuaou2) لكن مثل ما قلتلك بالاول الوقت لا يقل Link to comment
</Mr.Tn6eL> Posted July 1, 2015 Share Posted July 1, 2015 تم حل المشكلة سويت كده وأشتغل function bobuaou3(remaining3) rem3 = remaining3 addEventHandler('onClientRender',root,function ( ) if rem3 > 0 then dxDrawText("Time : "..rem3/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao3) end end) end addEvent("moka3", true) addEventHandler("moka3", getRootElement(), bobuaou3) function bobuaou(remaining) rem = remaining addEventHandler('onClientRender',root,function ( ) if rem > 0 then dxDrawText("Time : "..rem/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao) end end) end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuaou1(remaining1) rem1 = remaining1 addEventHandler('onClientRender',root,function ( ) if rem1 > 0 then dxDrawText("Time : "..rem1/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao1) end end) end addEvent("moka1", true) addEventHandler("moka1", getRootElement(), bobuaou1) function bobuaou2(remaining2) rem2 = remaining2 addEventHandler('onClientRender',root,function ( ) if rem2 > 0 then dxDrawText("Time : "..rem2/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao2) end end) end addEvent("moka2", true) addEventHandler("moka2", getRootElement(), bobuaou2) لكن مثل ما قلتلك بالاول الوقت لا يقل اصلا انت مسوي بلاوي Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 تم حل المشكلة سويت كده وأشتغل function bobuaou3(remaining3) rem3 = remaining3 addEventHandler('onClientRender',root,function ( ) if rem3 > 0 then dxDrawText("Time : "..rem3/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao3) end end) end addEvent("moka3", true) addEventHandler("moka3", getRootElement(), bobuaou3) function bobuaou(remaining) rem = remaining addEventHandler('onClientRender',root,function ( ) if rem > 0 then dxDrawText("Time : "..rem/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao) end end) end addEvent("moka", true) addEventHandler("moka", getRootElement(), bobuaou) function bobuaou1(remaining1) rem1 = remaining1 addEventHandler('onClientRender',root,function ( ) if rem1 > 0 then dxDrawText("Time : "..rem1/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao1) end end) end addEvent("moka1", true) addEventHandler("moka1", getRootElement(), bobuaou1) function bobuaou2(remaining2) rem2 = remaining2 addEventHandler('onClientRender',root,function ( ) if rem2 > 0 then dxDrawText("Time : "..rem2/60000, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, bobuao2) end end) end addEvent("moka2", true) addEventHandler("moka2", getRootElement(), bobuaou2) لكن مثل ما قلتلك بالاول الوقت لا يقل اصلا انت مسوي بلاوي بس والله شغال Link to comment
Hamza Elsayed Posted July 1, 2015 Author Share Posted July 1, 2015 طيب شغال , سم وش بغيت نعدل فيه ؟ أنا فضلت أحاول لحد ما أشتغل بس أريد طريقة تخلي الوقت ينقص ثانية ثانية Link to comment
</Mr.Tn6eL> Posted July 2, 2015 Share Posted July 2, 2015 Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) local remaining, executesRemaining, totalExecutes = getTimerDetails(timer) triggerClientEvent(source, "unJail", source, remaining) end end end end end) Client function displayTimer( ) local m,s = math.floor(remaining/60000), math.floor(remaining/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if m == 0 and s == 0 then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem addEventHandler("onClientRender", root, displayTimer) end) Link to comment
Hamza Elsayed Posted July 2, 2015 Author Share Posted July 2, 2015 Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) local remaining, executesRemaining, totalExecutes = getTimerDetails(timer) triggerClientEvent(source, "unJail", source, remaining) end end end end end) Client function displayTimer( ) local m,s = math.floor(remaining/60000), math.floor(remaining/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if m == 0 and s == 0 then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem addEventHandler("onClientRender", root, displayTimer) end) متأكد أن الوقت حيقل مبتدئ ومتعجب من الكود الحقيقة Link to comment
</Mr.Tn6eL> Posted July 2, 2015 Share Posted July 2, 2015 Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) local remaining, executesRemaining, totalExecutes = getTimerDetails(timer) triggerClientEvent(source, "unJail", source, remaining) end end end end end) Client function displayTimer( ) local m,s = math.floor(remaining/60000), math.floor(remaining/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if m == 0 and s == 0 then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem addEventHandler("onClientRender", root, displayTimer) end) متأكد أن الوقت حيقل مبتدئ ومتعجب من الكود الحقيقة نسيت اقلك انا الوقت مايتحدث Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) triggerClientEvent(source, "unJail", source, Times[getPlayerWantedLevel(source)]) end end end end end) Client function displayTimer( ) local now = getTickCount( ) local m,s = math.floor(now/60000), math.floor(now/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if now >= start+remaining then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem start = getTickCount( ) addEventHandler("onClientRender", root, displayTimer) end) Link to comment
Hamza Elsayed Posted July 2, 2015 Author Share Posted July 2, 2015 Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) local remaining, executesRemaining, totalExecutes = getTimerDetails(timer) triggerClientEvent(source, "unJail", source, remaining) end end end end end) Client function displayTimer( ) local m,s = math.floor(remaining/60000), math.floor(remaining/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if m == 0 and s == 0 then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem addEventHandler("onClientRender", root, displayTimer) end) متأكد أن الوقت حيقل مبتدئ ومتعجب من الكود الحقيقة نسيت اقلك انا الوقت مايتحدث Server Times = { [6] = 360000, [5] = 300000, [4] = 240000, [3] = 180000, [2] = 180000, [1] = 180000, } addEventHandler('onPlayerDamage',root, function(attacker,weapon) if attacker and attacker ~= source and getElementType(attacker) == 'player' and getPlayerTeam(attacker) and getTeamName(getPlayerTeam(attacker)) == 'Police' then if getPlayerWantedLevel(source) > 0 and getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) ~= 'Police' then if ( weapon == 3 ) then if Times[getPlayerWantedLevel(source)] then setElementPosition (source, unpack(jaja[math.random( #jaja )])) timer = setTimer ( setElementPosition, Times[getPlayerWantedLevel(source)], 1,source , 1572.9000244141, -1635.4000244141, 13.60000038147) triggerClientEvent(source, "unJail", source, Times[getPlayerWantedLevel(source)]) end end end end end) Client function displayTimer( ) local now = getTickCount( ) local m,s = math.floor(now/60000), math.floor(now/1000) if m < 10 then "0"..m end if s < 10 then "0"..s end dxDrawText("Time : "..m.." : "..s, 574, 543, 790, 590, tocolor(255, 187, 23, 255), 1.50, "beckett", "left", "top", false, false, false, false, false) if now >= start+remaining then removeEventHandler("onClientRender", root, displayTimer) end end addEvent("unJail", true) addEventHandler("unJail", root, function(rem) remaining = rem start = getTickCount( ) addEventHandler("onClientRender", root, displayTimer) end) ما يشتغل الجيم مود كله الدي بق يقولي ... unexpected Symbol Near ""0"" في سطر if m < 10 then "0"..m end Link to comment
Hamza Elsayed Posted July 2, 2015 Author Share Posted July 2, 2015 أخي جربت شلت الشرطين دول ... if m < 10 then "0"..m end if s < 10 then "0"..s end الوقت صار يزيد لا يقل 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