English Me Need.. Lua..:

6 replies
Goto Page
To the start Previous 1 Next To the start
02.03.11 09:13:47 pm
Up
blood2d
User
Offline Off
Me Need How To Lock CT Side Only or Lock TT Side Only

in Lua For My Server

Im Bad Talking English
02.03.11 09:30:54 pm
Up
StirlizZ-Fapicon
Super User
Offline Off
Go to cs2d/lua/samples/

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
02.03.11 09:43:50 pm
Up
Banaan
User
Offline Off
It doesn't actually, only a script to lock people at their current position.

Code:
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)
02.03.11 10:45:38 pm
Up
KimKat
GAME BANNED
Offline Off
@Banaan: Maybe you can use a simple say hook on the side to enable it again, should work.

Code:
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.√
02.03.11 10:48:21 pm
Up
EngiN33R
Moderator
Offline Off
No, that won't work at all, Kim.

Code:
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.
I code, therefore I exist.
03.03.11 01:23:26 am
Up
KimKat
GAME BANNED
Offline Off
Code:
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.
03.03.11 02:03:01 pm
Up
Surplus
User
Offline Off

If i c some1 lock the team, i can unlock it. I think he maybe wants a admin system too.
Code:
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