Forum

> > CS2D > Scripts > Me Need.. Lua..:
Forums overviewCS2D overview Scripts overviewLog in to reply

English Me Need.. Lua..:

6 replies
To the start Previous 1 Next To the start

old Me Need.. Lua..:

blood2d
User Off Offline

Quote
Me Need How To Lock CT Side Only or Lock TT Side Only

in Lua For My Server

Im Bad Talking English

old Re: Me Need.. Lua..:

Banaan
User Off Offline

Quote
It doesn't actually, only a script to lock people at their current position.

1
2
3
4
addhook("team", "lock")
function lock(id, team)
	if team == 1 then return 1 end
end

Simplest way to do it. It'll permanently lock everything though, only way to unlock is resetting lua or freeing the hook (or overwriting the function)

old Re: Me Need.. Lua..:

KimKat
GAME BANNED Off Offline

Quote
@Banaan: Maybe you can use a simple say hook on the side to enable it again, should work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("team", "lock")
function lock(id, team)
	if team == 1 then return 1 end
end

addhook("say","lock")
function lock(id, txt)
	local team = player(id,"team")
	if (txt=="!release t") then
		if player(id,"exists") then
			if team==1 then return 0 end
		end
	elseif (txt=="!release ct") then
		if player(id,"exists") then
			if team==2 then return 0 end
		end
	end
end
If it doesn't work, I am sure it works in some other way nearly as similar as to what is written in above code.√

old Re: Me Need.. Lua..:

EngiN33R
Moderator Off Offline

Quote
No, that won't work at all, Kim.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("team", "lock")
function lock(id, team)
     if (allow==0) then
     	if team == 1 then return 1 end
     else
	if team == 1 then return 0 end
     end
end

addhook("say","lock")
function lock(id, txt)
     if (txt=="!releaset") then
          allow=1
     elseif (txt=="!lockt") then
          allow=0
     end
end

However that will.

old Re: Me Need.. Lua..:

KimKat
GAME BANNED 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
lock_t = 1
lock_ct = 1

addhook("team", "lock")
function lock(id, team)
	if (lock_t==0) then
		if team == 1 then return 1 end
	elseif (lock_t==1) then
		if team == 1 then return 0 end
	end
	if (lock_ct==0) then
		if team == 2 then return 1 end
	elseif (lock_ct==1) then
		if team == 2 then return 0 end
	end
end

addhook("say","lock")
function lock(id, txt)
	if (txt=="!unlock t" or txt=="!unlockt") then
		lock_t=1
	elseif (txt=="!lock t" or txt=="!lockt") then
		lock_t=0
	end
	if (txt=="!unlock ct" or txt=="!unlockct") then
		lock_ct=1
	elseif (txt=="!lock ct" or txt=="!lockct") then
		lock_ct=0
	end
end
... I improved the code further so that you can lock both the teams. Cheers.

old Re: Me Need.. Lua..:

Surplus
User Off Offline

Quote

If i c some1 lock the team, i can unlock it. I think he maybe wants a admin system too.
1
2
3
admins={"12345"}

if player(id,"usgn")==admins then

PS: im not good at lua
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview