Jump to content

Little help needed


isa_Khamdan

Recommended Posts

Hello ,

I have a GUI Grid list and I want to load player names in it okay so this code works but there is one problem with it :S

The names get duplicates for example a player Names " King " his name will show in Grid list two Times like this

King

King

So can anyone tell me how to fix this? else I want to make it refresh every few minutes if it's possible

Thanks.

clientsideResourceStart = function() 
  if column then 
    for id,playeritem in ipairs(getElementsByType("player")) do 
      local row = guiGridListAddRow(GUIEditor_Grid[1]) 
      guiGridListSetItemText(GUIEditor_Grid[1], row, column, getPlayerName(playeritem), false, false) 
    end 
  end 
end 
addEventHandler("onClientResourceStart", getRootElement(), clientsideResourceStart) 

Link to comment
Hello ,

I have a GUI Grid list and I want to load player names in it okay so this code works but there is one problem with it :S

The names get duplicates for example a player Names " King " his name will show in Grid list two Times like this

King

King

So can anyone tell me how to fix this? else I want to make it refresh every few minutes if it's possible

Thanks.

clientsideResourceStart = function() 
  if column then 
    for id,playeritem in ipairs(getElementsByType("player")) do 
      local row = guiGridListAddRow(GUIEditor_Grid[1]) 
      guiGridListSetItemText(GUIEditor_Grid[1], row, column, getPlayerName(playeritem), false, false) 
    end 
  end 
end 
addEventHandler("onClientResourceStart", getRootElement(), clientsideResourceStart) 

complete codig!

Link to comment
Hello ,

I have a GUI Grid list and I want to load player names in it okay so this code works but there is one problem with it :S

The names get duplicates for example a player Names " King " his name will show in Grid list two Times like this

King

King

So can anyone tell me how to fix this? else I want to make it refresh every few minutes if it's possible

Thanks.

clientsideResourceStart = function() 
  if column then 
    for id,playeritem in ipairs(getElementsByType("player")) do 
      local row = guiGridListAddRow(GUIEditor_Grid[1]) 
      guiGridListSetItemText(GUIEditor_Grid[1], row, column, getPlayerName(playeritem), false, false) 
    end 
  end 
end 
addEventHandler("onClientResourceStart", getRootElement(), clientsideResourceStart) 

complete codig!

Rest of the code doesn't have anything about the Grid list and here is the window and the grid list

GUIEditor_Window[1] = guiCreateWindow(355, 104, 227, 457, "Transfer Money", false) 
guiWindowSetSizable(GUIEditor_Window[1], false) 
guiSetProperty(GUIEditor_Window[1], "CaptionColour", "FFFF0000") 
GUIEditor_Grid[1] = guiCreateGridList(9, 71, 208, 243, false, GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1], 2) 
column = guiGridListAddColumn(GUIEditor_Grid[1], "Player List", 1) 

Link to comment
addEventHandler("onClientResourceStart", getRootElement(), clientsideResourceStart) 

Change that, to this:

addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) 

If you leave it on getRootElement, then it'll trigger the function everytime a resource is started.

Link to comment
addEventHandler("onClientResourceStart", getRootElement(), clientsideResourceStart) 

Change that, to this:

addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart ) 

If you leave it on getRootElement, then it'll trigger the function everytime a resource is started.

Thanks a lot :)

Else : Can you view my thread that I posted before about jail system , You helped me to fix the timer but I am still stuck with the text and it's been long and I still didn't figure out how to do it so can you please help me to fix it :S

Link to comment

Is this right?

function Refresh () 
  guiGridListClear ( GUIEditor_Grid[1] ) 
  if column then 
    for id,playeritem in ipairs(getElementsByType("player")) do 
      local row = guiGridListAddRow(GUIEditor_Grid[1]) 
      guiGridListSetItemText(GUIEditor_Grid[1], row, column, getPlayerName(playeritem), false, false) 
    end 
  end 
end 
addEventHandler ( "onClientPlayerJoin", getRootElement(), Refresh ) 
addEventHandler ( "onClientPlayerQuit", getRootElement(), Refresh ) 
addEventHandler ( "onClientPlayerChangeNick", getRootElement(), Refresh ) 

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...