General > Developers Corner

ULX Chat Coding Problem. Help!

(1/2) > >>

battlerat:

--- Code: ---local seeasayAccess = "ulx seeasay"
if SERVER then ULib.ucl.registerAccess( seeasayAccess, ULib.ACCESS_OPERATOR, "Ability to see 'ulx asay'", "Other" ) end -- Give operators access to see asays echoes by default

function ulx.asay( calling_ply, message )
local format
local me = "/me "
if message:sub( 1, me:len() ) == me then
format = "(ADMINS) *** #P " .. message:sub( me:len() + 1 )
else
format = "#P to admins: " .. message
end

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

ulx.fancyLog( players, format, calling_ply )
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 admins." )
--- End code ---


This is the code i have in ULX. The lua file is chat. This code is used for the admin chat "@" .
When a non admin player in game uses the @ <message> command it says <player> to admins: <message>
But, when an admin does the @ <massage> command it does the same thing... even though in the code it says that an admin -admin convo should be (ADMINS) <player>: <Messsage>

I just wanted to know, is there something wrong with my code?
If you have the code please help me. Thanks

Megiddo:
I don't see any changes from default ULX that would make this "your code"? Did you post the wrong code? Otherwise, this default code is acting exactly as it should. It's only when you say "@/me blah blah" that it shows the "(ADMINS)" bit.

battlerat:
This is not my code, it is a code in ulx.
BUT, I saw in a server which I was admin in that wen an admin did @ <message it said (ADMINS) <PLAYER>: <message>
and when a player did @ <message> it said <player> to ADMINS: <message>

I just want to know how I would change this code to where it would work that way...

Megiddo:
Why not just ask the admin of this server to share it with you?

battlerat:
I did, and he did not want to share it with me...

Would you be able to help?

Navigation

[0] Message Index

[#] Next page

Go to full version