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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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) 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

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