Jump to content

language command chat for gui


No4NaMe

Recommended Posts

tell me how to make it so that in this script when choosing a language, he switched to the language in my fashion which is built in by the function ?

Script lang:

-----------------------------------------------------------------------------
-- =x=|DoN|=x= ( 7eJAzZy )
-- Date: 2014/2015
-- Skype: DON.81
-- Please don't remove my rights
-----------------------------------------------------------------------------
local LanguageTableList = {
{"Arabic"},
{"English"},
{"Spanish"},
{"Mandarin"},
{"Hindi"},
{"Portuguese"},
{"Bengali"},
{"Russian"},
{"Japanese"},
{"Punjabi"},
{"Germany"},
{"Javanese"},
{"Wu"},
{"Malay"},
{"Indonesian"},
{"Telugu"},
{"Vietnamese"},
{"Korean"},
{"French"},
{"Marathi"},
{"Tamil"},
{"Urdu"},
{"Turkish"},
{"Italian"},
{"Yue"},
{"Thai"},
{"Gujarati"},
{"Jin"},
{"Southern Min"},
{"Persian"},
{"Polish"},
{"Pashto"},
{"Kannada"},
{"Xiang"},
{"Malayalam"},
{"Sundanese"},
{"Hausa"},
{"Odia"},
{"Burmese"},
{"Hakka"},
{"Ukrainian"},
{"Bhojpuri"},
{"Tagalog"},
{"Yoruba"},
{"Maithili"},
{"Uzbek"},
{"Sindhi"},
{"Amharic"},
{"Fula"},
{"Romanian"},
{"Oromo"},
{"Igbo"},
{"Azerbaijani"},
{"Awadhi"},
{"Gan Chinese"},
{"Cebuano"},
{"Dutch"},
{"Kurdish"},
{"Serbo Croatian"},
{"Malagasy"},
{"Saraiki"},
{"Nepali"},
{"Sinhalese"},
{"Chittagonian"},
{"Zhuang"},
{"Khmer"},
{"Turkmen"},
{"Assamese"},
{"Madurese"},
{"Somali"},
{"Marwari"},
{"Magahi"},
{"Haryanvi"},
{"Hungarian"},
{"Chhattisgarhi"},
{"Greek"},
{"Chewa"},
{"Deccan"},
{"Akan"},
{"Kazakh"},
{"Northern Min"},
{"Sylheti"},
{"Zulu"},
{"Czech"},
{"Kinyarwanda"},
{"Dhundhari"},
{"Haitian Creole"},
{"Eastern Min"},
{"Ilocano"},
{"Quechua"},
{"Kirundi"},
{"Swedish"},
{"Hmong"},
{"Shona"},
{"Uyghur"},
{"Hiligaynon"},
{"Mossi"},
{"Xhosa"},
{"Belarusian"},
{"Balochi"},
{"Konkani"}
}


WindowLanguage = guiCreateWindow(0.36, 0.16, 0.31, 0.68, "Languages Script", true)
guiSetVisible ( WindowLanguage, false )
GridlistLanguage = guiCreateGridList(0.04, 0.06, 0.92, 0.69, true, WindowLanguage)
guiGridListAddColumn(GridlistLanguage, "Languages List", 0.9)
for i,v in ipairs ( LanguageTableList ) do
	local Row = guiGridListAddRow( GridlistLanguage )
   guiGridListSetItemText( GridlistLanguage, Row, 1, v[1], false, false )
end	

setNewLanguage = guiCreateButton(0.04, 0.77, 0.92, 0.09, "Set new Language", true, WindowLanguage)
Close = guiCreateButton(0.04, 0.88, 0.92, 0.09, "Close", true, WindowLanguage)


addEventHandler("onClientGUIClick",resourceRoot,
function ( )
local row, col = guiGridListGetSelectedItem ( GridlistLanguage ) 
local Group = guiGridListGetItemText(GridlistLanguage,row,1 )
	if source == setNewLanguage then
		if ( row and col and row ~= -1 and col ~= -1 ) then
			setElementData(localPlayer,"Language",Group,true)
			outputChatBox("Your new Language chat is "..getElementData(localPlayer,"Language").."",0,255,0)
			triggerServerEvent ( "setNewLanguageBindKey",resourceRoot )
		else
			outputChatBox("Please choose a langauge",255,0,0)
		end
	elseif source == Close then
		guiSetVisible( WindowLanguage , not guiGetVisible(WindowLanguage))
		showCursor(guiGetVisible(WindowLanguage))
	end
end )

function OpenWindow(  )
   guiSetVisible( WindowLanguage , not guiGetVisible(WindowLanguage))
   showCursor(guiGetVisible(WindowLanguage))
end
bindKey("F3","down",OpenWindow)
addCommandHandler("language",OpenWindow)

 

My function gamemode command chat language

languageCode = getLocalization()["code"]

function checkTheLanguage()
	if languageCode == "en_US" then
		languageCode = "en_US"
	elseif languageCode == "de" then
		languageCode = "de"
	elseif languageCode == "cs" then
		languageCode = "cs"
	elseif languageCode == "nl" then
		languageCode = "nl"
	elseif languageCode == "pt_BR" then
		languageCode = "pt_BR"
	elseif languageCode == "zh" then
		languageCode = "zh"
	elseif languageCode == "es" then
		languageCode = "es"
	elseif languageCode == "fr" then
		languageCode = "fr"
	elseif languageCode == "ro" then
		languageCode = "ro"
	elseif languageCode == "pl" then
		languageCode = "pl"
	else
		languageCode = "en_US"
	end
end
addEventHandler("onClientResourceStart",root,checkTheLanguage)

local languageTable = {
{"en","en_US"},
{"de","de"},
{"cs","cs"},
{"nl","nl"},
{"br","pt_BR"},
{"zh","zh"},
{"es","es"},
{"fr","fr"},
{"ro","ro"},
{"pl","pl"},
}

function changeLanguageOnCommand(playerSource,language)
	if language then
		for i, lang in ipairs(languageTable) do
			if language == lang[1] then
				languageCode = lang[2]
				outputChatBox("New language: "..tostring(languageCode),0,255,0)
			end
		end
	else
		outputChatBox("Please specify a language. Possible values: en, de, cs, nl, br, zh, es, fr, ro, pl.",255,0,0)
	end
end
addCommandHandler("language",changeLanguageOnCommand)

I want to transfer my language system to a graphical

Edited by No4NaMe
Link to comment
  • 2 weeks later...

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