Jump to content

[SOLVED] bindKey to a command


DRW

Recommended Posts

Posted (edited)
local chat_range = 30 
  
addCommandHandler ("local",function(source,_,...) 
  
    local nick=getPlayerName(source) 
    local msg = table.concat({...}, " ") 
  
 if getPlayerTeam(source) then 
        r,g,b = getTeamColor(getPlayerTeam(source)) 
    else 
        r,g,b = getPlayerNametagColor(source) 
    end 
    if isPedInVehicle(source)then 
        for _,v in ipairs(getVehicleOccupants(getPedOccupiedVehicle(source)))do 
            outputChatBox("(Car Chat) "..nick..": "..msg,v,r,g,b,true) 
        end 
    else 
        local px,py,pz=getElementPosition(source) 
        for _,v in ipairs(getElementsByType("player")) do 
            if isPlayerInRangeOfPoint(v,px,py,pz,chat_range)then 
                outputChatBox("(Local) ".. nick ..": "..msg,v,r,g,b,true) 
            end 
        end 
    end 
end) 
  
function talk2 () 
bindKey (source,"u","down", "chatbox local") 
end --Here is the bindKey 
addEventHandler ("onPlayerLogin", getRootElement(), talk2) 

I'm adding a bind to a command so people can open that chatbox, the chatbox works perfectly if I /bind u chatbox local, but the script does nothing. What can I do?

Edited by Guest

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
bindKey (source,"u","down", "chatbox","local") 
  

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted (edited)
bindKey (source,"u","down", "chatbox","local") 
  

Tried it, still not working

EDIT: Sorry, I forgot to log in again, thanks!

Edited by Guest

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted

EDIT: Sorry, I forgot to log in again, thanks!

np

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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