Jump to content

كود نو يشتغل مدري ليه


Recommended Posts

    local frozeTime = 60 -- Seconds as frozen 
    local timeLeft = {} 
    local timeLeftText = {} 
      
    addEvent("Froze", true) 
    addEventHandler("Froze", root, 
    function() 
        if getPlayerMoney(source) >= 2000 then 
            local players = getElementsByType("player") 
            takePlayerMoney(source, 2000) 
            outputChatBox("All players successfully frozen", source, 255, 255, 0, true) 
            
            for theKey,thePlayer in ipairs(players) do 
                if (thePlayer ~= source) then 
                    setElementFrozen(thePlayer, true) 
                    setElementData(thePlayer, "Timeleft", tonumber(frozeTime)) 
                    showTimeLeft(thePlayer) 
                end 
            end 
        else 
            outputChatBox("Not enough money.", source, 255, 0, 0, true) 
        end 
    end) 
      
    function showTimeLeft(player) 
        timeLeft[player] = textCreateDisplay() 
        textDisplayAddObserver(timeLeft[player], player) 
        timeLeftText[player] = textCreateTextItem("Time left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255) 
        textDisplayAddText(timeLeft[player], timeLeftText[player]) 
        setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player) 
    end 
      
    function updateTimeLeft(player) 
        setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1) 
        textItemSetText(timeLeftText[player], "Time left: " .. getElementData(player, "Timeleft")) 
        
        if tonumber(getElementData(player, "Timeleft")) == 0 then 
            textDestroyDisplay(timeLeft[player]) 
            setElementFrozen(player, false) 
        end 
    end 
      

كود ما يشتغل

Link to comment

تفضل

     local frozeTime = 60 -- Seconds as frozen 
    local timeLeft = {} 
    local timeLeftText = {} 
      
    addEvent("Froze", true) 
    addEventHandler("Froze", root, 
    function() 
        local PlayerMoney = getPlayerMoney ( source ) 
        if getPlayerMoney(source) >= 2000 then 
            local players = getElementsByType("source") 
            takePlayerMoney(source, 2000) 
            outputChatBox("All players successfully frozen", source, 255, 255, 0, true) 
            
            for theKey,thePlayer in ipairs(players) do 
                if (thePlayer ~= source) then 
                    setElementFrozen(thePlayer, true) 
                    setElementData(thePlayer, "Timeleft", tonumber(frozeTime)) 
                    showTimeLeft(thePlayer) 
                end 
            end 
        else 
            outputChatBox("Not enough money.", source, 255, 0, 0, true) 
        end 
    end) 
      
    function showTimeLeft(player) 
        timeLeft[player] = textCreateDisplay() 
        textDisplayAddObserver(timeLeft[player], player) 
        timeLeftText[player] = textCreateTextItem("Time left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255) 
        textDisplayAddText(timeLeft[player], timeLeftText[player]) 
        setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player) 
    end 
      
    function updateTimeLeft(player) 
        setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1) 
        textItemSetText(timeLeftText[player], "Time left: " .. getElementData(player, "Timeleft")) 
        
        if tonumber(getElementData(player, "Timeleft")) == 0 then 
            textDestroyDisplay(timeLeft[player]) 
            setElementFrozen(player, false) 
        end 
    end 

Link to comment
    local frozeTime = 60 -- Seconds as frozen 
    local timeLeft = {} 
    local timeLeftText = {} 
      
    addEvent("Froze", true) 
    addEventHandler("Froze", root, 
    function() 
        if getPlayerMoney(source) >= 2000 then 
            local players = getElementsByType("player") 
            takePlayerMoney(source, 2000) 
            outputChatBox("All players successfully frozen", source, 255, 255, 0, true) 
            
            for theKey,thePlayer in ipairs(players) do 
                if (thePlayer ~= source) then 
                    setElementFrozen(thePlayer, true) 
                    setElementData(thePlayer, "Timeleft", tonumber(frozeTime)) 
                    showTimeLeft(thePlayer) 
                end 
            end 
        else 
            outputChatBox("Not enough money.", source, 255, 0, 0, true) 
        end 
    end) 
      
    function showTimeLeft(player) 
        timeLeft[player] = textCreateDisplay() 
        textDisplayAddObserver(timeLeft[player], player) 
        timeLeftText[player] = textCreateTextItem("Time left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255) 
        textDisplayAddText(timeLeft[player], timeLeftText[player]) 
        setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player) 
    end 
      
    function updateTimeLeft(player) 
        setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1) 
        textItemSetText(timeLeftText[player], "Time left: " .. getElementData(player, "Timeleft")) 
        
        if tonumber(getElementData(player, "Timeleft")) == 0 then 
            textDestroyDisplay(timeLeft[player]) 
            setElementFrozen(player, false) 
        end 
    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...