FlyingSpoon Posted February 17, 2017 Share Posted February 17, 2017 I've got this script, I've edited the main chat, but commands dont work anymore, like ./reconnect ./disconnect ./quit etc, How can I enable them again? When I type, it just outputs the message e.g. RayZ says: /reconnect addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"t","down","chatbox","Say") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"t","down","chatbox","Say") end end) function sayChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local players = getPlayerName(player) nick = tostring ( players ):gsub( "_", " " ); for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) and isPedInVehicle ( player ) then outputChatBox("[Vehicle] "..nick.." says: "..msg,v,255,255,255,true) elseif isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox(""..nick.." says: "..msg,v,255,255,255,true) end end outputServerLog("[Local]: "..nick.." says: ".. msg) end addCommandHandler("Say", sayChat) Link to comment
Infinity# Posted February 17, 2017 Share Posted February 17, 2017 You can't enable commands on custom chats. You'll have to do it separately. Since you made a custom chat box, it won't work. As far as I know, "/" commands only work using "T." Link to comment
nikitafloy Posted February 17, 2017 Share Posted February 17, 2017 U can use trigger with this command, i think https://wiki.multitheftauto.com/wiki/Server_Commands#aexec Link to comment
Guest Guest4401 Posted February 18, 2017 Share Posted February 18, 2017 (edited) You can use onPlayerChat cancelEvent instead. This way you only cancel normal messages and manually output whatever you wish. Try: addEventHandler('onPlayerChat',root, function(msg,mt) if mt == 0 then cancelEvent() local px,py,pz=getElementPosition(source) local players = getPlayerName(source) nick = tostring ( players ):gsub( "_", " " ); for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) and isPedInVehicle ( source ) then outputChatBox("[Vehicle] "..nick.." says: "..msg,v,255,255,255,true) elseif isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox(""..nick.." says: "..msg,v,255,255,255,true) end end outputServerLog("[Local]: "..nick.." says: ".. msg) end end ) Edited February 18, 2017 by Guest4401 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