ULX

Author Topic: Tsay Display Rank.  (Read 2742 times)

0 Members and 1 Guest are viewing this topic.

Offline Derf

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Tsay Display Rank.
« 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!

Offline Derf

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Tsay Display Rank.
« Reply #1 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?
« Last Edit: October 10, 2013, 02:01:27 AM by Derf »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Tsay Display Rank.
« Reply #2 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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Derf

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Tsay Display Rank.
« Reply #3 on: October 10, 2013, 05:37:24 PM »
Sorry by 'Rank' I mean ULX Group.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Tsay Display Rank.
« Reply #4 on: October 10, 2013, 06:59:55 PM »
Easiest method would be to use ULib's 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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming