Bean666 Posted December 30, 2014 Share Posted December 30, 2014 hi i need help , when a player press T and writes a message , it shows Local , but i dont mean by The BINDS . i just want it as RP when a player press T. it shows say , but if he writes down a message and press enter it shows as local and functions as local. so i can do some commands with it any help appreciated! Link to comment
Mr_Moose Posted December 31, 2014 Share Posted December 31, 2014 Maybe you should start by reading the code line by line to see what it does, and if you don't understand post it here to get help. Link to comment
Bean666 Posted December 31, 2014 Author Share Posted December 31, 2014 brutus here is a script by Cyan , local chat script . i want this as T And if he writes a message and enters it shows local and when chatting i wanna remove the "Local:" and replace to "say:" because i cant do commands with it. i did bind u as t , but i cant do commands with it , is there anyway i can do commands with it? chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","Local") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","Local") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) 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 addCommandHandler("Local",onChat) Link to comment
Mr_Moose Posted December 31, 2014 Share Posted December 31, 2014 You should use the "onPlayerChat" event and call the local chat function from there and then cancel the main chat. Alternatively cancel and unbind "onPlayerChat" and bind the local chat to 'T'. Link to comment
Bean666 Posted December 31, 2014 Author Share Posted December 31, 2014 alright thanks m8 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