Jump to content

مساعدة


Recommended Posts

السلام عليكم شباب 

أنا عندي مود كلانات و هذا كود يسوي فحص للتاج و يضم اللاعب اذا هو موجود في الكلان
 


function CL.CheckForTag(p, name)
    if not isElement(p) or getElementType(p) ~= "player" then
        return
    end
    
    local account = getPlayerAccount(p)
    if not isGuestAccount(account) then
        local q = executeSQLQuery("SELECT * FROM my_clans WHERE account=?", getAccountName(account))
        if #q == 0 then
            return
        end

        local t = getPlayerTeam(p)
        if t then
            if countPlayersInTeam(t) < 2 then
                destroyElement(t)
                outputDebugString("Team destroyed for player " .. getPlayerName(p))
            end
            setPlayerTeam(p, nil)
            local r, g, b = math.random(50, 200), math.random(50, 200), math.random(50, 200)
            setPlayerNametagColor(p, r, g, b)
            outputDebugString("Player " .. getPlayerName(p) .. " removed from team")
        end

        for i, v in ipairs(q) do
            if (string.find(name, "[" .. v.tag .. "]", 1, true) ~= nil) then
                local nt = getTeamFromName(v.clan)
                local q2 = executeSQLQuery("SELECT * FROM clans WHERE name=?", v.clan)
                if nt then
                    setPlayerTeam(p, nt)
                    outputDebugString("Player " .. getPlayerName(p) .. " joined clan " .. v.clan)
                else
                    createTeam(q2[1].name, q2[1].r, q2[1].g, q2[1].b)
                    setPlayerTeam(p, getTeamFromName(v.clan))
                    outputDebugString("Player " .. getPlayerName(p) .. " created and joined clan " .. v.clan)
                end
            end
        end

        triggerEvent("WS:Add", p)
    end
end
addEvent("CL:CheckForTag", true)
addEventHandler("CL:CheckForTag", root, CL.CheckForTag)

for i,k in ipairs(getElementsByType("player")) do
	local name = getPlayerName(k)
	CL.CheckForTag(k,name)
end

و المشلكة أني سويت مهمة و لما تنتهي المهمة بدي اللاعبين يرجعو للكلان الي تبعهم
 

function GW.Close()
    GW["CLOSE"] = setTimer(function()
        local players = getPlayersInDimension(GW["D"])

        if #players < 6 then
            GW["STATE"] = "Not Running"
            GW.Unload()
            GW.Start()

            for i, v in ipairs(getElementsByType("player")) do
                outputChatBox("• #FFFFFFGang War #CE1030event over!", v, 206, 16, 48, true)
            end

            for i, v in ipairs(players) do
                local name = getPlayerName(v)
                outputChatBox("[ERROR]: 3 Players are required in both gangs", v, 255, 0, 0, true)
                call(getResourceFromName("Core"), "spawnThePlayer", v, OLDS[v])
				triggerEvent("CL:CheckForTag",v,name)
                setElementFrozen(v, false)
                removeElementData(v, "GW:Joined")
                triggerClientEvent(v, "GW:RemoveGUI", v)

                for k, z in ipairs(OLDW[v]) do
                    giveWeapon(v, z, 500, true)
                end
            end

            return
        end

        for i, v in ipairs(getElementsByType("player")) do
            outputChatBox("• #FFFFFFGang War #CE1030event has started!", v, 206, 16, 48, true)
        end

        for i, v in ipairs(players) do
            setElementFrozen(v, false)
        end

        local t1p = getPlayersInTeam(getTeamFromName(GW["T1"]))
        local t2p = getPlayersInTeam(getTeamFromName(GW["T2"]))

        for i, v in ipairs(t1p) do
            local t = getPlayerTeam(v)
            local name = getTeamName(t)

            for k, z in ipairs(weapons[name]) do
                local id = z.id
                local ammo = z.ammo
                local current = z.current or false
                giveWeapon(v, id, ammo, current)
                local r, g, b = getTeamColor(t)
                local weaponName = wtb[id]
                triggerClientEvent(v, "NT:Add", v, "+ " .. weaponName, 1, "bankgothic", { 33, 117, 221, 255 }, true, { 0, 0, 0, 255 }, 5000)
            end
        end

        for i, v in ipairs(t2p) do
            local t = getPlayerTeam(v)
            local name = getTeamName(t)

            for k, z in ipairs(weapons[name]) do
                local id = z.id
                local ammo = z.ammo
                local current = z.current or false
                giveWeapon(v, id, ammo, current)
                local r, g, b = getTeamColor(t)
                local weaponName = wtb[id]
                triggerClientEvent(v, "NT:Add", v, "+ " .. weaponName, 1, "bankgothic", { 33, 117, 221, 255 }, true, { 0, 0, 0, 255 }, 5000)
            end
        end

        GW["STATE"] = "Running"

        -- Trigger the "CL:CheckForTag" event for each player to add them back to their clans
        for i, v in ipairs(players) do
            local name = getPlayerName(v)
            triggerEvent("CL:CheckForTag", v, name)
            outputDebugString("Triggered CL:CheckForTag for player " .. name)
        end
    end, 5000, 1)
