Jump to content

access for team only


5150

Recommended Posts

how can i make this panel openable by ONLY #000000Psycho Ma#990000ns Gang members? right now its allowed for all players but i want a panel that will allow my members to change skins without having to ask an admin

local SkinTable = { -- skin number, price 
{10,1000},{11,1500}, 
{12,1300},{13,2000}, 
{14,3000},{15,2000}, 
{16,2350},{17,3000}, 
{18,3500} 
} 
  
GUIEditor = { 
    staticimage = {}, 
    button = {}, 
    window = {}, 
    scrollbar = {}, 
    gridlist = {} 
} 
  
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
    JanelaPainel = guiCreateWindow(0.45, 0.26, 0.53, 0.55, "by  manawydan", true) 
    guiWindowSetSizable(JanelaPainel, false) 
    guiSetVisible(JanelaPainel,false) 
    GUIEditor.gridlist[1] = guiCreateGridList(25, 48, 150, 271, false, JanelaPainel) 
    GUIEditor.button[1] = guiCreateButton(245, 287, 76, 27, "Buy", false, JanelaPainel) 
    GUIEditor.button[2] = guiCreateButton(339, 287, 76, 27, "Cancel", false, JanelaPainel) 
    GUIEditor.staticimage[1] = guiCreateStaticImage(240, 77, 169, 128, "image.png", false, JanelaPainel) 
    GUIEditor.scrollbar[1] = guiCreateScrollBar(173, 47, 12, 272, false, false, JanelaPainel)   
    guiGridListSetSelectionMode(GUIEditor.gridlist[1],0) 
    skinColumn = guiGridListAddColumn(GUIEditor.gridlist[1],"Skin",0.5) 
    costColumn = guiGridListAddColumn(GUIEditor.gridlist[1],"$",0.3) 
    addEventHandler ("onClientGUIClick", guiRoot, onClientGUIClick) 
    setTimer(lolad,800,1) 
    
    addEvent("OpenSkinPanel",true) 
    addEventHandler("OpenSkinPanel",root,OpenSkinPanel) 
    bindKey("F2","down",OpenSkinPanel) 
    end 
) 
  
function onClientGUIClick (button, state, absoluteX, absoluteYe) 
  if (source == GUIEditor.button[1]) then guiSetVisible (JanelaPainel, false) showCursor (false) 
    if (guiGridListGetSelectedItem (GUIEditor.gridlist[1])) then 
      local skinName = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 1) 
      local skinCost = guiGridListGetItemText (GUIEditor.gridlist[1], guiGridListGetSelectedItem (GUIEditor.gridlist[1]), 2) 
      triggerServerEvent ("onBuySkin", getLocalPlayer(), skinName, skinCost) 
    end 
  elseif (source == GUIEditor.button[2]) then 
  guiSetVisible (JanelaPainel, false) 
  showCursor (false) 
  end 
end 
  
  
function OpenSkinPanel() 
guiSetVisible(JanelaPainel,not guiGetVisible(JanelaPainel)) 
showCursor(not isCursorShowing()) 
end 
  
function lolad() 
for i,v in ipairs (SkinTable) do 
    local skinName = tostring((v[1])) 
    local row = guiGridListAddRow (GUIEditor.gridlist[1]) 
    guiGridListSetItemText (GUIEditor.gridlist[1], row, 1, skinName, false, true) 
    guiGridListSetItemText (GUIEditor.gridlist[1], row, 2, tostring(v[2]), false, true) 
end 
end 

Link to comment
function OpenSkinPanel() 
    local team = "#000000Psycho Ma#990000ns" --Team Name 
    if getPlayerTeam(localPlayer) == getTeamFromName(team) then -- Lets see if the player is in the team 
        guiSetVisible(JanelaPainel,not guiGetVisible(JanelaPainel)) 
        showCursor(not isCursorShowing()) 
    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...