Jump to content
  • 0

[HELP PLEASE]


Aqua22

Question

Hi! I wanted to create a broadcast script and i've got this error:

attempt to concatenate local 'msg' (a userdata value)

server.lua

function ad (msg)
    outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)

 

and i don't know what the problem is.

 

Sorry the link for scripting subforum is doesn't works for me.

Link to comment

2 answers to this question

Recommended Posts

  • 0

That's an easy fix. You don't have to concatenate the end of the string if it's not followed by anything.

 

function ad (msg)
    outputChatBox ( "#fbe0ff[Hiradó]: " .. msg, getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)

This will work. 

 

If you want to continue the string after msg, here's how it would look:

function ad (msg)
    outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. " and yeah", getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)

 

Link to comment
  • 0
28 minutes ago, keymetaphore said:

That's an easy fix. You don't have to concatenate the end of the string if it's not followed by anything.

 


function ad (msg)
    outputChatBox ( "#fbe0ff[Hiradó]: " .. msg, getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)

This will work. 

 

If you want to continue the string after msg, here's how it would look:


function ad (msg)
    outputChatBox ( "#fbe0ff[Hiradó]: " .. msg .. " and yeah", getRootElement(), 255, 255, 255, true )
end
addCommandHandler ("hirado", ad)

 

Thansk very much!

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...