GTX Posted March 17, 2013 Posted March 17, 2013 Hello, I'd like to rebind the 't' key (/say), but I am having some problems. Here's how far I came: roomName = "Room" addEventHandler("onPlayerJoin", root, function() bindKey(source,"t","down","chatbox",roomName) end ) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() for index, player in pairs(getElementsByType"player") do bindKey(player,"t","down","chatbox",roomName) end end ) function onRoomChat(player,_,...) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = 255, 255, 255 local team = getPlayerTeam(player) if team then r,g,b = getTeamColor(team) end if string.sub(msg, 1, 1) == "/" then executeCommandHandler(string.sub(msg, 2, string.len(msg)), player, msg) return end for _,v in ipairs(getElementsByType("player")) do if getElementData(v, "roomID") == getElementData(player, "roomID") then outputChatBox("#ffffff"..RGBToHex(r, g, b)..nick..": #ffffff"..msg,v,r,g,b,true) end end end addCommandHandler(roomName,onRoomChat) Okay. My problem is: When I'm trying to execute a command (like saying /logout in chatbox) it just doesn't. But it works perfectly on non-hardcored commands. Any idea? Thanks in advance. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Castillo Posted March 17, 2013 Posted March 17, 2013 You can't execute hardcoded commands as far as I know. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Fury Posted March 17, 2013 Posted March 17, 2013 You can't execute hardcoded commands as far as I know. its possible i saw at one server. Destruction Derby
Castillo Posted March 17, 2013 Posted March 17, 2013 It says it on the wiki page: NOTE: You can only execute commands created by Lua. You cannot execute MTA harcoded commands due to security reasons. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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