Author Topic: Spectator Mode Command  (Read 10087 times)

0 Members and 2 Guests are viewing this topic.

Offline CrossBoy

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Spectator Mode Command
« on: January 18, 2016, 09:32:41 PM »
Hello! I have a deathrun server using .//MrGash's Deathrun Gamemode (https://github.com/Mr-Gash/GMod-Deathrun) and was trying to see if I could get a simple Spectator mode to work. It appeared that it already had the team created, but no way of entering it.

So, I tried making this, and put it in /addons/ulx/lua/ulx/modules/sh.
Code: [Select]
local CATEGORY_NAME = "Spectate"

 function ulx.spectate( calling_ply )
ply:Kill
ply:SetTeam(TEAM_SPECTATOR)
end
local spectate = ulx.command( CATEGORY_NAME, "ulx spectate", ulx.spectate, "!spectate", false )
spectate:defaultAccess( ULib.ACCESS_ALL )
spectate:help( "Enters Spectator Only Mode." )

Here is the error I get:

[ERROR] addons/ulx/lua/ulx/modules/sh/spec.lua:10: function arguments expected near 'ply'
  1. unknown - addons/ulx/lua/ulx/modules/sh/spec.lua:0

This is the first thing I've tried creating, and wasn't totally sure what was happening.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given