GodMode

Alright I have 2 questions.

  1. Why isnt code working? It wont enable/disable godmode on me.
  2. How can I make it a toggleable command.


local function ccGodModeOn( ply )
	if not ply:HasPriv(ADMIN) then ply:PrintMessage(2, string.format(LANGUAGE.need_admin, "rp_godmodeon"))
		return
	end
	if ply:HasPriv(ADMIN) then
		ply:GodEnable()
	end
end
concommand.Add("rp_godmodeon", ccGodModeOn)

local function ccGodModeOff( ply )
	if not ply:HasPriv(ADMIN) then ply:PrintMessage(2, string.format(LANGUAGE.need_admin, "rp_godmodeoff"))
		return
	end

	if ply:HasPriv(ADMIN) then
		ply:GodDisable()
	end
end
concommand.Add("rp_godmodeon", ccGodModeOff)


why not post us with the erorrs?

There are none. I just spawn an NPC and it kills meh.

i was writing the code , but then mah browser quit on me , i cba now , i am watching moovie :stuck_out_tongue:

[lua]
local function ccGodModeOn( ply )
if not ply:HasPriv(ADMIN) then
ply:PrintMessage(2, string.format(“You need admin for this %s”,LANGUAGE.need_admin))
return false
elseif ply:HasPriv(ADMIN) then
ply:GodEnable()
end
end
concommand.Add("+rp_godmode", ccGodModeOn)

local function ccGodModeOff( ply )
if not ply:HasPriv(ADMIN) then
ply:PrintMessage(2, string.format(“You need admin for this %s”,LANGUAGE.need_admin))
return false
elseif ply:HasPriv(ADMIN) then
ply:GodDisable()
end
end
concommand.Add("-rp_godmode", ccGodModeOff)[/lua]

You will have to hold the key doing it this way if you want it to toggle.