end

سويت 
                triggerEvent("CL:CheckForTag",v,name)

بس ما اشتغلت

Link to comment

وعليكم السلام 

جرب

function GW.Close()
    GW["CLOSE"] = setTimer(function()
        local players = getPlayersInDimension(GW["D"])

        if #players < 6 then
            GW["STATE"] = "Not Running"
            GW.Unload()
            GW.Start()

            for i, v in ipairs(getElementsByType("player")) do
                outputChatBox("• #FFFFFFGang War #CE1030event over!", v, 206, 16, 48, true)
            end

            for i, v in ipairs(players) do
                local name = getPlayerName(v)
                outputChatBox("[ERROR]: 3 Players are required in both gangs", v, 255, 0, 0, true)
                call(getResourceFromName("Core"), "spawnThePlayer", v, OLDS[v])
				triggerEvent("CL:CheckForTag",v,name)
                setElementFrozen(v, false)
                removeElementData(v, "GW:Joined")
                triggerClientEvent(v, "GW:RemoveGUI", v)

                for k, z in ipairs(OLDW[v]) do
                    giveWeapon(v, z, 500, true)
                end
            end

            return
        end

        for i, v in ipairs(getElementsByType("player")) do
            outputChatBox("• #FFFFFFGang War #CE1030event has started!", v, 206, 16, 48, true)
        end

        for i, v in ipairs(players) do
            setElementFrozen(v, false)
        end

        local t1p = getPlayersInTeam(getTeamFromName(GW["T1"]))
        local t2p = getPlayersInTeam(getTeamFromName(GW["T2"]))

        for i, v in ipairs(t1p) do
            local t = getPlayerTeam(v)
            local name = getTeamName(t)

            for k, z in ipairs(weapons[name]) do
                local id = z.id
                local ammo = z.ammo
                local current = z.current or false
                giveWeapon(v, id, ammo, current)
                local r, g, b = getTeamColor(t)
                local weaponName = wtb[id]
                triggerClientEvent(v, "NT:Add", v, "+ " .. weaponName, 1, "bankgothic", { 33, 117, 221, 255 }, true, { 0, 0, 0, 255 }, 5000)
            end
        end

        for i, v in ipairs(t2p) do
            local t = getPlayerTeam(v)
            local name = getTeamName(t)

            for k, z in ipairs(weapons[name]) do
                local id = z.id
                local ammo = z.ammo
                local current = z.current or false
                giveWeapon(v, id, ammo, current)
                local r, g, b = getTeamColor(t)
                local weaponName = wtb[id]
                triggerClientEvent(v, "NT:Add", v, "+ " .. weaponName, 1, "bankgothic", { 33, 117, 221, 255 }, true, { 0, 0, 0, 255 }, 5000)
            end
        end

        GW["STATE"] = "Running"

        -- Trigger the "CL:CheckForTag" event for each player to add them back to their clans
        for i, player1 in ipairs(getElementsByType("player")) do
            local name = getPlayerName(player1)
            triggerEvent("CL:CheckForTag", player1, name)
            outputDebugString("Triggered CL:CheckForTag for player " .. name)
        end
    end, 5000, 1)
end

 

Edited by MR.Mosa
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...