Jump to content

قروب سيستيم


maass

Recommended Posts

السلام عليكم ابي اسوي حد معين لكل القروبات

+

ابي القروب سيستيم مايسوي ملفات لليدرز والقروبات فهمتو قصدي

وابي اذا ماعليكم امر تصلحون خلل لمن يضغط الاعب قبول الدعوة وهو ماضغط على اي قروب

Client

--***********************************-- 
--***********************************--
--            Group System           --
--             By Al3grab            --
--***********************************--
--***********************************--
sec = {{{{{{},{},{},{}}}}}}          --
--***********************************--
--***********************************--
 
--
rRoot = getResourceRootElement(getThisResource())
lp = getLocalPlayer()
--
 
function onClientGSStart()
    outputDebugString("Group System By Al3grab | Started")
    getSettingsFromServer()
    --
    setTimer ( function()
        setUpGui()
    end , 3000 , 1 )
end
addEventHandler("onClientResourceStart",rRoot,onClientGSStart)
 
function getSettingsFromServer()
    triggerServerEvent("SendSettings",lp,lp)
end
 
function ReciveSettings(Table)
    if ( Table and type(Table) == "table" ) then
        Settings = Table
    end
end
addEvent("ReciveSettings",true)
addEventHandler("ReciveSettings",root,ReciveSettings)
 
function setUpGui()
    GS_Window = {}
    GS_Button = {}
    GS_Label = {}
    GS_Edit = {}
    --
    GS_Window[1] = guiCreateWindow(407,160,396,437,"Group System | By Al3grab",false)
    guiSetAlpha(GS_Window[1],0.9)
    guiWindowSetSizable(GS_Window[1],false)
    guiSetCenter(GS_Window[1])
    guiSetVisible(GS_Window[1],false)
    --
    GS_Edit[1] = guiCreateEdit(12,60,219,35,"",false,GS_Window[1])
    guiEditSetMaxLength(GS_Edit[1],20)
    GS_Label[1] = guiCreateLabel(13,29,214,19,"Create a Group:",false,GS_Window[1])
    GS_Button[1] = guiCreateButton(239,60,144,35,"Create Group",false,GS_Window[1])
    --
    GS_Label[2] = guiCreateLabel(12,102,369,17,"_____________________________________________________",false,GS_Window[1])
    --
    GS_Label[3] = guiCreateLabel(13,126,214,19,"Group Name:",false,GS_Window[1])
    GS_Button[2] = guiCreateButton(11,150,213,33,"View My Group Members",false,GS_Window[1])
    GS_Button[5] = guiCreateButton(231,150,156,33,"Leave Group",false,GS_Window[1])
    --
    GS_Label[4] = guiCreateLabel(13,195,214,19,"Group Invites: ",false,GS_Window[1])
    GS_Button[3] = guiCreateButton(11,223,213,33,"View My Group Invites",false,GS_Window[1])
    GS_Button[6] = guiCreateButton(231,223,156,33,"View Groups List",false,GS_Window[1])
    --
    GS_Label[5] = guiCreateLabel(13,266,214,19,"Group Info: ",false,GS_Window[1])
    GS_Button[4] = guiCreateButton(11,294,213,33,"View/Edit My Group Info",false,GS_Window[1])
    GS_Button[7] = guiCreateButton(231,294,156,33,"Close Window",false,GS_Window[1])
    --
    GS_Label[6] = guiCreateLabel(12,341,369,17,"_____________________________________________________",false,GS_Window[1])
    --
    GS_Label[7] = guiCreateLabel(13,365,214,19,"Group Administration: ",false,GS_Window[1])
    GS_Button[8] = guiCreateButton(11,388,213,33,"Invite Player To Group",false,GS_Window[1])
    GS_Button[9] = guiCreateButton(231,388,156,33,"Group Leader Admin",false,GS_Window[1])
    --
    for k,v in ipairs ( GS_Button ) do
        guiSetFont(v,"clear-normal")
    end
    --
    for k,v in ipairs ( GS_Label ) do
        guiSetFont(v,"clear-normal")
    end
    --
    repeat until bindKey(Settings["OpenKey"] or "F1","down",function()
        togglePanel(not guiGetVisible(GS_Window[1]))
    end )
    --
    outputGS("Press #FFFFFF"..Settings["OpenKey"].."#FFFF00 to open panel.")
end
 
function guiSetCenter(center_window)
    local screenW,screenH=guiGetScreenSize()
    local windowW,windowH=guiGetSize(center_window,false)
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2
    guiSetPosition(center_window,x,y,false)
end
 
function togglePanel(Vis)
        if Vis == false then
            guiSetVisible(GS_Window[1],false)
            showCursor(false)
            guiSetInputMode("allow_binds")
        else
            if getAccountName(localPlayer) ~= false then
                guiSetVisible(GS_Window[1],true)
                showCursor(true)
                guiSetInputMode("no_binds_when_editing")
                --
                sortData()
            else
                outputGS("You must be logged in to open the panel !")
            end
        end
