Jump to content

Problem


manve1

Recommended Posts

I have a problem, when i change my name, it doesn't update the gridlist

function updateList(old, new) 
     if eventName == "onClientPlayerJoin"  then 
          local i = guiGridListAddRow(aGrid) 
          guiGridListSetItemText(aGrid, i, aColumn, getPlayerName(source):gsub("#%x%x%x%x%x%x", ""), false, false) 
     elseif eventName == "onClientPlayerQuit"  then 
          for i=0, guiGridListGetRowCount(aGrid) do 
               if guiGridListGetItemText(aGrid, i, aColumn) == getPlayerName(source):gsub("#%x%x%x%x%x%x", "") then 
                    guiGridListRemoveRow(aGrid, i) 
               end 
          end 
     elseif eventName == "onClientPlayerChangeNick"  then 
          for i=0, guiGridListGetRowCount(aGrid) do 
               if guiGridListGetItemText(aGrid, i, aColumn) == old then 
                    guiGridListSetItemText(aGrid, i, aColumn, new, false, false) 
               end 
          end 
     end 
end 
addEventHandler("onClientPlayerJoin", root, updateList) 
addEventHandler("onClientPlayerQuit", root, updateList) 
addEventHandler("onClientPlayerChangeNick", root, updateList) 

P.S. I didn't make this, i had help from one of members from community ( can't remember who )

Link to comment
Guest Guest4401

I guess line 13 is the problem. Maybe you have colorcodes in your name and you check if your colorcoded matches your name without colorcodes ( which isn't true ).

Link to comment

Replace( 13 )

if guiGridListGetItemText(aGrid, i, aColumn) == old then 

With

if guiGridListGetItemText(aGrid, i, aColumn) == old:gsub("#%x%x%x%x%x%x", "") then 

And replace( 14 line )

guiGridListSetItemText(aGrid, i, aColumn, new, false, false) 

with

guiGridListSetItemText(aGrid, i, aColumn, new:gsub("#%x%x%x%x%x%x", ""), false, false) 

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