Using ulx to run console commands

I need a few new commands to run “ttt_force_traitor”, “ttt_force_detective” and “ttt_cheat credits” with sv_cheats off. (also will need a cool down for it)

is this possible and if it is how would I code it?

local function force_traitor(ply)
if not ply:IsSuperAdmin() then return end


concommand.Add(“ttt_force_traitor”, force_traitor)


thank you.

what folder/file would i add this to?

lua/autorun/server - name it whatevernameyouwant.lua

Just so you know it will only set you as that team, and not people that you specify.

could you fill the state update?

It gives me this in console and only makes the changes client side, making it say on the HUD I’m T and giving me the red bar in scoreboard. But server side and to everyone else I’m just still inno.

] ttt_force_traitor
[ulx\modules\sh tt.lua:5] attempt to call global ‘SendFullStateUpdate’ (a nil value)

It’s not shared, why would you put it in a shared folder?

Go to Line 123 and replace what’s there with what I gave you.

GRRR, still won’t work :confused:

same thing as before.

keeping in mind this is a server hosted off my computer.

my mistake, i was under the impression you were asking for us to give you commands for your singeplayer game thats on the TTT gamemode and has an admin mod

For it to work you’ll have to be the rank “SuperAdmin”.

case sensitive?

and do i need to remove the other lines for ttt_force_traitor?

If you’re using ULX(I prefer it) you would need a group to inherit from superadmin. Yes, just replace the old command with the one I gave you.

[lua]local function force_detective(ply)
if not ply:IsSuperAdmin() then return end


concommand.Add(“ttt_force_detective”, force_detective)[/lua]
Above Copyedited from brandonj4 and edited to save you some time, in case you’re like me.

The way I did it for the server i’m with is to just make one command then have it check 3 variables in a table then if true, set them to the role that the variable is in the table.

I’m not going to give you everything I did but you get the idea:
function ForceRole(ply, cmd, args)
if not ply:IsSuperAdmin() then return end
local Roles = {
[“innocent”] = ROLE_INNOCENT
local role = tostring(args[1])

if not role then
	ply:ChatPrint("Expected args[1]")
	if not Roles[string.lower(role)] then
		ply:ChatPrint("The role you typed was incorrect.")

concommand.Add(“ttt_force_role”, ForceRole)

ok, going with exactly what you gave me.
as the default group of super admin
normal crap removed.
during the round.

[editline]8th September 2012[/editline]

woot, it works.

just 1 other problem

I need a cooldown so people dont go crazy with it.