DuFraN Posted April 26, 2014 Posted April 26, 2014 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.
Karuzo Posted April 26, 2014 Posted April 26, 2014 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
Gallardo9944 Posted April 26, 2014 Posted April 26, 2014 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)
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