end
addEvent("toggleGroupSystemPanel",true)
addEventHandler("toggleGroupSystemPanel",root,togglePanel)
 
function sortData()
    local groupName = getElementData(lp,"Group") or "N/A"
    local groupInvites = getElementData(lp,"GroupInvites") or 0
    if groupName ~= "N/A" then
        local accName = getAccountName(localPlayer)
        local groupLeader = getElementData(lp,"GroupLeader") or false
        if groupLeader == true then
            enable("own-group")
        else
            enable("have-group")
        end
    else
        enable("no-group")
    end
    --
    triggerServerEvent("sendGroupData",lp,lp,groupName)
end
addEvent("sortPanelData",true)
addEventHandler("sortPanelData",root,sortData)
 
function enable(what)
    if what == "own-group" then
        guiSetEnabled(GS_Edit[1],false)
        guiSetEnabled(GS_Button[1],false)
        --
        guiSetEnabled(GS_Button[2],true)
        guiSetEnabled(GS_Button[5],true)
        --
        guiSetEnabled(GS_Button[3],true)
        guiSetEnabled(GS_Button[6],true)
        --
        guiSetEnabled(GS_Button[4],true)
        guiSetEnabled(GS_Button[7],true)
        --
        guiSetEnabled(GS_Button[8],true)
        guiSetEnabled(GS_Button[9],true)
    elseif what == "have-group" then
        guiSetEnabled(GS_Edit[1],false)
        guiSetEnabled(GS_Button[1],false)
        --
        guiSetEnabled(GS_Button[2],true)
        guiSetEnabled(GS_Button[5],true)
        --
        guiSetEnabled(GS_Button[3],true)
        guiSetEnabled(GS_Button[6],true)
        --
        guiSetEnabled(GS_Button[4],true)
        guiSetEnabled(GS_Button[7],true)
        --
        guiSetEnabled(GS_Button[8],false)
        guiSetEnabled(GS_Button[9],false)
    else
        guiSetEnabled(GS_Edit[1],true)
        guiSetEnabled(GS_Button[1],true)
        --
        guiSetEnabled(GS_Button[2],false)
        guiSetEnabled(GS_Button[5],false)
        --
        guiSetEnabled(GS_Button[3],true)
        guiSetEnabled(GS_Button[6],true)
        --
        guiSetEnabled(GS_Button[4],false)
        guiSetEnabled(GS_Button[7],true)
        --
        guiSetEnabled(GS_Button[8],false)
        guiSetEnabled(GS_Button[9],false)
    end
end
 
function getAccountName(p)
    return getElementData(p,"AccountName") or false
end
 
function reciveGroupData(membersTable,info,leader,created,invitesTable)
    gmTable = membersTable or {}
    gInfo = info or ""
    gLeader = leader or ""
    gCreated = created or ""
    giTable = invitesTable or {}
    --
    refreshPanel()
end
addEvent("reciveGroupData",true)
addEventHandler("reciveGroupData",root,reciveGroupData)
 
function refreshPanel()
    gName = getElementData(lp,"Group") or "N/A"
    guiSetText(GS_Label[3],"Group Name: "..gName)
    guiSetText(GS_Label[4],"Group Invites: "..#giTable or 0)
    --
    guiSetText(GS_Edit[1],"")
    --
    if gName ~= "N/A" then
        if gLeader == true then
            enable("own-group")
        else
            enable("have-group")
        end
    end
end
 
 
function onGSClick()
    if ( source == GS_Button[1] ) then
        local gName = guiGetText(GS_Edit[1])
        if gName and gName ~= "" then
            guiSetText(GS_Edit[1],"")
            triggerServerEvent("CreateGroup",lp,lp,gName)
        end
    elseif ( source == GS_Button[5] ) then
        triggerServerEvent("LeaveGroup",lp,lp,gName)
    elseif ( source == GS_Button[6] ) then
        createList("Groups List")   
    elseif ( source == GS_Button[3] ) then
        createList("Group Invites")
    elseif ( source == GS_Button[7] ) then
        togglePanel(not guiGetVisible(GS_Window[1]))
    elseif ( source == GS_Button[2] ) then
        createList("Group Members")
    elseif ( source == GS_Button[8] ) then
        createList("Invite Player",true)
    elseif ( source == GS_Button[4] ) then
        createInfo()
    elseif ( source == GS_Button[9] ) then
        createAdmin()   
    end
end
addEventHandler("onClientGUIClick",root,onGSClick)
 
function createList(what,invite)   
    if GSList_Window then
        if GSList_Window[1] then
            if isElement(GSList_Window[1]) then
                destroyElement(GSList_Window[1])
            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...