-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_door_for_pd_4.0.txt
60 lines (56 loc) · 1.71 KB
/
auto_door_for_pd_4.0.txt
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
@name Auto Door For PD 4.0
@persist [AllowedPlayers]:table
@persist [Distance,DistanceFromDoor,Loaded,I,Update]
@persist [DoorEntity]:array
@persist [Closest]:entity
if(first()){
Distance=100
Update=1000
timer("Check",1000)
runOnChat(1)
AllowedPlayers=table()
}
if(clk("Check")){
while(perf(10)){
I=(I+1)%players():count()+1
local Player=players()[I,entity]
local Check=(Player:team():teamName()):explode(" ")
switch(Check[1,string]){
case "Police",
case "S.W.A.T",
case "Mayor",
case "Juggernaut",
case "Secret",
if(!AllowedPlayers:exists(Player:steamID())){
print("Added "+Player:name())
AllowedPlayers[Player:steamID(),number]=1
}
foreach(K,Door:entity = DoorEntity){
if(Player:pos():distance(Door:pos()) <= Distance){
Door:noCollideAll(1)
timer(Player:steamID()+" "+K,Update)
}
}
break
default,
if(AllowedPlayers:exists(Player:steamID())){
print("Removed "+Player:name())
AllowedPlayers:remove(Player:steamID())
}
break
}
}
timer(clkName(),100)
}
if(clkName():find("STEAM")){
Parameters = clkName():explode(" ")
Player = findPlayerBySteamID(Parameters[1,string])
Door = DoorEntity[Parameters[2,string]:toNumber(),entity]
if(Player:pos():distance(Door:pos()) > Distance){
Door:noCollideAll(0)
}else{
timer(clkName(),Update)
}
}
if(chatClk(owner())){
}