shadowndacorner

Plugin example

Mar 29th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local PLUGIN={} -- Create the plugin table
  2.  
  3. PLUGIN.Name="Reload" -- Plugin's name
  4. PLUGIN.Command="reload"
  5.  
  6. PLUGIN.OnFail=function(ply) -- Not automatically called - see OnCall
  7.     ply:ChatPrint("You must be an admin to reload the map!")
  8. end
  9.  
  10. PLUGIN.OnCall=function(ply) -- Called whenever the command is run in console (mr reload) or chat (!reload, /reload)
  11.     if !ply:IsPlayer() or ply:IsAdmin() then -- Check for permission
  12.         RunConsoleCommand("changelevel", game.GetMap()) -- Reload the map
  13.     else
  14.         PLUGIN.OnFail(ply) -- If they don't have permission, call OnFail
  15.     end
  16. end
  17.  
  18. moderari.RegisterPlugin("Reload", PLUGIN) -- Register the plugin with name Reload.
Advertisement
Add Comment
Please, Sign In to add comment