1LoL1 Posted August 18, 2015 Share Posted August 18, 2015 Hello, anyone can help me with this: if getElementData(getLocalPlayer(), "lang") == "EN" then outputChatBox("#0044FFTEST #FFFFFFTEST "..getPlayerName(player).." #FFFFFFTEST #FF0000["..tostring(amount).."] #FFFFFFTEST TEST test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[TEST] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFTEST #FF0000["..tostring(amount).."] #FFFFFFTEST TEST "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end how i can when i have EN language i see in outputChatBox only EN language and when i have "else" i see only "else" language please help me now its: When i have EN language i see EN outputchatbox but when my friend have "else" he too see EN Link to comment
t3wz Posted August 18, 2015 Share Posted August 18, 2015 function sendMessageWithLang ( message, lang ) for _, v in ipairs ( getElementsByType ( "player" ) ) do -- loop all players if getElementData ( v, "lang" ) == lang then -- check v (player) language, if is equal to lang continue outputChatBox ( message, v, 255, 255, 255, true ) -- output the message end end end sendMessageWithLang ( "Message to en players only", "EN" ) sendMessageWithLang ( "Message to non en players", "-" ) Link to comment
1LoL1 Posted August 18, 2015 Author Share Posted August 18, 2015 function sendMessageWithLang ( message, lang ) for _, v in ipairs ( getElementsByType ( "player" ) ) do -- loop all players if getElementData ( v, "lang" ) == lang then -- check v (player) language, if is equal to lang continue outputChatBox ( message, v, 255, 255, 255, true ) -- output the message end end end sendMessageWithLang ( "Message to en players only", "EN" ) sendMessageWithLang ( "Message to non en players", "-" ) thanks but its hard for me i need fix to my code because my code i have in my all scripts. Link to comment
1LoL1 Posted August 23, 2015 Author Share Posted August 23, 2015 Please can anyone help? i have lang EN and my friend CZ but i see text in EN and my friend too he must see text CZ when have lang CZ if getElementData(player, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..getPlayerName(player).." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end Link to comment
1LoL1 Posted August 23, 2015 Author Share Posted August 23, 2015 Can you show full code function giveSomeoneMoney(player, cmd, target, amount) if target then if amount then local money = getPlayerMoney(player) local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) amount = tonumber(amount) if targetplayer then if not (targetplayer == player) then if money >= amount and amount > 0 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) if getElementData(player, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..getPlayerName(player).." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFIncorrectly entered amount", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFYou cannot Points yourself!", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FF0000Player not found", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end end addCommandHandler("pay", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Link to comment
HUNGRY:3 Posted August 23, 2015 Share Posted August 23, 2015 Can you show full code function giveSomeoneMoney(player, cmd, target, amount) if target then if amount then local money = getPlayerMoney(player) local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) amount = tonumber(amount) if targetplayer then if not (targetplayer == player) then if money >= amount and amount > 0 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) if getElementData(player, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..getPlayerName(player).." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFIncorrectly entered amount", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFYou cannot Points yourself!", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FF0000Player not found", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end end addCommandHandler("pay", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end show code that set the data "en" Link to comment
1LoL1 Posted August 23, 2015 Author Share Posted August 23, 2015 Can you show full code function giveSomeoneMoney(player, cmd, target, amount) if target then if amount then local money = getPlayerMoney(player) local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) amount = tonumber(amount) if targetplayer then if not (targetplayer == player) then if money >= amount and amount > 0 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) if getElementData(player, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..getPlayerName(player).." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFIncorrectly entered amount", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFYou cannot Points yourself!", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FF0000Player not found", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end end addCommandHandler("pay", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end show code that set the data "en" function TEST (button, state) if button == "left" and state == "up" then setElementData(getLocalPlayer(), "lang", "EN") guiSetInputEnabled(false) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) outputChatBox("TEST", 255, 255, 255, true) end end Link to comment
Addlibs Posted August 24, 2015 Share Posted August 24, 2015 Hello, anyone can help me with this: if getElementData(getLocalPlayer(), "lang") == "EN" then outputChatBox("#0044FFTEST #FFFFFFTEST "..getPlayerName(player).." #FFFFFFTEST #FF0000["..tostring(amount).."] #FFFFFFTEST TEST test "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) else outputChatBox("#0044FF[TEST] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFTEST #FF0000["..tostring(amount).."] #FFFFFFTEST TEST "..getPlayerName(targetplayer), getRootElement(), 255, 255, 255, true) end how i can when i have EN language i see in outputChatBox only EN language and when i have "else" i see only "else" language please help me now its: When i have EN language i see EN outputchatbox but when my friend have "else" he too see EN You seem to combine both a clientside function getLocalPlayer and the server side syntax of outputChatBox. Is the code clientside or serverside? Link to comment
1LoL1 Posted August 26, 2015 Author Share Posted August 26, 2015 Post your current code. there is. Link to comment
xeon17 Posted August 26, 2015 Share Posted August 26, 2015 You use getLocalPlayer() at line 1 but the code is server-side. Link to comment
1LoL1 Posted August 26, 2015 Author Share Posted August 26, 2015 You use getLocalPlayer() at line 1 but the code is server-side. and must be client-side?? or what i must use? player localPlayer getLocalPlayer() source or what? Link to comment
KariiiM Posted August 26, 2015 Share Posted August 26, 2015 You use getLocalPlayer() at line 1 but the code is server-side. and must be client-side?? or what i must use? player localPlayer getLocalPlayer() source or what? localPlayer is client sided only also if you say getLocalPlayer() like you said localPlayer because it equal to it and define itself Link to comment
1LoL1 Posted August 27, 2015 Author Share Posted August 27, 2015 not work if getElementData(localPlayer, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFtest "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test test "..getPlayerName(targetplayer), 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..getPlayerName(player).." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..getPlayerName(targetplayer), 255, 255, 255, true) end Link to comment
JR10 Posted August 28, 2015 Share Posted August 28, 2015 Any errors? targetplayer could be false and the conditional statement stops the rest of the code from running. Link to comment
TAPL Posted August 28, 2015 Share Posted August 28, 2015 function giveSomeoneMoney(player, cmd, target, amount) amount = tonumber(amount) if target and amount then local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) -- Not used anywhere if targetplayer then if (targetplayer ~= player) then local money = getPlayerMoney(player) if money >= amount and amount > 0 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) local pName = getPlayerName(player) local tName = getPlayerName(targetplayer) for _, p in ipairs(getElementsByType("player")) do if getElementData(p, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..pName.." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..tName, p, 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..pName.." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..tName, p, 255, 255, 255, true) end end else outputChatBox("#0044FF[PAY] #FFFFFFIncorrectly entered amount", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFYou cannot Points yourself!", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FF0000Player not found", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end end addCommandHandler("pay", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Link to comment
1LoL1 Posted August 28, 2015 Author Share Posted August 28, 2015 function giveSomeoneMoney(player, cmd, target, amount) amount = tonumber(amount) if target and amount then local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) -- Not used anywhere if targetplayer then if (targetplayer ~= player) then local money = getPlayerMoney(player) if money >= amount and amount > 0 then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) local pName = getPlayerName(player) local tName = getPlayerName(targetplayer) for _, p in ipairs(getElementsByType("player")) do if getElementData(p, "lang") == "EN" then outputChatBox("#0044FF[PAY] #FFFFFFPlayer "..pName.." #FFFFFFsent #FF0000["..tostring(amount).."] #FFFFFFPoints to player "..tName, p, 255, 255, 255, true) else outputChatBox("#0044FF[PAY] #FFFFFFTEST "..pName.." #FFFFFFtest #FF0000["..tostring(amount).."] #FFFFFFtest test "..tName, p, 255, 255, 255, true) end end else outputChatBox("#0044FF[PAY] #FFFFFFIncorrectly entered amount", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFYou cannot Points yourself!", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FF0000Player not found", player, 255, 255, 255, true) end else outputChatBox("#0044FF[PAY] #FFFFFFUsage: /pay [Name] [Points]", player, 255, 255, 255, true) end end addCommandHandler("pay", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Thanks work. Link to comment
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