Jump to content

Language Chat - For Command?


papam77

Recommended Posts

Posted

Hello i have made this, but i need for players command /join CountryName

How can do it?

----------------------------- 
-- Language Chat By DeeJay -- 
----------------------------- 
  
function LanguageChat(thePlayer, cmd, ...) 
    local msg = table.concat({...}, " ") 
    for _,players in ipairs(getElementsByType("player")) do 
        local r, g, b = getPlayerNametagColor (thePlayer) 
        local name = getPlayerName(thePlayer) 
        local mycountry = exports.admin:getPlayerCountry(thePlayer) 
        local playerscountry = exports.admin:getPlayerCountry(players) 
        if (playerscountry == mycountry) then 
            if (msg and msg ~= "") then 
            outputChatBox("#FF6464["..mycountry.."]#ffffff "..name..": #FFFFFF"..msg.."",players,r, g, b,true) 
            end 
        end 
    end 
end 
addCommandHandler("Language",LanguageChat) 
  
addEventHandler("onPlayerJoin",root, 
    function () 
        bindKey(source,"L","down","chatbox","Language") 
    end 
) 
  
addEventHandler("onResourceStart",resourceRoot, 
    function () 
        for index, player in ipairs(getElementsByType("player")) do 
            bindKey(player,"L","down","chatbox","Language") 
        end 
    end 
) 

Posted

You'll have to modify that script to use element data or tables, or if he hasn't got any custom language set, to use his default language.

Posted

An example for table

local table = { 
    [1] = 123,4567890, 
    [2] = 0987,654321 
    } 
     
function a() 
for i,v in ipairs (position) do 
if isPlayerDead(source) then 
spawnPlayer(source, math.random([1],[2])) 
end 
end 
end 
addEventHandler("onPlayerWasted", getRootElement(), a) 

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