Forum

> > CS2D > Scripts > function only admin
Forums overviewCS2D overview Scripts overviewLog in to reply

English function only admin

2 replies
To the start Previous 1 Next To the start

old function only admin

kkkkkkk
User Off Offline

Quote
hi
i want add this function for using only with admin (teleport with claw)
More >

but i want other players use claw normal using
if you help me i will thank you

old Re: function only admin

Cure Pikachu
User Off Offline

Quote
This should do the job.
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
function Array(size,value) 
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end

function usgncheck(data,id)
	for _, usgn in pairs(data) do
		if player(id,"usgn") == usgn then
			return true
		end
	end
	return false
end

mx = Array(32,0)
my = Array(32,0)
admintable = {24449} -- List of USGNs to be given admin rights

timer(150,"requestdata","",0)

function requestdata()
	reqcld(0,2)
end

addhook("clientdata","clientdata")
function clientdata(id,mode,x,y)
	if mode == 2 then
		mx[id] = x
		my[id] = y
	end
end

addhook("attack","client")
function client(id)
	if player(id,"weapon") == 78 then
		if usgncheck(admintable,id) then
			parse("setpos "..id.." "..mx[id].." "..my[id].."")
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview