Jump to content

[Help] GridList Show one player -.-


HunT

Recommended Posts

i Look in "C-panel By Castillo" For Example gridList :oops: And in my local host work. But in server show one player :| (show only the name from last player enter in server :roll: )

WHY??

clientSide Part :

driversList = guiCreateGridList(28,85,146,149,false,bigWindow) 
        local column = guiGridListAddColumn(driversList, "Drivers", 0.85) 
        local row = guiGridListAddRow ( driversList ) 
        if (column) then 
            for id, playeritem in ipairs(getElementsByType("player")) do 
        guiGridListSetItemText(driversList, row, column, getPlayerName(playeritem), false, false) 
         
            end 
        end 
        guiGridListSetItemColor ( driversList,  row,  column, 255, 150, 0 ) 
        guiGridListSetScrollBars ( driversList, true, true ) 

And in "onClientGUIClick" :

if (source == botton1) then 
    selectedPlayer = guiGridListGetItemText ( driversList, guiGridListGetSelectedItem (driversList), 1 ) 
    if ( guiGridListGetSelectedItem ( driversList ) ~= -1 ) then 
           triggerServerEvent ("pushim", getLocalPlayer()) 
           else 
        outputChatBox("No user selected -.-'", nil , 255, 0, 0, false) 
        end 

Idk . . . help please.

Link to comment

You are not adding any rows.

You are just setting the text.

driversList = guiCreateGridList(28,85,146,149,false,bigWindow) 
        local column = guiGridListAddColumn(driversList, "Drivers", 0.85) 
        if (column) then 
            for id, playeritem in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow ( driversList ) 
        guiGridListSetItemText(driversList, row, column, getPlayerName(playeritem), false, false) 
        
            end 
        end 
        guiGridListSetItemColor ( driversList,  row,  column, 255, 150, 0 ) 
        guiGridListSetScrollBars ( driversList, true, true ) 

And if you are updating later use, guiGridListClear it will clear all rows.

Link to comment

guiGridListClear clears (deletes) all the rows in the grid list.

So it won't magically update the grid list alone.

You must loop through it again, which is not necessary.

Just onClientResourceStart, loop through players, and add them.

And onJoin, add him.

onQuit you can use this function:

function guiGridListRemoveRowByName ( gridlist , column , name ) 
for index = 1 , guiGridListGetRowCount ( gridlist ) do 
if guiGridListGetItemText ( gridlist , index , column ) == name then 
guiGridListRemoveRow ( gridlist , index ) 
break 
end 
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...