Hugos Posted August 12, 2019 Share Posted August 12, 2019 I have a "/do" team, want to make still "/todo". It works approximately so: function doChat(player, cmd, ...) if ... then local message = table.concat({...}, "") for i, v in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(player) local xt, yt, zt = getElementPosition(v) if getDistanceBetweenPoints3D(x, y, z, xt, yt, zt) <= 10 then outputChatBox("" ..message.. " (" ..getPlayerName(player).. ")", v, 194, 162, 218, true) end end end end addEventHandler("CommmandHandler", getRootElement(), doChat) addCommandHandler("do", doChat) The player writes the message: todo text1*text2 As a result to the player such message is displayed: nickname text1 - told text2 How to me to replace "*" with the text necessary to me? Link to comment
Tommy. Posted August 12, 2019 Share Posted August 12, 2019 (edited) I do not understand what you are trying to do, could you explain better? function doChat(player, command, ...) if ... then local message = table.concat({...}, "") for i, v in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(player) local xt, yt, zt = getElementPosition(v) if getDistanceBetweenPoints3D(x, y, z, xt, yt, zt) <= 10 then outputChatBox(string.gsub(message, "*", " - ").." (" ..getPlayerName(player).. ")", v, 194, 162, 218, true) end end end end addEventHandler("CommmandHandler", getRootElement(), doChat) addCommandHandler("do", doChat) I did what I understood. replace "*" with " - " Edited August 12, 2019 by Tommy. 1 Link to comment
Hugos Posted August 13, 2019 Author Share Posted August 13, 2019 7 hours ago, Tommy. said: I do not understand what you are trying to do, could you explain better? function doChat(player, command, ...) if ... then local message = table.concat({...}, "") for i, v in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(player) local xt, yt, zt = getElementPosition(v) if getDistanceBetweenPoints3D(x, y, z, xt, yt, zt) <= 10 then outputChatBox(string.gsub(message, "*", " - ").." (" ..getPlayerName(player).. ")", v, 194, 162, 218, true) end end end end addEventHandler("CommmandHandler", getRootElement(), doChat) addCommandHandler("do", doChat) I did what I understood. replace "*" with " - " Yes is that I wanted. And whether it is possible to make still color to "*" and after "*" a miscellaneous? Link to comment
Hugos Posted August 13, 2019 Author Share Posted August 13, 2019 (edited) I want to make here so: /todo Text * RP player's. Edited August 13, 2019 by Hugos Link to comment
Hugos Posted August 13, 2019 Author Share Posted August 13, 2019 + edit 9 line outputChatBox("«" ..string.gsub(message, "*", " - ").. "»#C2A2DA, - told " ..getPlayerName(player).. ", ", v, 200, 200, 200, true) 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