Jump to content

getAccountData


DuFraN

Recommended Posts

Hi guys, i have a problem, I like to show it only to players with getAccountData(account,"Language",1), how can I do this?

function onChat(player,_,...) 
  local msg = table.concat({...}," ") 
  local nick = getPlayerName(player) 
  local account = getPlayerAccount(player) 
  local Language = getAccountData(account,"Language") 
  
    if Language == 1 then 
      outputChatBox("[spanish]"..nick..": #ffffff"..msg,player,255,255,255,true) -- only to players with getAccountData(account,"Language",1) 
     
    end 
  
end 
addCommandHandler("Language",onChat) 

Regards, DuFraN.

Link to comment
  
    function onChat(player,_,...) 
      local msg = table.concat({...}," ") 
      local nick = getPlayerName(player) 
      --[[[local account = getPlayerAccount(player) 
      local Language = getAccountData(account,"Language")--]] 
      local lang = getElementData(player,"Language") 
      
        if lang == 1 then 
          outputChatBox("[spanish]"..nick..": #ffffff"..msg,player,255,255,255,true) -- only to players with getAccountData(account,"Language",1) 
        
        end 
      
    end 
    addCommandHandler("Language",onChat) 
     
     
    --just set the elementdata somewhere , like in the login for example. 
    function Login() 
        setElementData(player,"Language",1) 
    end 

Link to comment

Unstested anyway.

function onChat(player,_,...) 
  local msg = table.concat({...}," ") 
  local nick = getPlayerName(player) 
  local account = getPlayerAccount(player) 
  local language = getAccountData(account,"Language") 
  if not (language == 1) then return end 
  for i,v in ipairs(getElementsByType("player")) do 
    local vacc = getPlayerAccount(v) 
    if not isGuestAccount(vacc) then 
      local lang = getAccountData(vacc,"Language") 
      if lang == 1 then 
    outputChatBox("[spanish]"..nick..": #ffffff"..msg,v,255,255,255,true) 
      end 
    end 
  end 
end 
addCommandHandler("Language",onChat) 

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