jkub Posted January 29, 2010 Posted January 29, 2010 I am currently working on a resource which will allow a ranked admin/mod system with input via commands and a compact gui. I am trying to use a gridlist for displaying the players names and their IPs. I can go through every player but names overwrite other names and things are being written to the wrong row in the gridlist. I see how all my gridlist rows may be named the same and I have made a table but I don't know how to specify them in a unique fashion. Please help function insertInfo() for k, v in pairs ( getElementsByType ( "player" ) ) do rowCount = rowCount + 1 rows[rowCount] = {} rows[rowCount].row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, rows[rowCount].row, playerColumn, getPlayerName(v), false, false ) triggerServerEvent ( "requestIP", getLocalPlayer(), getLocalPlayer() ) end end function playerJoinHandler ( joinedPlayersName ) rowCount = rowCount + 1 rows[rowCount].row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, rows[rowCount].row, playerColumn, joinedPlayersName, false, false ) triggerServerEvent ( "requestIP", getLocalPlayer(), getLocalPlayer() ) end function fillInIP ( requestingPlayer, IP ) guiGridListSetItemText ( playerList, rows[rowCount].row, IPColumn, IP, false, false ) end function playerChangedNickHandler ( changingPlayer, newNick ) guiGridListSetItemText ( playerList, rows[rowCount].row, playerColumn, newNick, false, false ) end
robhol Posted January 30, 2010 Posted January 30, 2010 You're always writing to the most recent rowcount, no mystery here. You need to somehow figure out how to get a player's row number. You could either store it, or loop through the list and compare player names, to get it. Do NOT PM ME for help unless invited. - New MTA Script Editor Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now