-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loop_Over_Players.txt
106 lines (106 loc) · 4.54 KB
/
Loop_Over_Players.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@name Loop Over Players
@persist [Players]:array [Case,Operation,Timer,TotalRuns] [TopPlayer]:string [Player]:entity [ServerStats]:gtable
if(first()){
Case=0
Operation=1
TotalRuns=0
Timer=50
ServerStats=gTable("Server Stats",1)
ServerStats:clear()
function void entity:checkMoney(){
if(!ServerStats:toTable():exists(This:steamID())){
ServerStats[This:steamID(),table]=table("Name"=This:name())
}
ServerStats[This:steamID(),table]["Cash",number]=This:money()
if(!ServerStats:toTable():exists("TotalMoney")){
ServerStats["TotalMoney",number]=0
}
ServerStats["TotalMoney",number]=ServerStats["TotalMoney",number]+This:money()
ServerStats["AverageMoney",number]=ServerStats["TotalMoney",number]/(ServerStats:count()-4)
}
function void entity:checkFrags(){
if(!ServerStats:toTable():exists(This:steamID())){
ServerStats[This:steamID(),table]=table("Name"=This:name())
}
ServerStats[This:steamID(),table]["Frags",number]=This:frags()
if(!ServerStats:toTable():exists("TotalFrags")){
ServerStats["TotalFrags",number]=0
}
ServerStats["TotalFrags",number]=ServerStats["TotalFrags",number]+This:frags()
ServerStats["AverageFrags",number]=ServerStats["TotalFrags",number]/(ServerStats:count()-4)
}
function void entity:checkDeaths(){
if(!ServerStats:toTable():exists(This:steamID())){
ServerStats[This:steamID(),table]=table("Name"=This:name())
}
ServerStats[This:steamID(),table]["Deaths",number]=This:deaths()
if(!ServerStats:toTable():exists("TotalDeaths")){
ServerStats["TotalDeaths",number]=0
}
ServerStats["TotalDeaths",number]=ServerStats["TotalDeaths",number]+This:deaths()
ServerStats["AverageDeaths",number]=ServerStats["TotalDeaths",number]/(ServerStats:count()-4)
}
function void entity:checkPing(){
if(!ServerStats:toTable():exists(This:steamID())){
ServerStats[This:steamID(),table]=table("Name"=This:name())
}
ServerStats[This:steamID(),table]["Ping",number]=This:ping()
if(!ServerStats:toTable():exists("TotalPing")){
ServerStats["TotalPing",number]=0
}
ServerStats["TotalPing",number]=ServerStats["TotalPing",number]+This:ping()
ServerStats["AveragePing",number]=ServerStats["TotalPing",number]/(ServerStats:count()-4)
}
timer("Case",Timer)
}
if(clk("Case")){
switch(Case){
case 0,
Players=players()
Case++
timer("Case",Timer)
break
case 1,
if(Operation==1){
TotalRuns++
if(Players:count()>0){
Player=Players:popEntity()
}else{
Case++
}
Operation=0
timer("Case",Timer)
}elseif(Operation==0){
Player:checkMoney()
Operation--
timer("Case",Timer)
}elseif(Operation==-1){
Player:checkFrags()
Operation--
timer("Case",Timer)
}elseif(Operation==-2){
Player:checkDeaths()
Operation--
timer("Case",Timer)
}elseif(Operation==-3){
Player:checkPing()
Operation=1
timer("Case",Timer)
}
#setName("Operation: "+Operation+" OperationCost: "+opcounter()+" Players Left: "+Players:count())
break
case 2,
print("Current Time: "+time("hour")+":"+time("min")+":"+time("sec"))
print("Total Money: "+ServerStats["TotalMoney",number]+"<br>Average Money: "+ServerStats["AverageMoney",number])
print("Total Frags: "+ServerStats["TotalFrags",number]+"<br>Average Frags: "+ServerStats["AverageFrags",number])
print("Total Deaths: "+ServerStats["TotalDeaths",number]+"<br>Average Deaths: "+ServerStats["AverageDeaths",number])
print("Total Ping: "+ServerStats["TotalPing",number]+"<br>Average Ping: "+ServerStats["AveragePing",number])
Case++
timer("Case",Timer)
break
default,
reset()
break
}
}
setName("Average Money: "+ServerStats["AverageMoney",number]+" Average Frags: "+ServerStats["AverageFrags",number]+" Average Deaths: "+ServerStats["AverageDeaths",number]+" Average Ping: "+ServerStats["AveragePing",number]+" Total Entries: "+(ServerStats:count()-4))