Advertisement
dphile

PCSAY for ulx

Dec 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. --This is a category name and must be set correctly to work
  2. local CATEGORY_NAME = "Dink, put the correct category here"
  3.  
  4. --This function uses fancyLog to psay the player and CSay the message- see ulib docs for color parameters
  5. --the ulib csay will only send the csay to target_ply unless target ply is replaced with "_"
  6. function ulx.pcsay( calling_ply, target_ply, message )
  7.     ulx.fancyLog( { target_ply, calling_ply }, "#P to #P: " .. message, calling_ply, target_ply )
  8.     ULib.csay(target_ply, message)
  9. end
  10. --This is where the category name has to be correct, it's a string above, passed here
  11. local pcsay = ulx.command( CATEGORY_NAME, "ulx pcsay", ulx.pcsay, "!pc", false )
  12. --These params assist the text parser for chat
  13. pcsay:addParam{ type=ULib.cmds.PlayerArg, target="!^", ULib.cmds.ignoreCanTarget }
  14. pcsay:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
  15. --Set appropriate permissions below
  16. pcsay:defaultAccess( ULib.ACCESS_ALL )
  17. pcsay:help( "Send a private csay to target." )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement