# احمِ الجبن من مصاصي الدماء

Mar 6th, 2021
669
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. -- Protect the cheese from the hungry vampires! Use your arrows and shoot them till kingdom come!
2. local maps = {
3.     {n = "Trench Attack",
4.       Width = 3000,
5.       Height = 400,
6.       mouseSpawn = {x = 350, y = 345},
7.       vampireSpawn = {x = 2650, y = 345},
8.       XML = '<C><P L="3000" Ca="" aie="" /><Z><S><S H="40" P="0,0,0.3,0.2,0,0,0,0" L="1400" X="700" Y="380" T="6" /><S H="40" P="0,0,0.3,0,0,0,0,0" L="200" X="200" Y="340" T="10" /><S P="0,0,0.3,0,0,0,0,0" L="200" H="40" X="2800" Y="340" T="10" /><S H="100" P="0,0,0.3,0.2,0,0,0,0" L="20" X="120" Y="270" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" H="100" X="280" Y="270" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" H="100" X="2880" Y="270" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" H="100" X="2720" Y="270" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="1400" H="40" X="2300" Y="380" T="6" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" H="40" X="400" Y="340" T="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" H="40" X="2600" Y="340" T="0" /><S H="10" P="0,0,0.3,0.2,0,0,0,0" L="3000" o="6a7495" X="0" c="3" Y="-5" T="12" /><S P="0,0,0.3,0.2,0,0,0,0" X="3000" L="3000" o="6a7495" H="10" c="3" Y="-5" T="12" /></S><D><F Y="315" X="200" /><T Y="320" X="2800" /><DS Y="-30" X="1500" /></D><O /></Z></C>'
9.     },
10.     {n = "Vampire Mansion",
11.       Width = 3000,
12.       Height = 400,
13.       mouseSpawn = {x = 400, y = 355},
14.       vampireSpawn = {x = 2780, y = 222},
15.       XML = '<C><P aie="" L="3000" Ca="" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="3000" o="292929" X="1500" c="4" Y="395" T="12" H="10" /><S c="4" L="20" o="292929" H="200" X="2000" Y="300" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,,0,0,0" L="3000" o="ffffff" H="10" c="3" Y="405" T="12" X="1500" /><S L="3000" o="ffffff" H="25" X="1500" Y="0" T="12" P="0,0,0.3,0.2,,0,0,0" /><S P="0,0,0,0,,0,0,0" L="25" o="ffffff" H="425" Y="200" T="12" X="0" /><S L="25" o="ffffff" H="425" X="3000" Y="200" T="12" P="0,0,0,0,,0,0,0" /><S L="25" o="ffffff" H="240" X="800" Y="180" T="12" P="0,0,0,0,,0,0,0" /><S P="0,0,0,0,,0,0,0" L="25" o="ffffff" X="1600" Y="180" T="12" H="240" /><S P="0,0,0.3,0.2,0,0,0,0" L="20" o="292929" X="880" c="4" Y="300" T="12" H="200" /><S L="25" o="ffffff" X="2400" H="240" Y="180" T="12" P="0,0,0,0,,0,0,0" /><S P="0,0,0.3,0.2,,0,0,0" L="500" o="ffffff" H="25" Y="288" T="12" X="1200" /><S P="0,0,0.3,0.2,,0,0,0" L="350" o="ffffff" H="26" Y="287" T="12" X="1763" /><S L="350" o="ffffff" H="26" X="1763" Y="150" T="12" P="0,0,0.3,0.2,,0,0,0" /><S P="0,0,0.3,0.2,,0,0,0" L="350" o="ffffff" X="2237" Y="150" T="12" H="26" /><S L="350" o="ffffff" X="2237" H="26" Y="287" T="12" P="0,0,0.3,0.2,,0,0,0" /><S P="0,0,0.3,0.2,,0,0,0" L="450" o="ffffff" H="26" Y="287" T="12" X="2770" /><S P="0,0,,,,0,0,0" L="3000" H="26" Y="388" T="9" m="" X="1500" /><S L="20" H="200" X="2000" Y="300" T="9" m="" P="0,0,,,,0,0,0" /><S P="0,0,,,,0,0,0" L="20" X="880" Y="300" T="9" m="" H="200" /></S><D><P C="0" Y="0" T="34" X="0" P="0,0" /><P C="0" Y="0" T="34" X="800" P="0,0" /><P C="0" Y="0" T="34" X="1600" P="0,0" /><P C="0" Y="0" T="34" X="2200" P="0,0" /><P C="ffffff" Y="170" T="89" X="400" P="0,0" /><P C="cdc5bc,623b2a" Y="272" T="105" X="1200" P="0,0" /><P C="8a311b" Y="400" T="15" X="400" P="0,0" /><P C="8a311b" Y="400" T="15" X="200" P="0,0" /><P C="8a311b" Y="400" T="15" X="600" P="0,0" /><P C="95311e,bde8f3,faf1b3" Y="160" T="14" X="1200" P="0,0" /><P C="cdc5bc,623b2a" Y="272" T="105" P="0,0" X="1350" /><P C="cdc5bc,623b2a" Y="272" T="105" X="1300" P="0,0" /><P C="cdc5bc,623b2a" Y="272" T="105" P="0,0" X="1250" /><P C="cdc5bc,623b2a" Y="272" T="105" P="0,0" X="1100" /><P C="cdc5bc,623b2a" Y="272" T="105" P="0,0" X="1050" /><P C="cdc5bc,623b2a" Y="272" T="105" P="0,0" X="1150" /><P C="623b2a" Y="277" T="104" X="1093" P="1,0" /><P C="623b2a" Y="277" T="104" X="1200" P="1,0" /><P C="623b2a" Y="277" T="104" P="1,0" X="1308" /><P X="1284" Y="241" T="21" P="1,0" /><P X="1342" Y="240" T="31" P="1,0" /><P X="1063" Y="240" T="31" P="1,0" /><P C="8a311b,95d9d6,665c50,e9e2da" Y="13" T="102" X="1450" P="1,0" /><P C="8a311b,95d9d6,665c50,e9e2da" Y="13" T="102" X="950" P="1,0" /><P C="95311e" Y="145" T="24" X="1671" P="0,0" /><P C="95311e" Y="288" T="24" X="1671" P="0,0" /><P C="95311e" Y="288" T="24" X="2329" P="0,1" /><P C="95311e" Y="145" T="24" X="2329" P="0,1" /><P P="0,0" Y="277" T="33" X="1755" /><P X="2244" Y="139" T="33" P="0,0" /><P X="1755" Y="137" T="26" P="1,1" /><P X="2600" Y="275" T="22" P="0,0" /><P X="2900" Y="275" T="22" P="0,0" /><P P="0,0" Y="277" T="33" X="2244" /><P C="8a311b" Y="274" T="15" X="2750" P="0,0" /><P X="2750" Y="274" T="17" P="1,0" /><P X="2750" Y="111" T="23" P="0,0" /><F Y="365" X="165" /><DS Y="-30" X="1500" /><T Y="275" X="2910" /></D><O /></Z></C>'
16.     },
17.     {n = "Dungeon Invasion",
18.       Width = 3000,
19.       Height = 400,
20.       mouseSpawn = {x = 325, y = 325},
21.       vampireSpawn = {x = 2950, y = 365},
22.       XML = '<C><P Ca="" aie="" L="3000" /><Z><S><S X="2850" H="100" o="0" L="300" Y="321" c="2" P="0,0,0.3,0.2,,0,0,0" T="12" /><S X="16" L="400" Y="200" H="30" P="0,0,0.3,,90,0,0,0" T="10" /><S H="10" X="1500" o="324650" L="3000" Y="-5" P="0,0,0.3,0.2,,0,0,0" T="12" /><S H="10" o="324650" L="400" Y="200" X="-5" P="0,0,0,0.2,90,0,0,0" T="12" /><S H="30" L="2000" Y="385" X="1000" P="0,0,0.3,,0,0,0,0" T="10" /><S H="30" L="200" Y="230" X="605" P="0,0,0.3,,0,0,0,0" T="10" /><S X="2650" L="700" Y="385" H="30" P="0,0,0.3,,0,0,0,0" T="10" /><S H="30" L="200" Y="355" X="250" P="0,0,0.3,,0,0,0,0" T="10" /><S X="250" L="100" Y="325" H="30" P="0,0,0.3,,0,0,0,0" T="10" /><S H="30" L="200" Y="60" X="170" P="0,0,0.3,,180,0,0,0" T="10" /><S X="415" L="200" Y="60" H="30" P="0,0,0.3,,180,0,0,0" T="10" /><S H="30" L="100" Y="95" X="500" P="0,0,0.3,,90,0,0,0" T="10" /><S X="500" L="100" Y="265" H="30" P="0,0,0.3,,90,0,0,0" T="10" /><S H="150" L="25" Y="289" X="457" P="0,0,,,,0,0,0" T="9" /><S X="885" L="200" Y="155" H="30" P="0,0,0.3,,0,0,0,0" T="10" /><S H="30" L="200" Y="295" X="885" P="0,0,0.3,,0,0,0,0" T="10" /><S H="200" L="200" Y="200" X="1230" P="0,0,0.3,,0,0,0,0" T="10" /><S X="1465" L="100" Y="320" H="100" P="0,0,0.3,,0,0,0,0" T="10" /><S H="100" L="100" Y="220" X="1701" P="0,0,0.3,,0,0,0,0" T="10" /><S X="1465" L="100" Y="85" H="170" P="0,0,0.3,,180,0,0,0" T="10" /><S H="30" L="300" Y="262" X="2850" P="0,0,0.3,,0,0,0,0" T="10" /><S H="30" L="400" Y="200" X="2985" P="0,0,0.3,,270,0,0,0" T="10" /><S X="745" L="25" Y="265" H="200" P="0,0,,,,0,0,0" T="9" /><S H="250" L="25" Y="240" X="1100" P="0,0,,,,0,0,0" T="9" /><S X="1370" L="25" Y="240" H="250" P="0,0,,,,0,0,0" T="9" /><S X="542" L="25" Y="132" H="150" P="0,0,,,,0,0,0" T="9" /></S><D><F X="251" Y="307" /><DS X="325" Y="325" /><P C="55300b,191812" X="2701" P="1,0" T="98" Y="369" /><T X="2950" D="" Y="369" /></D><O /></Z></C>'
23.     }
24.   }
25.
26.   local mice = {}
27.   local playing = {}
28.   local vampires = {}
29.
30.   local admin = {["Tomstoms#0000"] = true, ["Onkei#0000"] = true, ["Santaishcool#0000"] = true, ["Ninjafood#0000"] = true, ["Pie#0000"] = true, ["Ehw#0000"] = true}
31.   local canShoot = false
32.   local cheese = {}
33.   local currentMap;
34.   local hole = {}
35.   local keys = {space = 32, left = 37, up = 38, right = 39, down = 40, a = 65, d = 68, q = 81, s = 83, w = 87}
36.   local players = {}
37.   local respawnTimer = 0
38.   local settings = {
39.     maxArrows = 15,
40.     maxHunger = 40,
41.     timeTillRespawn = 10,
42.     barLen = 780,
43.     leftKeys = {[keys.left] = true, [keys.a] = true, [keys.q] = true},
44.     rightKeys = {[keys.right] = true, [keys.d] = true},
45.     downKeys = {[keys.down] = true, [keys.s] = true},
46.     upKeys = {[keys.up] = true, [keys.w] = true},
47.   }
49.   local timeLeft = 0
50.   local vampiresWon = false
51.
52.   local bot = {
53.     {n = "Amadeus_Onkei", backgroundColor = 0x2c4726, borderColor = 0x2c4726},
54.     {n = "Chiaki", backgroundColor = 0x804d80, borderColor = 0xcccccc},
55.     {n = "Soupbot", backgroundColor = 0x324650, borderColor = 0x171918},
56.   }
57.
58.   function capitalize(word)
59.     return string.upper(word:sub(1, 1)) .. string.lower(word:sub(2));
60.   end
61.
62.   function main()
63.     tfm.exec.disableAutoNewGame(true)
64.     tfm.exec.disableAutoShaman(true)
65.     tfm.exec.disableAutoTimeLeft(true)
66.     tfm.exec.disableAutoScore(true)
67.
68.     for n in pairs(tfm.get.room.playerList) do eventNewPlayer(n) end
69.
70.     startRound()
71.   end
72.
73.   function pythag(x1, y1, x2, y2, r)
74.     local x = x2 - x1
75.     local y = y2 - y1
76.     local r = r + r
77.     return x * x + y * y < r * r
78.   end
79.
80.   function resetMouse(n)
81.     mice[n] = {
82.       direction = 1,
83.       shooting = {Arrows = settings.maxArrows, Timer = 0},
84.     }
85.     system.bindMouse(n, true)
86.   end
87.
88.   function resetVampire(n)
89.     vampires[n] = {
90.       hunger = settings.maxHunger,
91.       biting = {Allow = true, Timer = 0},
92.     }
93.     system.bindMouse(n, false)
94.   end
95.
96.   function setKeys(n)
97.     for i, key in pairs(keys) do
98.       tfm.exec.bindKeyboard(n, key, true, true)
99.     end
100.   end
101.
102.   function setTeams()
103.     local list_of_players = {}
104.     for n in pairs(tfm.get.room.playerList) do table.insert(list_of_players, n) end
105.     for i = 1, #list_of_players, 1 do
106.       local index = math.random(#list_of_players)
107.       local n = list_of_players[index]
108.       if i % 2 == 0 then
109.         resetMouse(n)
110.       else
111.         resetVampire(n)
112.       end
113.       playing[n] = false
114.       setKeys(n)
115.       table.remove(list_of_players, index);
116.     end
117.   end
118.
119.   function showBar(n)
120.     local backgroundColor = bot[3].backgroundColor
121.     local borderColor = bot[3].borderColor
122.     local mouse = mice[n]
123.     local player = players[n]
124.     local vampire = vampires[n]
125.
126.     if player then local botbot = bot[player.botType] backgroundColor = botbot.backgroundColor borderColor = botbot.borderColor end
127.
128.     local mapBar = 0
129.     if mouse then
130.       mapBar = math.floor(mouse.shooting.Arrows * (settings.barLen / settings.maxArrows))
131.     elseif vampire then
132.       mapBar = math.floor(vampire.hunger * (settings.barLen / settings.maxHunger))
133.     end
134.
135.     ui.addTextArea(0, "", n, 10, 10, settings.barLen, 20, backgroundColor, borderColor, 0.7, true)
136.     ui.addTextArea(1, "", n, 10, 10, mapBar, 20, borderColor, borderColor, 0.7, true)
137.   end
138.
139.   function startRound()
140.     math.randomseed(os.time())
141.     canShoot = false
142.     timeLeft = 0
143.     vampiresWon = false
144.
145.     mice = {}
146.     playing = {}
147.     vampires = {}
148.     setTeams()
149.
150.     currentMap = maps[math.random(#maps)]
151.     tfm.exec.newGame(currentMap.XML)
152.   end
153.
154.   function table.copy(t1)
155.     local t2 = {}
156.     for k, v in pairs(t1) do
157.       t2[k] = v
158.     end
159.     return t2
160.   end
161.
163.     local backgroundColor = bot[3].backgroundColor
164.     local borderColor = bot[3].borderColor
165.     if n == nil then
166.       for n in pairs(tfm.get.room.playerList) do
167.         if players[n] then
168.           local botbot = bot[players[n].botType]
169.           backgroundColor = botbot.backgroundColor
170.           borderColor = botbot.borderColor
171.
172.           ui.addTextArea(100, "<v><a href='event:bot_popup'>[~"..botbot.n.."]</a><n> "..text, n, 6, 380, nil, 30, backgroundColor, borderColor, 0.7, true)
173.         end
174.       end
175.     elseif players[n] then
176.       local botbot = bot[players[n].botType]
177.       backgroundColor = botbot.backgroundColor
178.       borderColor = botbot.borderColor
179.
180.       ui.addTextArea(100, "<v><a href='event:bot_popup'>[~"..botbot.n.."]</a><n> "..text, n, 6, 380, nil, 30, backgroundColor, borderColor, 0.7, true)
181.     end
182.   end
183.
184.   function eventNewGame()
185.     tfm.exec.setGameTime(3 * 60)
186.     ui.setMapName(currentMap.n.." !");
187.
188.     cheese = {}
189.     hole = {}
190.     if tfm.get.room.xmlMapInfo then
191.       for cheeseStuff in tfm.get.room.xmlMapInfo.xml:gmatch("<F [^/]+/>") do
192.         local x1 = tonumber(cheeseStuff:match('X="(%d+)"'))
193.         local y1 = tonumber(cheeseStuff:match('Y="(%d+)"'))
194.         table.insert(cheese, {x = x1, y = y1})
195.       end
196.       for holeStuff in tfm.get.room.xmlMapInfo.xml:gmatch("<T [^/]+/>") do
197.         local x1 = tonumber(holeStuff:match('X="(%d+)"'))
198.         local y1 = tonumber(holeStuff:match('Y="(%d+)"'))
199.         table.insert(hole, {x = x1, y = y1})
200.       end
201.     end
202.
203.     for n in pairs(tfm.get.room.playerList) do
204.       tfm.exec.setPlayerScore(n, 0, false)
205.       showBar(n)
206.       -- Teleport the players.
207.       if mice[n] then
208.         tfm.exec.movePlayer(n, currentMap.mouseSpawn.x, currentMap.mouseSpawn.y);
209.         ui.addBotText("انت الفأر! قم بحماية الجبن من مصاصي الدماء باستخدام الأسهم (زر الفأرة الأيسر)!", n)
210.       elseif vampires[n] then
211.         tfm.exec.setVampirePlayer(n)
212.         tfm.exec.movePlayer(n, currentMap.vampireSpawn.x, currentMap.vampireSpawn.y);
213.         ui.addBotText("أنت مصاص دماء! خذ الجبن من الفأر وقم بتسليمها إلى الجحر\n اضغط على سهم لأعلى للطيران ومفتاح المسافة للدغة", n)
214.       end
215.     end
216.   end
217.
218.   function eventKeyboard(n, key, down, x, y)
219.     local now = os.time()
220.     local data = tfm.get.room.playerList[n]
221.
222.     local mouse = mice[n]
223.     local vampire = vampires[n]
224.
225.     if (mouse or vampire) and not data.isDead then
226.       data.x = x
227.       data.y = y
228.
229.       if not playing[n] then
230.         playing[n] = true
231.       end
232.
233.       if settings.leftKeys[key] and mouse then
234.         mouse.direction = -1
235.       elseif settings.rightKeys[key] and mouse then
236.         mouse.direction = 1
237.       elseif settings.upKeys[key] and vampire then
238.         tfm.exec.movePlayer(n, 0, 0, 0, 0, -40, false)
239.       elseif key == keys.space and vampire and canShoot then
240.         if vampire.biting.Allow then
241.           if vampire.biting.Timer < now - 5000 then
242.             for n2, data2 in pairs(tfm.get.room.playerList) do
243.               local mouse2 = mice[n2]
244.               if mouse2 and not data2.isDead and pythag(x, y, data2.x, data2.y, 40) then
245.                 tfm.exec.killPlayer(n2)
246.                 vampire.hunger = settings.maxHunger
247.                 break
248.               end
249.             end
250.             tasks[now + 5 * 1000] = function() ui.addBotText("يمكنك عض الفئران مرة أخرى!", n) end
251.             vampire.biting.Timer = now
252.           else
253.             ui.addBotText("عليك أن تنتظر 5 ثوان قبل اللقمة التالية!", n)
254.           end
255.         else
256.           ui.addBotText("لا يمكنك أن تعض عندما يكون لديك جبن!", n)
257.         end
258.       end
259.     end
260.   end
261.
262.   function eventLoop(passed, left)
263.     local now = os.time()
265.       if when <= now then
268.       end
269.     end
270.
271.     if canShoot then
272.       for n, data in pairs(tfm.get.room.playerList) do
273.         local vampire = vampires[n]
274.         if not data.isDead and vampire then
275.
276.           if not vampiresWon then
277.             if #cheese > 0 then
278.               for i, loc in ipairs(cheese) do
279.                 if pythag(data.x, data.y, loc.x, loc.y, 10) then
280.                   tfm.exec.giveCheese(n)
281.                   break
282.                 end
283.               end
284.             end
285.             if #hole > 0 and not vampire.biting.Allow then
286.               for i, loc in ipairs(hole) do
287.                 if pythag(data.x, data.y, loc.x, loc.y, 10) then
288.                   eventPlayerWon(n)
289.                   break
290.                 end
291.               end
292.             end
293.
294.             vampire.hunger = vampire.hunger - 0.5
295.
296.             if vampire.hunger <= 0 then tfm.exec.killPlayer(n) end
297.           end
298.         end
299.         showBar(n)
300.       end
301.     end
302.
303.     if respawnTimer == 0 and left > 10000 then
304.       for n, data in pairs(tfm.get.room.playerList) do
305.         local mouse = mice[n]
306.         if data.isDead and playing[n] then
307.           tfm.exec.respawnPlayer(n)
308.         elseif mouse and mouse.shooting.Arrows < settings.maxArrows then
309.           mouse.shooting.Arrows = mouse.shooting.Arrows + 1
310.         end
311.       end
312.     end
313.
314.     if passed > 6000 and not canShoot then
315.       canShoot = true
316.     end
317.
318.     if left <= 5000 then
319.       local num = math.floor(left / 1000)
320.       if num >= 1 and num <= 5 and not vampiresWon then
321.         for n in pairs(tfm.get.room.playerList) do
322.           local mouse = mice[n]
323.           if mouse then tfm.exec.giveCheese(n) tfm.exec.playerVictory(n) end
324.         end
325.       end
326.       if num < 1 then
327.         startRound()
328.       end
329.     end
330.
331.     respawnTimer = (respawnTimer + 0.5) % settings.timeTillRespawn
332.     timeLeft = left / 1000
333.   end
334.
335.   function eventMouse(n, x, y)
336.     local now = os.time()
337.     local data = tfm.get.room.playerList[n]
338.     local mouse = mice[n]
339.     if canShoot and mouse and not data.isDead and not vampiresWon then
340.       if not data.movingRight and not data.movingLeft then
341.         if mouse.shooting.Arrows > 0 then
342.           local timer = mouse.shooting.Timer
343.           local force = 10
344.           if timer < now - 500 then
345.             if timer < now - 6000 then
346.               force = 28
347.             elseif timer < now - 5000 then
348.               force = 26
349.             elseif timer < now - 4000 then
350.               force = 24
351.             elseif timer < now - 3000 then
352.               force = 22
353.             elseif timer < now - 2000 then
354.               force = 20
355.             else
356.               force = 18
357.             end
358.             if data.isJumping then
359.               force = force + 2
360.             end
361.             local angle = math.atan2(y - data.y, x - data.x)
362.             local id = tfm.exec.addShamanObject(35, data.x + 50 * math.cos(angle), data.y + 50 * math.sin(angle), math.deg(angle), math.cos(angle) * force, math.sin(angle) * force)
363.             tasks[now + (2 * 1000)] = function() tfm.exec.removeObject(id) end;
364.             mouse.shooting.Arrows = mouse.shooting.Arrows - 1
365.             mouse.shooting.Timer = now
366.           else
367.             ui.addBotText("لا يمكنك إطلاق النار مباشرة بعد ظهور السهم!", n)
368.           end
369.         else
370.           ui.addBotText("ليس لديك المزيد من الأسهم في هذه الجولة!", n)
371.         end
372.       else
373.         ui.addBotText("لا يمكنك إطلاق النار والتحرك في نفس الوقت!", n)
374.       end
375.     else
376.       ui.addBotText("لا يمكنك إطلاق النار!", n)
377.     end
378.   end
379.
380.   function eventPlayerRespawn(n)
381.     local mouse = mice[n]
382.     local vampire = vampires[n]
383.
384.     -- Teleport the players.
385.     playing[n] = false
386.     if mouse then
387.       resetMouse(n)
388.       tfm.exec.movePlayer(n, currentMap.mouseSpawn.x, currentMap.mouseSpawn.y);
389.     elseif vampire then
390.       resetVampire(n)
391.       tfm.exec.setVampirePlayer(n)
392.       tfm.exec.movePlayer(n, currentMap.vampireSpawn.x, currentMap.vampireSpawn.y);
393.     end
394.   end
395.
396.   function eventPlayerGetCheese(n)
397.     local mouse = mice[n]
398.     local vampire = vampires[n]
399.
400.     if mouse and timeLeft > 10 then
401.       tfm.exec.killPlayer(n)
402.       ui.addBotText("لا يمكنك أخذ الجبن الذي تحصل عليه. فأنت تستحق الموت.", n)
403.     elseif vampire then
404.       vampire.biting.Allow = false
405.       vampire.hunger = settings.maxHunger
406.     end
407.   end
408.
409.   function eventPlayerWon(n)
410.     local vampire = vampires[n]
411.
412.     if vampire then
413.       ui.setMapName(n.." أوصل الجبن إلى الجحر وسجل نقطة لفريق مصاصي الدماء!\n")
414.       vampiresWon = true
415.     else
416.       ui.setMapName("!دافعت الفئران عن الجبن بنجاح وفازت. مرحى!\n")
417.     end
418.     tfm.exec.setGameTime(10);
419.   end
420.
421.   function eventNewPlayer(n)
422.     if not players[n] then
423.       players[n] = {botType = 3}
424.     end
425.
426.     eventChatCommand(n, "help");
427.   end
428.
429.   function eventTextAreaCallback(id, n, cb)
430.     local player = players[n]
431.     if player then
432.       if cb == "bot_popup" then
433.         player.botType = player.botType + 1
434.         if player.botType > #bot then
435.           player.botType = 1
436.         end
437.       end
438.     end
439.   end
440.
441.   function eventChatCommand(n, cmd)
442.     local arg = {}
443.     for args in cmd:gmatch("[^%s]+") do
444.       table.insert(arg, args:lower())
445.     end
446.
448.       if cmd == "map" or cmd == "skip" then
449.         startRound()
450.       elseif cmd:sub(1, 4) == "time" and tonumber(cmd:sub(6)) then
451.         local time = cmd:sub(6, 7);
452.         tfm.exec.setGameTime(time);
453.       elseif (arg[1] == "mice" or arg[1] == "mouse" or arg[1] == "vampire" or arg[1] == "vampires" or arg[1] == "vamp") and tostring(arg[2]) then
454.         local n2 = capitalize(arg[2])
455.         if arg[1] == "mice" or arg[1] == "mouse" then
456.           vampires[n2] = nil
457.           resetMouse(n2)
458.           ui.addBotText("أنت الأن فأر! أحمي الجبن من مصاصي الدماء بأستخدام الأسهم (زر الفأرة الايسر))!", n2)
459.         elseif arg[1] == "vampire" or arg[1] == "vampires" or arg[1] == "vamp" then
460.           mice[n2] = nil
461.           resetVampire(n2)
462.           ui.addBotText("انت الأن مصاص الدماء! خذ الجبن من الفئران وقم بتسليمها إلى الجحر! اضغط على السهم الأعلى للطيران والمسافة للدغة!", n2)
463.         end
464.         tfm.exec.killPlayer(n2)
465.       end
466.     end
467.     if cmd == "help" or cmd == "guide" or cmd == "info" or cmd == "tutorial" then
468.       ui.addPopup(1, 0, "مرحبًا بكم في غرفة فانكورب! هذا هو دليل لعبتك! <br> في هذه اللعبة ستلعب دور فأر أو مصاص دماء. بصفتك فأرًا ، يجب عليك حماية الجبن الخاص بك من مصاصي الدماء ومنعها من الوصول إلى الجحر! للقيام بذلك ، لديك <u> أسهم </ u> يمكنك إطلاقها بالنقر فوق <b> زر الماوس الأيسر </ b>. <br> <br> بصفتك مصاص دماء ، يجب أن تأخذ الجبن وتسليمه إلى الجحر. للطيران ، اضغط على <u> السهم لأعلى </ u> للدغة والقتل ، اضغط <b>المسافة</b>.", n, 150, 110, 500, true)
469.     end
470.   end
471.
472.   main()
RAW Paste Data