General > Developers Corner

Not sure why ULib.tsayColor is not working.

(1/2) > >>

StaTiiKxKALEB:
Any idea why ULib.tsayColor() is not working?


--- Code: ---function ulx.asay( calling_ply, message )
    local players = player.GetAll()
    for i=#players, 1, -1 do
        local v = players[ i ]
        if not ULib.ucl.query( v, seeasayAccess ) and v ~= calling_ply then -- Calling player always gets to see the echo
            table.remove( players, i )
        end
    end

    ULib.tsayColor( players, false, Color(255,0,0), "(ADMIN CHAT) ", Color(0, 111, 255), calling_ply:Nick(), Color(255,255,255), ": ", message )

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 ---

Bytewave:

--- Quote from: StaTiiKxKALEB on May 15, 2016, 10:08:16 AM ---Any idea why ULib.tsayColor() is not working?

--- End quote ---
For future reference, please explain "not working". It's very hard to fix a problem you know nothing about. Post any and all relevant errors, both client and server, as well as expected vs actual behavior.
What I can tell you is that ULib.tsayColor(Player ply, boolean wait, ...) only takes one player as an argument, not a table of players.

iViscosity:
Also, why are you trying to make an asay command when there already is one for ULX? If you want to change it, you can just edit the code itself (which I don't really recommend).

StaTiiKxKALEB:

--- Quote from: iViscosity on May 15, 2016, 12:29:56 PM ---Also, why are you trying to make an asay command when there already is one for ULX? If you want to change it, you can just edit the code itself (which I don't really recommend).

--- End quote ---
I'm not making my own, it's an edited version of it. I want it to have set colors and for "(Staff Chat)" to be red, etc, what's in the tsayColor().

iViscosity:

--- Quote from: StaTiiKxKALEB on May 15, 2016, 08:03:53 PM ---I'm not making my own, it's an edited version of it. I want it to have set colors and for "(Staff Chat)" to be red, etc, what's in the tsayColor().

--- End quote ---

I see. What do you mean by "not working", though? What errors are you getting?

Navigation

[0] Message Index

[#] Next page

Go to full version