General > Developers Corner

Not sure why ULib.tsayColor is not working.

<< < (2/2)

StaTiiKxKALEB:

--- Quote from: iViscosity on May 15, 2016, 08:15:23 PM ---I see. What do you mean by "not working", though? What errors are you getting?

--- End quote ---
I'm not getting any messages after I use the command, I think it's because of what "Bytewave" said earlier about it not accepting a table.

Buzzkill:
Yeah, it is.   Move the tsay into the loop and change the check from negative to positive for asay privs and you should be fine.  (ie, do a tsay for each asay listener)

StaTiiKxKALEB:
Whenever I try to do it, it just gives this error.

MrPresident:
Let's see your updated code that is getting you that error.

StaTiiKxKALEB:

--- Quote from: MrPresident on May 16, 2016, 07:27:02 AM ---Let's see your updated code that is getting you that error.

--- End quote ---

I fixed it.
--- Code: ---function ulx.asay( calling_ply, message )
    local players = player.GetAll()
    for i=1, #players do
        local v = players[ i ]
        if ULib.ucl.query( v, seeasayAccess ) or v == calling_ply then -- Calling player always gets to see the echo
            ULib.tsayColor( v, false, Color(255,0,0), "(ADMIN CHAT) ", Color(0, 111, 255), calling_ply:Nick(), Color(255,255,255), ": ", message )
        end
    end               
end
local asay = ulx.command( CATEGORY_NAME, "ulx asay", ulx.asay, "@", true, true )
asay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
asay:defaultAccess( ULib.ACCESS_ALL )
asay:help( "Send a message to currently connected staff memebers." )
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version