Lorder Posted March 2, 2017 Share Posted March 2, 2017 how to add bubble ? chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","LocalChat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","LocalChat") 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("(LocalChat)"..nick..": #ffffff"..msg,v,r,g,b,true) end end end addCommandHandler("LocalChat",onChat) Link to comment
#BrosS Posted March 2, 2017 Share Posted March 2, 2017 "onClientRender" getDistanceBetweenPoints3D getElementPosition getScreenFromWorldPosition dxDrawText dxDrawRectangle Try and i fix Link to comment
Lorder Posted March 2, 2017 Author Share Posted March 2, 2017 "onClientRender" getDistanceBetweenPoints3D getElementPosition getScreenFromWorldPosition dxDrawText dxDrawRectangle chat_range=100 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","LocalChat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","LocalChat") 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("(LocalChat)"..nick..": #ffffff"..msg,v,r,g,b,true) end end end addCommandHandler("LocalChat",onChat) @#BrosS Can you tell me how to do Link to comment
marty000123 Posted March 2, 2017 Share Posted March 2, 2017 How about you try by urself first? Link to comment
_DrXenon Posted March 3, 2017 Share Posted March 3, 2017 You may use one of those useful functions; dxDrawImage3D or dxDrawRectangle3D along with dxDrawText3D (something like that, check useful functions on mta wiki) You can draw the image which can be a bubble or the rectangle first then you can draw the text on the 3d world after drawing the bubble so it will be drawn on the bubble (otherwise it will be behind it) That idea will probably work 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