Jump to content

getAccountName and getPlayerName


Chaz-CR

Recommended Posts

Hello, i was making a gridlist where i can see the player nicknames but when i trigger the function i receive the accountName and i dont know how to change it to the PlayerName!

There are the codes:

function getPlayerKillsInOrder() 
 theTable = {} 
 for i, acc in ipairs(getAccounts()) do 
  local name = getAccountName(acc) 
  local kills = getAccountData(acc, "Kills") or 0 
  table.insert(theTable, {kills, name}) 
  end 
------not necessary 

the Trigger:

addEvent("refreshList", true) 
addEventHandler("refreshList", root, 
function() 
    triggerClientEvent(source, "onRequestRefresh", source, getPlayerKillsInOrder()) 
    theTable = nil 
end) 

Link to comment
  
function getPlayerKillsInOrder() 
 theTable = {} 
 for i, acc in ipairs(getAccounts()) do 
  local name = getAccountName(acc) 
  local player = getAccountPlayer(acc) 
  if player then playerName = getPlayerName(player) end 
  local kills = getAccountData(acc, "Kills") or 0 
  table.insert(theTable, {kills, playerName}) 
  end 
  

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