Forum

> > CS2D > Scripts > Admin Commands
Forums overviewCS2D overview Scripts overviewLog in to reply

English Admin Commands

8 replies
To the start Previous 1 Next To the start

old Admin Commands

OutstandingPP
BANNED Off Offline

Quote
hello guys
i need script for admin commands like !kick !ban !freeze !mute
ok and please don't forget to put !mute
reply me with the code

old Re: Admin Commands

Hajt
User Off Offline

Quote
user OutstandingPP has written
user Hajt has written
file File does not exist (17245)

Nope
i need just commands for admin not menu

Nope
you even didn't check that file -.-

old Re: Admin Commands

OutstandingPP
BANNED Off Offline

Quote
user OutstandingPP has written
user Hajt has written
user OutstandingPP has written
user Hajt has written
file File does not exist (17245)

Nope
i need just commands for admin not menu

Nope
you even didn't check that f**king file -.-


i don't want the whole script i just want admin commands
edited 1×, last 17.01.17 12:49:18 am

Admin/mod comment

Malformed quote. I fixed it. /user GeoB99

old Re: Admin Commands

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
-- Variables
admin = {
	list = {12345,99999,69420},
	hooks = {"say"},
	color = {red = "255000000", green = "000255000", blue = "000000255", white = "255255255"},
	announce = function(id,txt) msg("\169255255255"..player(id,"name").." used \169"..txt)	end,
	fix = function(arg)
		local args = {}
		for k,v in pairs (arg) do
			if tonumber(v) then
				v = tonumber(v)
			end
			args[k] = v
		end
		return args
	end,
	commands = { -- arg[0] is id of player, arg[1] is the command made and arg[2] is target.
	-- you can use as many arguments as you want but all number strings will be converted into numbers.
	-- so if you want to have "3" you'll have to cast it into tostring(argument here) instead of just passing it
		["kick"] = function(arg) 
			parse("kick "..arg[2])
			admin.announce(arg[0],admin.color.green.." kick")
		end,
		["banusgn"] = function(arg) 
			parse("banusgn "..player(arg[2],"usgn"))
			admin.announce(arg[0],admin.color.green.." ban by USGN")
		end,
		["banip"] = function(arg) 
			parse("banip "..player(arg[2],"ip"))
			admin.announce(arg[0],admin.color.green.." ban by IP")
		end
	}
}

for k,v in pairs (admin.hooks) do
	addhook(v,"admin_"..v)
end

function string.split(str,pat) -- Splitting strings (sentences) into separate words
    local t = {}
    for word in string.gmatch(str,pat or "[^%s]+") do
        t[#t+1] = word
    end
    return t
end

-- Main Script: Functions
function admin_say(id, txt)
	local arg = txt:split()
	arg[0] = id
	for _, usgn in ipairs(admin.list) do
		if player(id,"usgn") == usgn then
			if arg[1]:sub(1,1) == "!" then
				if admin.commands[arg[1]:sub(2,#arg[1])] then
					admin.commands[arg[1]:sub(2,#arg[1])](admin.fix(arg))
				end
				return 1
			end
		end
	end
end

I want to finish current bs I'm working on before I make a bunch of commands for Y8s framework. Anyways, I wrote this one afternoon for a guy, you can just copy-paste to add commands you want to have. It has a few examples. Look near 'commands'

old Re: Admin Commands

Waldin
User Off Offline

Quote
oh man just look file archive, there is more scripts like this there than hormones in your head
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview