FR0314 Posted November 17, 2021 Share Posted November 17, 2021 I'm trying to make a script where you can shout if you want more people to hear what you are saying. The problem is no matter what I say only the first part displays. Like if I try to say: "/s Hey what are you doing?" It comes back as HEY! function shout( source, command, ... ) outputDebugString ( ... , 1) local message = table.concat( {...}, " " ) outputDebugString ( ... , 1) outputChatBox(..., source) local x, y, z = getElementPosition(source) local radius = createColSphere(x, y, z, 100) local nearplayers = getElementsWithinColShape(radius, "player") destroyElement(radius) for _, player in ipairs(nearplayers) do if getElementDimension(player) == getElementDimension(source) then local chatter = pregReplace( getPlayerName(source), '_', ' ' ) outputChatBox(..., player, 255, 255, 255, true) local MESSAGE = string.upper( ... ) outputChatBox(chatter..' ordítja: '..MESSAGE, player, 255, 255, 255, true) end end end addCommandHandler ( "s", shout) What could be the problem? Link to comment
FR0314 Posted November 17, 2021 Author Share Posted November 17, 2021 I've figured it out, help is no longer needed Link to comment
The_GTA Posted November 17, 2021 Share Posted November 17, 2021 Hello FR0314, how about you try changing... ... local message = table.concat( {...}, " " ) outputDebugString ( ... , 1) ... to... ... local message = table.concat( {...}, " " ) outputDebugString ( message , 1) ... Even if help is no longer needed, it will help other people. Link to comment
FR0314 Posted November 20, 2021 Author Share Posted November 20, 2021 The debugstring was just for me to check where is the problem. I took all of the out of the code. But thanks for the recommendation! Link to comment
The_GTA Posted November 20, 2021 Share Posted November 20, 2021 3 hours ago, FR0314 said: The debugstring was just for me to check where is the problem. I took all of the out of the code. But thanks for the recommendation! You took out the call to outputChatBox aswell? My hint was mainly related to that function call as it relates to your inquiry. Thus the dots have to be replaced by the "message" variable too. Link to comment
FR0314 Posted November 20, 2021 Author Share Posted November 20, 2021 addCommandHandler ( "s", function(source, cmd, ...) local message = table.concat({ ... }, " ") local x, y, z = getElementPosition(source) local radius = createColSphere(x, y, z, 100) local nearplayers = getElementsWithinColShape(radius, "player") destroyElement(radius) for _, player in ipairs(nearplayers) do if getElementDimension(player) == getElementDimension(source) then local chatter = pregReplace( getPlayerName(source), '_', ' ' ) or '#cf7ee6[FroMTA - Admin] #db5151'..getPlayerName(source) local MESSAGE = string.upper(message) outputChatBox(chatter..' ordítja: '..MESSAGE, player, 255, 255, 255, true) end end end) This is my new code; I only changed ... to message in string upper. This code works just as I expect it, thanks for the help! 1 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