Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: giraff on April 03, 2015, 10:45:16 AM

Title: tsay
Post by: giraff on April 03, 2015, 10:45:16 AM
(https://leto24f.storage.yandex.net/rdisk/2bcb0106babdb34dcbc47dd726b5dbd6c0b276008b43bc150803bac8e4a4a518/inf/_h_PRQNDw7cY9PDYS2A8ueVvN4lZflWhZrm9_-_jFAwlIj86VtJTwgWM3N08BxFrTOzAXzPONkB6oIFLDMiacA==?uid=0&filename=2015-04-03%2018-19-03%20%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0.png&disposition=inline&hash=&limit=0&content_type=image%2Fpng&tknv=v2&rtoken=fb5a2ecd2ba3d2ac29c62994f12e2d7c&force_default=no)

How to make a display of the player's name?

Code: [Select]
------------------------------ Tsay ------------------------------
function ulx.tsay( calling_ply, message )
ULib.tsay( _, message )

if util.tobool( GetConVarNumber( "ulx_logChat" ) ) then
ulx.logString( string.format( "(tsay from %s) %s", calling_ply:IsValid() and calling_ply:Nick() or "Console", message ) )
end
end
local tsay = ulx.command( CATEGORY_NAME, "ulx tsay", ulx.tsay, "@@", true, true )
tsay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
tsay:defaultAccess( ULib.ACCESS_ADMIN )
tsay:help( "Send a message to everyone in the chat box." )
Title: Re: tsay
Post by: XxLMM13xX on April 03, 2015, 11:17:31 AM
Are you trying to make a whole new command? Like just a tsay name command?
Title: Re: tsay
Post by: giraff on April 03, 2015, 11:22:21 AM
I need to add a nickname to the text
Title: Re: tsay
Post by: XxLMM13xX on April 03, 2015, 11:36:08 AM
if you type @@<name> then it will show up in chat
Title: Re: tsay
Post by: XxLMM13xX on April 03, 2015, 11:37:52 AM
I see what you mean.... you can replace the line at ULib.tsay() with this


ULib.tsay( _, calling_ply.." Said: "..message )
Title: Re: tsay
Post by: giraff on April 03, 2015, 11:50:35 AM
In a chat, nothing appears
Title: Re: tsay
Post by: XxLMM13xX on April 03, 2015, 12:48:13 PM
In a chat, nothing appears


whats the error

Ok so overall are you looking to just have the tsay say:

"XxLMM13xXgaming said: message"

???
Title: Re: tsay
Post by: allofmywutsteam on April 03, 2015, 03:37:54 PM

whats the error

Ok so overall are you looking to just have the tsay say:

"XxLMM13xXgaming said: message"

???

Seems so. This is actually a pretty good idea this way these anonymous messages can be quoted by a particular player despite it not being directly in chat.
Title: Re: tsay
Post by: Zmaster on April 03, 2015, 03:41:27 PM
Small mistake in what XxLMM13xX told you to do

calling_ply is a player and can't be printed into the chat, what you want is to grab the name of the player
ULib.tsay( calling_ply, calling_ply:Name().." Said: "..message )
I also changed the _ to calling_ply since _ is not the player variable

You could also use calling_ply:Nick() since Name() and Nick() do the exact same thing
Title: Re: tsay
Post by: XxLMM13xX on April 03, 2015, 04:23:56 PM
Small mistake in what XxLMM13xX told you to do

calling_ply is a player and can't be printed into the chat, what you want is to grab the name of the player
ULib.tsay( calling_ply, calling_ply:Name().." Said: "..message )
I also changed the _ to calling_ply since _ is not the player variable

You could also use calling_ply:Nick() since Name() and Nick() do the exact same thing

I totaly forgot about this... Lol thanks!