Jump to content

[resolved] Why not working playerlist (gridlist) ?


Turbesz

Recommended Posts

doesn't show players, but gridlist is fine

code:

   bb = guiCreateButton(658, 33, 172, 22, "Privát beszélgetés", false)  
guiSetVisible(bb,true) 
  
local GUIEditor = { 
    button = {}, 
    window = {}, 
    gridlist = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(405, 62, 682, 451, "privát beszélgetés by turbesz", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
GUIEditor.button[1] = guiCreateButton(646, 20, 26, 26, "X", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
  
  
    grdPlayers = guiCreateGridList(0.0991,0.2449,0.8108,0.6968, true, GUIEditor.window[1]) 
  
        colPlayers = guiGridListAddColumn(grdPlayers, "Játékosok", 0.85) 
  
    local players = getElementsByType("player") 
    for k,v in ipairs(players) do 
        addPlayerToList(v) 
    end 
  
  
  
guiSetVisible(GUIEditor.window[1],false) 
  
  
addEventHandler("onClientGUIClick",root, 
function () 
  
if source == bb then 
  
guiSetVisible(GUIEditor.window[1],true) 
    showCursor ( true )   
  
end 
  
end 
  
) 
  
function Bezaras() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], Bezaras) 

Edited by Guest
Link to comment

10a156c51f.png

There is no function called addPlayerToList() in your code , try this

function addPlayersToGridlist() 
    guiGridListClear(grdPlayers) 
    local players = getElementsByType("player") 
    for index, player in pairs(players) do  
        local row = guiGridListAddRow(grdPlayers) 
        local name = getPlayerName(player) 
        guiGridListSetItemText(grdPlayers, row,1, name, false, false) 
    end 
end 

Link to comment
10a156c51f.png

There is no function called addPlayerToList() in your code , try this

function addPlayersToGridlist() 
    guiGridListClear(grdPlayers) 
    local players = getElementsByType("player") 
    for index, player in pairs(players) do  
        local row = guiGridListAddRow(grdPlayers) 
        local name = getPlayerName(player) 
        guiGridListSetItemText(grdPlayers, row,1, name, false, false) 
    end 
end 

doesn't working :(

Link to comment
doesn't working :(

I think you don't know how to use it , try to do it by yourself then post your code here.

  bb = guiCreateButton(658, 33, 172, 22, "Privát beszélgetés", false) 
guiSetVisible(bb,true) 
  
local GUIEditor = { 
    button = {}, 
    window = {}, 
    gridlist = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(405, 62, 682, 451, "privát beszélgetés by turbesz", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
GUIEditor.button[1] = guiCreateButton(646, 20, 26, 26, "X", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
  
  
grdPlayers = guiCreateGridList(0.0991,0.2449,0.8108,0.6968, true, GUIEditor.window[1]) 
colPlayers = guiGridListAddColumn(grdPlayers, "Játékosok", 0.85) 
  
    local players = getElementsByType("player") 
    for k,v in ipairs(players) do 
        addPlayerToList(v) 
    end 
     
function addPlayersToGridlist() 
    guiGridListClear(grdPlayers) 
    local players = getElementsByType("player") 
    for index, player in pairs(players) do 
        local row = guiGridListAddRow(grdPlayers) 
        local name = getPlayerName(player) 
        guiGridListSetItemText(grdPlayers, row,1, name, false, false) 
        end 
    end 
  
  
guiSetVisible(GUIEditor.window[1],false) 
  
  
addEventHandler("onClientGUIClick",root, 
function () 
  
if source == bb then 
  
guiSetVisible(GUIEditor.window[1],true) 
    showCursor ( true )   
  
end 
  
end 
  
) 
  
function Bezaras() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor ( false ) 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], Bezaras) 

Link to comment
o.O

:3

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        yourGui = guiCreateWindow(405, 62, 682, 451, "privát beszélgetés by turbesz", false) 
        guiWindowSetSizable(yourGui, false) 
        close = guiCreateButton(646, 20, 26, 26, "X", false, yourGui) 
        guiSetProperty(close, "NormalTextColour", "FFFF0000") 
        bb = guiCreateButton(658, 33, 172, 22, "Privát beszélgetés", false) 
        guiSetVisible(bb,true) 
        grdPlayers = guiCreateGridList(0.0991,0.2449,0.8108,0.6968, true, yourGui) 
        colPlayers = guiGridListAddColumn(grdPlayers, "Játékosok", 0.85) 
        guiSetVisible(yourGui,false) 
         
        -- events 
        addEventHandler("onClientGUIClick",bb,clickButtonBB,false) 
        addEventHandler ( "onClientGUIClick", close, Bezaras,false) 
    end  
) 
  
  
-- add all players to your gridlist 
function addPlayersToGridlist() 
    guiGridListClear(grdPlayers) 
    local players = getElementsByType("player") 
    for index, player in pairs(players) do 
        local row = guiGridListAddRow(grdPlayers) 
        local name = getPlayerName(player) 
        guiGridListSetItemText(grdPlayers, row,1, name, false, false) 
    end 
end 
  
  
-- open the Gui when the player click bb button 
function clickButtonBB() 
    if not guiGetVisible (yourGui) then  
        guiSetVisible(yourGui,true) 
        showCursor(true) 
        addPlayersToGridlist() 
    else 
        guiSetVisible(yourGui,false) 
        showCursor(false) 
    end  
end 
  
-- close the gui when the player click the close button 
function Bezaras() 
    if guiGetVisible (yourGui) then  
        guiSetVisible(yourGui, false) 
        showCursor ( 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...