Me Need.. Lua..:
6 replies



02.03.11 09:13:47 pm
Me Need How To Lock CT Side Only or Lock TT Side Only
in Lua For My Server
Im Bad Talking English
in Lua For My Server
Im Bad Talking English
Go to cs2d/lua/samples/
I`m can be wrong but i`m remember that "T team olny" script lie in "samples" folder
I`m can be wrong but i`m remember that "T team olny" script lie in "samples" folder
CS2d for ANDROID Discord server is here: https://discord.gg/ww59nvf
It doesn't actually, only a script to lock people at their current position.
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)
Code:
1
2
3
4
2
3
4
addhook("team", "lock")
function lock(id, team)
if team == 1 then return 1 end
end
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)
@Banaan: Maybe you can use a simple say hook on the side to enable it again, should work.

Code:
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.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
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

No, that won't work at all, Kim.
However that will.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
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.
I code, therefore I exist.
Code:
... I improved the code further so that you can lock both the teams. Cheers. 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
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
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


If i c some1 lock the team, i can unlock it. I think he maybe wants a admin system too.
Code:
1
2
3
2
3
admins={"12345"}
if player(id,"usgn")==admins then
if player(id,"usgn")==admins then
PS: im not good at lua



