-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkill.sh
executable file
·53 lines (42 loc) · 1.46 KB
/
kill.sh
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
#!/bin/bash
gid=""
for i in games/*.txt; do
if grep -qs "$1" $i; then
gid=$(echo $i | sed 's,games/\([0-9]*\).txt,\1,')
fi
done
for line in $(seq $(wc -l games/$gid.txt | cut -d " " -f 1)); do
num=$(sed -n $line'p' games/$gid.txt | cut -d " " -f 1)
if [ "$num" = "$1" ]; then
if [ "$line" = $(wc -l games/$gid.txt | cut -d " " -f 1) ]; then
line=0;
fi
code=$(sed -n $(($line + 1))'p' games/$gid.txt | cut -d " " -f 2)
if [ "$code" = "$2" ]; then
./score.sh $1 $gid
num2=$(sed -n $(($line + 1))'p' games/$gid.txt | cut -d " " -f 1)
echo "Ha ha, U R DED. Better luck next time scrub. Get good." > xmpp.krourke.org/$num2/in
sed -i $(($line + 1))'d' games/$gid.txt
if [ $(wc -l games/$gid.txt | cut -d " " -f 1) = 1 ]; then
echo "Congratulations, you're the last player standing!" > xmpp.krourke.org/$num/in
./end.sh $gid
exit
fi
if [ "$line" = $(wc -l games/$gid.txt | cut -d " " -f 1) ]; then
line=0
fi
num2=$(sed -n $(($line + 1))'p' games/$gid.txt | cut -d " " -f 1)
picture=""
for imageline in $(seq $(wc -l pictures.txt | cut -d " " -f 1)); do
num3=$(sed -n $imageline'p' pictures.txt | cut -d " " -f 1)
if [ "$num2" = "$num3" ]; then
picture=$(sed -n $imageline'p' pictures.txt | cut -d " " -f 2)
fi
done
echo "Your new target's picture is $picture. Good luck!" > xmpp.krourke.org/$num/in
else
echo "Incorrect target. Please try again." > xmpp.krourke.org/$num2/in
fi
exit
fi
done