Jump to content

طلب كود [Solved]


Recommended Posts

السلام عليكم

أريد كود يحول الوقت من

milliseconds إلي ثواني

لأني أريد أن يظهر الوقت المتبقي للسجين في مود السجن بالثواني

أرجو الناس تكون فهمتني وشكراً :D

Edited by Guest
Link to comment

أخي لما سويت هيك سيرفر

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
سو فنكشن ثاني للتكست وحطه بدون افنت

ولما يصير تريقر حط 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

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
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

وين أودي باقي التريقرات :D

Link to comment

تم حل المشكلة

سويت كده وأشتغل :D

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
تم حل المشكلة

سويت كده وأشتغل :D

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
تم حل المشكلة

سويت كده وأشتغل :D

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

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
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) 

متأكد أن الوقت حيقل :D

مبتدئ ومتعجب من الكود الحقيقة :D

Link to comment
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...