Ulysses

General => Developers Corner => Topic started by: Derf on October 10, 2013, 01:38:19 AM

Title: Tsay Display Rank.
Post by: Derf on October 10, 2013, 01:38:19 AM
Hey Guy's!

I currently have this for my Tsay
Code: [Select]
------------------------------ Tsay ------------------------------
function ulx.tsay( calling_ply, message )
ULib.tsayColor( _, false, Color(0,255,0), "(ADMIN) ", calling_ply:IsValid() and calling_ply:Nick() or "Console", ": ", 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." )


What I want to do is display their rank

so like (%RANK%) %Playername% : Message

What would I change "(ADMIN)" To?

Thank you very much for the help!
Title: Re: Tsay Display Rank.
Post by: Derf on October 10, 2013, 01:56:37 AM
Or can you make like a custom check for the different ranks (like a VIP job for dark RP)

For Example
Code: [Select]

customCheck = function(ply)
             return ply:IsUserGroup("trialadmin")
ULib.tsayColor( _, false, Color(0,255,0), "(Trial Admin) ", calling_ply:IsValid() and calling_ply:Nick() or "Console", ": ", message )
end

and do it for all the ranks?
Title: Re: Tsay Display Rank.
Post by: JamminR on October 10, 2013, 01:50:38 PM
Define 'rank' for us.
To me, rank = Gmod group.
Unfortunately, various other authors have made their own definitions, for some, rank = Gmod team.
For others, rank = some invented Gmod gamemode variable having little to do with team or group.
Title: Re: Tsay Display Rank.
Post by: Derf on October 10, 2013, 05:37:24 PM
Sorry by 'Rank' I mean ULX Group.
Title: Re: Tsay Display Rank.
Post by: JamminR on October 10, 2013, 06:59:55 PM
Easiest method would be to use ULib's GetUserGroup (http://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#Player:GetUserGroup) command
string.upper ( calling_ply:GetUserGroup() ) would return the player objects group name.

It won't be as pretty with spaces if you used multiword group names, but it will get the point across.