Jump to content

Script ( simple admin/mod )


jkub

Recommended Posts

Posted

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

Posted

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.

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