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 
  

أخوكم

sultanalbalawi

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 
  

أخوكم

sultanalbalawi

هذا كود تبع شوب يجمد اللاعبين و يطلع الوقت في الشاشة

وهذا الكود مسوي له ترايقر سيرفر , الكود صح مافيه شي

شكلك ماخذه من شوب احد

و اذا تبي تركبه على شوب ويش تبي نعدل ؟

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 
  

أخوكم

sultanalbalawi

لين تبي كود فريز جماعي للشوب

Client Side !

addEventHandler("onClientGUIClick",guiRoot,function() 
    if source == اسم الزر then 
        triggerServerEvent("FrozenAll",localPlayer) 
    end 
end) 
  

Server Side !

local timer = 5000 -- 1000 الوقت الي تبي ياخذون الاعبين فريز وبعدها ينفك الثانية 
addEvent("FrozenAll",true) 
addEventHandler("FrozenAll",getRootElement(), 
function() 
    for i,v in ipairs (getElementsByType("player")) do 
        setElementFrozen(v,true) 
        setElementFrozen(source,false) 
        setTimer(function() setElementFrozen(v,false) end,timer,1) 
    end 
end) 
  
  
  

ملاحظة : ضيف السعرر للكود

Edited by Guest
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 
  

أخوكم

sultanalbalawi

عندك غلط في

local frozeTime = 60  

الثانية =1000 لين دقيقة 60000

انت تبي دقيقة

لين دقيقة تصير كذآ

local frozeTime = 60000 

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