• Print

Author Topic: Individualised Csay  (Read 4289 times)

0 Members and 1 Guest are viewing this topic.

Offline GreenNoizuf

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Individualised Csay
« on: May 26, 2015, 02:18:12 am »
Hey, i was wondering if it is possible for a custom ULX command to be made where a user can display a message to a single person on the server in the middle of their screen.
Much like CSAY but it only shows one the selected players screen.
Is this possible? and if so how would it be done.
Thanks

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Individualised Csay
« Reply #1 on: May 26, 2015, 05:49:32 am »
Anything is possible.  :)

Out of the box, csay on the ULib side supports targeting individual players  (http://ulyssesmod.net/docs/files/lua/ulib/shared/messages-lua.html#csay).  However, the default implementation in ULX blasts the csay to everyone.  What you're looking for would look something like this  (I'm doing this without a net by just combing some of the existing psay and csay logic, so there are probably bugs).

Code: Lua
  1. function ulx.pcsay( calling_ply, target_ply, message )
  2.         ULib.csay( target_ply, message )
  3.         ulx.logString( string.format( "(csay from %s to %s) %s", calling_ply:IsValid() and calling_ply:Nick() or "Console", target_ply, message ) )
  4. end
  5. local pcsay = ulx.command( CATEGORY_NAME, "ulx pcsay", ulx.pcsay, "!pcsay", true )
  6. pcsay:addParam{ type=ULib.cmds.PlayerArg, target="!^", ULib.cmds.ignoreCanTarget }
  7. pcsay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
  8. pcsay:defaultAccess( ULib.ACCESS_ADMIN )
  9. pcsay:help( "Send a csay to a single person" )
« Last Edit: May 26, 2015, 05:51:04 am by Buzzkill »

  • Print