guiGridListGetRowCount | Multi Theft Auto: Wiki Skip to content

guiGridListGetRowCount

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function returns the number of rows in a grid list.

Syntax

guiGridListGetRowCount ( )

Code Examples

client

This example creates a gui grid list, fills it with the names of the connected players and prints the number of rows (players) in the chatbox.

function onClientResourceStart ()
-- Create the grid list element
local playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true )
-- Create a players column in the list
local column = guiGridListAddColumn( playerList, "Player", 0.85 )
if ( column ) then -- If the column was successfully created
--Loop through adding players to the grid list
for id, playeritem in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow ( playerList )
guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false )
end
outputChatBox ( "Number of player list rows: " .. guiGridListGetRowCount ( playerList ) )
end
end
addEventHandler ( "onClientResourceStart", resourceRoot, onClientResourceStart )

See Also

GUI Functions