Advertisement
Jezilas

Server: Example Plugin

Aug 12th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. --[[
  2. SERVER PLUGINS' NAMES MUST START WITH "Server: "
  3. CLIENT PLUGINS' NAMES MUST START WITH "Client: "
  4.  
  5. Plugins have full access to the server/client tables and most variables.
  6.  
  7. You can use the MakePluginEvent to use the script instead of setting up an event.
  8. PlayerChatted will get chats from the custom chat and nil players.
  9. PlayerJoined will fire after the player finishes initial loading
  10. CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
  11.  
  12. service.HookEvent('PlayerChatted',function(msg,plr)
  13. print(msg..' from '..plr.Name..' Example Plugin')
  14. end)
  15.  
  16. service.HookEvent('PlayerJoined',function(p)
  17. print(p.Name..' Joined! Example Plugin')
  18. end)
  19.  
  20. service.HookEvent('CharacterAdded',function(plr)
  21. server.RunCommand('name',plr.Name,'BobTest Example Plugin')
  22. end)
  23.  
  24. --]]
  25.  
  26. server = nil -- Mutes warnings about unknown globals
  27. service = nil
  28. return function()
  29. server.Commands.ExampleCommand = {
  30. Prefix = server.Settings.Prefix; -- Prefix to use for command
  31. Commands = {"example"}; -- Commands
  32. Args = {"arg1"}; -- Command arguments
  33. Description = "Example command"; -- Command Description
  34. Hidden = true; -- Is it hidden from the command list?
  35. Fun = false; -- Is it fun?
  36. AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
  37. Function = function(plr,args) -- Function to run for command
  38. print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
  39. print("Player supplied args[1] "..tostring(args[1]))
  40. end
  41. }
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement