Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Wklejka 1qgj9bw2n334c dodana przez SqNw0w, 17.07.2012 05:37
Typ:



soccerjam
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.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
459.
460.
461.
462.
463.
464.
465.
466.
467.
468.
469.
470.
471.
472.
473.
474.
475.
476.
477.
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
494.
495.
496.
497.
498.
499.
500.
501.
502.
503.
504.
505.
506.
507.
508.
509.
510.
511.
512.
513.
514.
515.
516.
517.
518.
519.
520.
521.
522.
523.
524.
525.
526.
527.
528.
529.
530.
531.
532.
533.
534.
535.
536.
537.
538.
539.
540.
541.
542.
543.
544.
545.
546.
547.
548.
549.
550.
551.
552.
553.
554.
555.
556.
557.
558.
559.
560.
561.
562.
563.
564.
565.
566.
567.
568.
569.
570.
571.
572.
573.
574.
575.
576.
577.
578.
579.
580.
581.
582.
583.
584.
585.
586.
587.
588.
589.
590.
591.
592.
593.
594.
595.
596.
597.
598.
599.
600.
601.
602.
603.
604.
605.
606.
607.
608.
609.
610.
611.
612.
613.
614.
615.
616.
617.
618.
619.
620.
621.
622.
623.
624.
625.
626.
627.
628.
629.
630.
631.
632.
633.
634.
635.
636.
637.
638.
639.
640.
641.
642.
643.
644.
645.
646.
647.
648.
649.
650.
651.
652.
653.
654.
655.
656.
657.
658.
659.
660.
661.
662.
663.
664.
665.
666.
667.
668.
669.
670.
671.
672.
673.
674.
675.
676.
677.
678.
679.
680.
681.
682.
683.
684.
685.
686.
687.
688.
689.
690.
691.
692.
693.
694.
695.
696.
697.
698.
699.
700.
701.
702.
703.
704.
705.
706.
707.
708.
709.
710.
711.
712.
713.
714.
715.
716.
717.
718.
719.
720.
721.
722.
723.
724.
725.
726.
727.
728.
729.
730.
731.
732.
733.
734.
735.
736.
737.
738.
739.
740.
741.
742.
743.
744.
745.
746.
747.
748.
749.
750.
751.
752.
753.
754.
755.
756.
757.
758.
759.
760.
761.
762.
763.
764.
765.
766.
767.
768.
769.
770.
771.
772.
773.
774.
775.
776.
777.
778.
779.
780.
781.
782.
783.
784.
785.
786.
787.
788.
789.
790.
791.
792.
793.
794.
795.
796.
797.
798.
799.
800.
801.
802.
803.
804.
805.
806.
807.
808.
809.
810.
811.
812.
813.
814.
815.
816.
817.
818.
819.
820.
821.
822.
823.
824.
825.
826.
827.
828.
829.
830.
831.
832.
833.
834.
835.
836.
837.
838.
839.
840.
841.
842.
843.
844.
845.
846.
847.
848.
849.
850.
851.
852.
853.
854.
855.
856.
857.
858.
859.
860.
861.
862.
863.
864.
865.
866.
867.
868.
869.
870.
871.
872.
873.
874.
875.
876.
877.
878.
879.
880.
881.
882.
883.
884.
885.
886.
887.
888.
889.
890.
891.
892.
893.
894.
895.
896.
897.
898.
899.
900.
901.
902.
903.
904.
905.
906.
907.
908.
909.
910.
911.
912.
913.
914.
915.
916.
917.
918.
919.
920.
921.
922.
923.
924.
925.
926.
927.
928.
929.
930.
931.
932.
933.
934.
935.
936.
937.
938.
939.
940.
941.
942.
943.
944.
945.
946.
947.
948.
949.
950.
951.
952.
953.
954.
955.
956.
957.
958.
959.
960.
961.
962.
963.
964.
965.
966.
967.
968.
969.
970.
971.
972.
973.
974.
975.
976.
977.
978.
979.
980.
981.
982.
983.
984.
985.
986.
987.
988.
989.
990.
991.
992.
993.
994.
995.
996.
997.
998.
999.
1000.
1001.
1002.
1003.
1004.
1005.
1006.
1007.
1008.
1009.
1010.
1011.
1012.
1013.
1014.
1015.
1016.
1017.
1018.
1019.
1020.
1021.
1022.
1023.
1024.
1025.
1026.
1027.
1028.
1029.
1030.
1031.
1032.
1033.
1034.
1035.
1036.
1037.
1038.
1039.
1040.
1041.
1042.
1043.
1044.
1045.
1046.
1047.
1048.
1049.
1050.
1051.
1052.
1053.
1054.
1055.
1056.
1057.
1058.
1059.
1060.
1061.
1062.
1063.
1064.
1065.
1066.
1067.
1068.
1069.
1070.
1071.
1072.
1073.
1074.
1075.
1076.
1077.
1078.
1079.
1080.
1081.
1082.
1083.
1084.
1085.
1086.
1087.
1088.
1089.
1090.
1091.
1092.
1093.
1094.
1095.
1096.
1097.
1098.
1099.
1100.
1101.
1102.
1103.
1104.
1105.
1106.
1107.
1108.
1109.
1110.
1111.
1112.
1113.
1114.
1115.
1116.
1117.
1118.
1119.
1120.
1121.
1122.
1123.
1124.
1125.
1126.
1127.
1128.
1129.
1130.
1131.
1132.
1133.
1134.
1135.
1136.
1137.
1138.
1139.
1140.
1141.
1142.
1143.
1144.
1145.
1146.
1147.
1148.
1149.
1150.
1151.
1152.
1153.
1154.
1155.
1156.
1157.
1158.
1159.
1160.
1161.
1162.
1163.
1164.
1165.
1166.
1167.
1168.
1169.
1170.
1171.
1172.
1173.
1174.
1175.
1176.
1177.
1178.
1179.
1180.
1181.
1182.
1183.
1184.
1185.
1186.
1187.
1188.
1189.
1190.
1191.
1192.
1193.
1194.
1195.
1196.
1197.
1198.
1199.
1200.
1201.
1202.
1203.
1204.
1205.
1206.
1207.
1208.
1209.
1210.
1211.
1212.
1213.
1214.
1215.
1216.
1217.
1218.
1219.
1220.
1221.
1222.
1223.
1224.
1225.
1226.
1227.
1228.
1229.
1230.
1231.
1232.
1233.
1234.
1235.
1236.
1237.
1238.
1239.
1240.
1241.
1242.
1243.
1244.
1245.
1246.
1247.
1248.
1249.
1250.
1251.
1252.
1253.
1254.
1255.
1256.
1257.
1258.
1259.
1260.
1261.
1262.
1263.
1264.
1265.
1266.
1267.
1268.
1269.
1270.
1271.
1272.
1273.
1274.
1275.
1276.
1277.
1278.
1279.
1280.
1281.
1282.
1283.
1284.
1285.
1286.
1287.
1288.
1289.
1290.
1291.
1292.
1293.
1294.
1295.
1296.
1297.
1298.
1299.
1300.
1301.
1302.
1303.
1304.
1305.
1306.
1307.
1308.
1309.
1310.
1311.
1312.
1313.
1314.
1315.
1316.
1317.
1318.
1319.
1320.
1321.
1322.
1323.
1324.
1325.
1326.
1327.
1328.
1329.
1330.
1331.
1332.
1333.
1334.
1335.
1336.
1337.
1338.
1339.
1340.
1341.
1342.
1343.
1344.
1345.
1346.
1347.
1348.
1349.
1350.
1351.
1352.
1353.
1354.
1355.
1356.
1357.
1358.
1359.
1360.
1361.
1362.
1363.
1364.
1365.
1366.
1367.
1368.
1369.
1370.
1371.
1372.
1373.
1374.
1375.
1376.
1377.
1378.
1379.
1380.
1381.
1382.
1383.
1384.
1385.
1386.
1387.
1388.
1389.
1390.
1391.
1392.
1393.
1394.
1395.
1396.
1397.
1398.
1399.
1400.
1401.
1402.
1403.
1404.
1405.
1406.
1407.
1408.
1409.
1410.
1411.
1412.
1413.
1414.
1415.
1416.
1417.
1418.
1419.
1420.
1421.
1422.
1423.
1424.
1425.
1426.
1427.
1428.
1429.
1430.
1431.
1432.
1433.
1434.
1435.
1436.
1437.
1438.
1439.
1440.
1441.
1442.
1443.
1444.
1445.
1446.
1447.
1448.
1449.
1450.
1451.
1452.
1453.
1454.
1455.
1456.
1457.
1458.
1459.
1460.
1461.
1462.
1463.
1464.
1465.
1466.
1467.
1468.
1469.
1470.
1471.
1472.
1473.
1474.
1475.
1476.
1477.
1478.
1479.
1480.
1481.
1482.
1483.
1484.
1485.
1486.
1487.
1488.
1489.
1490.
1491.
1492.
1493.
1494.
1495.
1496.
1497.
1498.
1499.
1500.
1501.
1502.
1503.
1504.
1505.
1506.
1507.
1508.
1509.
1510.
1511.
1512.
1513.
1514.
1515.
1516.
1517.
1518.
1519.
1520.
1521.
1522.
1523.
1524.
1525.
1526.
1527.
1528.
1529.
1530.
1531.
1532.
1533.
1534.
1535.
1536.
1537.
1538.
1539.
1540.
1541.
1542.
1543.
1544.
1545.
1546.
1547.
1548.
1549.
1550.
1551.
1552.
1553.
1554.
1555.
1556.
1557.
1558.
1559.
1560.
1561.
1562.
1563.
1564.
1565.
1566.
1567.
1568.
1569.
1570.
1571.
1572.
1573.
1574.
1575.
1576.
1577.
1578.
1579.
1580.
1581.
1582.
1583.
1584.
1585.
1586.
1587.
1588.
1589.
1590.
1591.
1592.
1593.
1594.
1595.
1596.
1597.
1598.
1599.
1600.
1601.
1602.
1603.
1604.
1605.
1606.
1607.
1608.
1609.
1610.
1611.
1612.
1613.
1614.
1615.
1616.
1617.
1618.
1619.
1620.
1621.
1622.
1623.
1624.
1625.
1626.
1627.
1628.
1629.
1630.
1631.
1632.
1633.
1634.
1635.
1636.
1637.
1638.
1639.
1640.
1641.
1642.
1643.
1644.
1645.
1646.
1647.
1648.
1649.
1650.
1651.
1652.
1653.
1654.
1655.
1656.
1657.
1658.
1659.
1660.
1661.
1662.
1663.
1664.
1665.
1666.
1667.
1668.
1669.
1670.
1671.
1672.
1673.
1674.
1675.
1676.
1677.
1678.
1679.
1680.
1681.
1682.
1683.
1684.
1685.
1686.
1687.
1688.
1689.
1690.
1691.
1692.
1693.
1694.
1695.
1696.
1697.
1698.
1699.
1700.
1701.
1702.
1703.
1704.
1705.
1706.
1707.
1708.
1709.
1710.
1711.
1712.
1713.
1714.
1715.
1716.
1717.
1718.
1719.
1720.
1721.
1722.
1723.
1724.
1725.
1726.
1727.
1728.
1729.
1730.
1731.
1732.
1733.
1734.
1735.
1736.
1737.
1738.
1739.
1740.
1741.
1742.
1743.
1744.
1745.
1746.
1747.
1748.
1749.
1750.
1751.
1752.
1753.
1754.
1755.
1756.
1757.
1758.
1759.
1760.
1761.
1762.
1763.
1764.
1765.
1766.
1767.
1768.
1769.
1770.
1771.
1772.
1773.
1774.
1775.
1776.
1777.
1778.
1779.
1780.
1781.
1782.
1783.
1784.
1785.
1786.
1787.
1788.
1789.
1790.
1791.
1792.
1793.
1794.
1795.
1796.
1797.
1798.
1799.
1800.
1801.
1802.
1803.
1804.
1805.
1806.
1807.
1808.
1809.
1810.
1811.
1812.
1813.
1814.
1815.
1816.
1817.
1818.
1819.
1820.
1821.
1822.
1823.
1824.
1825.
1826.
1827.
1828.
1829.
1830.
1831.
1832.
1833.
1834.
1835.
1836.
1837.
1838.
1839.
1840.
1841.
1842.
1843.
1844.
1845.
1846.
1847.
1848.
1849.
1850.
1851.
1852.
1853.
1854.
1855.
1856.
1857.
1858.
1859.
1860.
1861.
1862.
1863.
1864.
1865.
1866.
1867.
1868.
1869.
1870.
1871.
1872.
1873.
1874.
1875.
1876.
1877.
1878.
1879.
1880.
1881.
1882.
1883.
1884.
1885.
1886.
1887.
1888.
1889.
1890.
1891.
1892.
1893.
1894.
1895.
1896.
1897.
1898.
1899.
1900.
1901.
1902.
1903.
1904.
1905.
1906.
1907.
1908.
1909.
1910.
1911.
1912.
1913.
1914.
1915.
1916.
1917.
1918.
1919.
1920.
1921.
1922.
1923.
1924.
1925.
1926.
1927.
1928.
1929.
1930.
1931.
1932.
1933.
1934.
1935.
1936.
1937.
1938.
1939.
1940.
1941.
1942.
1943.
1944.
1945.
1946.
1947.
1948.
1949.
1950.
1951.
1952.
1953.
1954.
1955.
1956.
1957.
1958.
1959.
1960.
1961.
1962.
1963.
1964.
1965.
1966.
1967.
1968.
1969.
1970.
1971.
1972.
1973.
1974.
1975.
1976.
1977.
1978.
1979.
1980.
1981.
1982.
1983.
1984.
1985.
1986.
1987.
1988.
1989.
1990.
1991.
1992.
1993.
1994.
1995.
1996.
1997.
1998.
1999.
2000.
2001.
2002.
2003.
2004.
2005.
2006.
2007.
2008.
2009.
2010.
2011.
2012.
2013.
2014.
2015.
2016.
2017.
2018.
2019.
2020.
2021.
2022.
2023.
2024.
2025.
2026.
2027.
2028.
2029.
2030.
2031.
2032.
2033.
2034.
2035.
2036.
2037.
2038.
2039.
2040.
2041.
2042.
2043.
2044.
2045.
2046.
2047.
2048.
2049.
2050.
2051.
2052.
2053.
2054.
2055.
2056.
2057.
2058.
2059.
2060.
2061.
2062.
2063.
2064.
2065.
2066.
2067.
2068.
2069.
2070.
2071.
2072.
2073.
2074.
2075.
2076.
2077.
2078.
2079.
2080.
2081.
2082.
2083.
2084.
2085.
2086.
2087.
2088.
2089.
2090.
2091.
2092.
2093.
2094.
2095.
2096.
2097.
2098.
2099.
2100.
2101.
2102.
2103.
2104.
2105.
2106.
2107.
2108.
2109.
2110.
2111.
2112.
2113.
2114.
2115.
2116.
2117.
2118.
2119.
2120.
2121.
2122.
2123.
2124.
2125.
2126.
2127.
2128.
2129.
2130.
2131.
2132.
2133.
2134.
2135.
2136.
2137.
2138.
2139.
2140.
2141.
2142.
2143.
2144.
2145.
2146.
2147.
2148.
2149.
2150.
2151.
2152.
2153.
2154.
2155.
2156.
2157.
2158.
2159.
2160.
2161.
2162.
2163.
2164.
2165.
2166.
2167.
2168.
2169.
2170.
2171.
2172.
2173.
2174.
2175.
2176.
2177.
2178.
2179.
2180.
2181.
2182.
2183.
2184.
2185.
2186.
2187.
2188.
2189.
2190.
2191.
2192.
2193.
2194.
2195.
2196.
2197.
2198.
2199.
2200.
2201.
2202.
2203.
2204.
2205.
2206.
2207.
2208.
2209.
2210.
2211.
2212.
2213.
2214.
2215.
2216.
2217.
2218.
2219.
2220.
2221.
2222.
2223.
2224.
2225.
2226.
2227.
2228.
2229.
2230.
2231.
2232.
2233.
// This is a modified version of OneEyed Soccer Jam plugin.
// You may want to get the original:
// http://forums.alliedmods.net/showthread.php?t=41447
 
#pragma dynamic 131072 //I used to much memory =(
/*
 *	CVARs:
 *		- These CVARS can be changed at any time during round!
 *		sj_kick 		(default: 650)	- Default Kicking Speed.
 *		sj_score 		(default: 15)	- Scores needed to win a round.
 *		sj_reset 		(default: 30.0)	- Ball reset time, to respawn at ball spawn location.
 *		sj_goalsafety 	(default: 650)	- Distance around Mascot, that does damage to enemy.
 *		sj_random		(default: 1)	- Turns Team Randomizing ON/OFF.
 *
 *	Requires:	AMXX 1.75+
 *
 *	Author:		OneEyed
 *	IRC:		#soccerjam (irc.gamesurge.net)
 *	Website:	http://www.soccer-jam.com/
 */
 
/* ------------------------------------------------------------------------- */
/* /----------------------- START OF CUSTOMIZATION  -----------------------/ */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* /------------  CUSTOM DEFINES  ------------ CUSTOM DEFINES  ------------/ */
/* ------------------------------------------------------------------------- */
 
// Disable knife disarm ? (Leaves only ball disarm)
// Comment this define to disable.
#define KNIFE_DISARM_ON
 
//When player reaches MAX level, they receive this many levels.
#define MAX_LVL_BONUS 1
 
//Max levels for each upgrade
#define MAX_LVL_STAMINA		7
#define MAX_LVL_STRENGTH	12
#define MAX_LVL_AGILITY		10
#define MAX_LVL_DEXTERITY	10
#define MAX_LVL_DISARM		10
#define MAX_LVL_POWERPLAY	10
 
//Prices for each upgrade.
//price = ((UpgradeLevel * UpgradePrice) / 2) + UpgradePrice
#define EXP_PRICE_STAMINA	250
#define EXP_PRICE_STRENGTH	150
#define EXP_PRICE_AGILITY	350
#define EXP_PRICE_DEXTERITY	150
#define EXP_PRICE_DISARM	150
 
//Experience per stat.
#define EXP_GOALY	400 //for goaly save and goaly points.
#define EXP_STEAL 	500
#define EXP_KILL 	300
#define EXP_ASSIST	500
#define EXP_GOAL        600
 
#define BASE_HP 100		  	//starting hp
#define BASE_SPEED 	250.0 	//starting run speed
#define BASE_DISARM	10 		//starting disarm from lvl 1
 
#define COUNTDOWN_TIME 10	//Countdown time between rounds.
#define GOALY_DELAY 8.0		//Delay for goaly exp
 
//Curve Ball Defines
#define CURVE_ANGLE		5	//Angle for spin kick multipled by current direction.
#define CURVE_COUNT		6	//Curve this many times.
#define CURVE_TIME		0.07	//Time to curve again.
#define DIRECTIONS		5	//# of angles allowed.
#define	ANGLEDIVIDE		6	//Divide angle this many times for curve.
 
//Misc. amounts
#define AMOUNT_LATEJOINEXP	325	//latejoinexp * each scored point.
#define AMOUNT_POWERPLAY 	8	//added bonus to STR and AGI per powerplay lvl.
#define AMOUNT_GOALY 		10	//Goaly camper exp
 
//Amount of points for each upgrade.
#define AMOUNT_STA 		20	//Health per lvl
#define AMOUNT_STR 		23	//Stronger kicking per lvl
#define AMOUNT_AGI 		13	//Faster Speed per lvl
#define AMOUNT_DEX 		10	//Better Catching
#define AMOUNT_DISARM 	3	//Disarm ball chance (disarm lvl * this) if random num 1-100 < disarm
 
#define DISARM_MULTIPLIER 3
/* ------------------------------------------------------------------------- */
/* /----------------  TEAM NAMES  ------------ TEAM NAMES  ------------/ */
/* ------------------------------------------------------------------------- */
 
#define TEAMS 4 //Don't edit this.
 
//Names to be put on scoreboard.
static const TeamNames[TEAMS][] = {
	"BRAK",
	"Manchester United",	//Manchester United
	"Chelsea Londyn",	//Chelsea Londyn
	"BRAK"
}
/* ------------------------------------------------------------------------- */
/* /----------------  MODELS  ---------------- MODELS  ----------------/ */
/* ------------------------------------------------------------------------- */
//You may change the ball model. Just give correct path of new model.
new ball[] = "models/kickball/csk_ball.mdl"
 
static const TeamMascots[2][] = {
	"models/kingpin.mdl",	//TERRORIST MASCOT
	"models/garg.mdl"		//CT MASCOT
}
/* ------------------------------------------------------------------------- */
/* /----------------  COLORS  ---------------- COLORS  ----------------/ */
/* ------------------------------------------------------------------------- */
//Format is RGB 0-255
 
//TEAM MODEL GLOW COLORS
#define TERR_GLOW_RED	250
#define TERR_GLOW_GREEN	10
#define	TERR_GLOW_BLUE	10
 
#define CT_GLOW_RED		10
#define	CT_GLOW_GREEN	10
#define CT_GLOW_BLUE	250
 
//TEAM HUD METER COLOR (Turbo/Curve Angle meters)
#define TERR_METER_RED		250
#define TERR_METER_GREEN	10
#define	TERR_METER_BLUE		10
 
#define CT_METER_RED	10
#define	CT_METER_GREEN	10
#define CT_METER_BLUE	250
 
//BALL GLOW COLOR (default: yellow) //it glows only one color
#define BALL_RED	255
#define BALL_GREEN	200
#define BALL_BLUE	100
 
//BALL BEAM
#define BALL_BEAM_WIDTH		5
#define BALL_BEAM_LIFE		10
#define BALL_BEAM_RED		50
#define BALL_BEAM_GREEN		50
#define BALL_BEAM_BLUE		150
#define BALL_BEAM_ALPHA		255
 
/* ------------------------------------------------------------------------- */
/* /----------------  SOUNDS  ---------------- SOUNDS  ----------------/ */
/* ------------------------------------------------------------------------- */
//-- NOTE: Sounds must be located in sound/kickball/ folder.
 
new BALL_BOUNCE_GROUND[] = "kickball/bounce.wav"
new BALL_RESPAWN[] = "kickball/returned.wav"
new BALL_KICKED[] = "kickball/kicked.wav"
new BALL_PICKED_UP[] = "kickball/gotball.wav"
new UPGRADED_MAX_LEVEL[] = "kickball/levelup.wav"
new ROUND_START[] = "kickball/prepare.wav"
new SCORED_GOAL[] = "kickball/distress.wav"
new STOLE_BALL_FAST[] = "kickball/pussy.wav"
 
//When a goal is scored, one of these will randomly play.
#define MAX_SOUNDS 6
new SCORED_SOUNDS[MAX_SOUNDS][] = {
	"kickball/amaze.wav",
	"kickball/laugh.wav",
	"kickball/perfect.wav",
	"kickball/diebitch.wav",
	"kickball/bday.wav",
	"kickball/boomchakalaka.wav"
}
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* /------------------------ END OF CUSTOMIZATION  ------------------------/ */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
 
/* ------------ DO NOT EDIT BELOW ---------------------------------------------------------- */
/* -------------------------- DO NOT EDIT BELOW -------------------------------------------- */
/* --------------------------------------- DO NOT EDIT BELOW ------------------------------- */
/* ---------------------------------------------------- DO NOT EDIT BELOW ------------------ */
 
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
 
static const AUTHOR[] = "OneEyed"
static const VERSION[] = "2.07a1"
 
#define MAX_TEXT_BUFFER		2047
#define MAX_NAME_LENGTH		33
#define MAX_PLAYER			33
#define MAX_ASSISTERS		3
#define MAX_BALL_SPAWNS		5
#define POS_X 		-1.0
#define POS_Y 		0.85
#define HUD_CHANNEL 4
#define MESSAGE_DELAY 4.0
 
enum {
	UNASSIGNED = 0,
	T,
	CT,
	SPECTATOR
}
 
#define RECORDS 6
enum {
	GOAL = 1,
	ASSIST,
	STEAL,
	KILL,
	DISTANCE,
	GOALY
}
 
#define UPGRADES 5
enum {
	STA = 1,	//stamina
	STR,		//strength
	AGI,		//agility
	DEX,		//dexterity
	DISARM,
}
 
static const UpgradeTitles[UPGRADES+1][] = {
	"BRAK",
	"Zycie",
	"Sila Kopniecia",
	"Szybkosc",
	"Lapanie Pilki",
	"Rozbrajanie"
}
 
new const UpgradeMax[UPGRADES+1] = {
	0, //NULL
	MAX_LVL_STAMINA, 	//STAMINA
	MAX_LVL_STRENGTH, 	//STRENGTH
	MAX_LVL_AGILITY, 	//AGILITY
	MAX_LVL_DEXTERITY, 	//DEXTERITY
	MAX_LVL_DISARM, 	//DISARM
}
 
new const UpgradePrice[UPGRADES+1] = {
	0, //NULL
	EXP_PRICE_STAMINA,
	EXP_PRICE_STRENGTH,
	EXP_PRICE_AGILITY,
	EXP_PRICE_DEXTERITY,
	EXP_PRICE_DISARM,
}
 
new TeamColors[TEAMS][3] =
{
	{ 0, 0, 0 },
	{ TERR_GLOW_RED, TERR_GLOW_GREEN, TERR_GLOW_BLUE } ,
	{ CT_GLOW_RED, CT_GLOW_GREEN, CT_GLOW_BLUE },
	{ 0, 0, 0 }
}
 
new TeamMeterColors[TEAMS][3] =
{
	{ 0, 0, 0 },
	{ TERR_METER_RED, TERR_METER_GREEN, TERR_METER_BLUE } ,
	{ CT_METER_RED, CT_METER_GREEN, CT_METER_BLUE },
	{ 0, 0, 0 }
}
 
 
new ballcolor[3] = { BALL_RED, BALL_GREEN, BALL_BLUE }
new PlayerUpgrades[MAX_PLAYER][UPGRADES+1]
new GoalEnt[TEAMS]
new PressedAction[MAX_PLAYER]
new seconds[MAX_PLAYER]
new g_sprint[MAX_PLAYER]
new SideJump[MAX_PLAYER]
new Float:SideJumpDelay[MAX_PLAYER]
new PlayerDeaths[MAX_PLAYER]
new PlayerKills[MAX_PLAYER]
new curvecount
new direction
new maxplayers
new Float:BallSpinDirection[3]
new ballspawncount
new Float:TeamBallOrigins[TEAMS][3]
new Float:TEMP_TeamBallOrigins[3]
new Mascots[TEAMS]
new Float:MascotsOrigins[3]
new Float:MascotsAngles[3]
new menu_upgrade[MAX_PLAYER]
new Float:fire_delay
new winner
new Float:GoalyCheckDelay[MAX_PLAYER]
new GoalyCheck[MAX_PLAYER]
new GoalyPoints[MAX_PLAYER]
new Float:BallSpawnOrigin[MAX_BALL_SPAWNS][3]
new TopPlayer[2][RECORDS+1]
new MadeRecord[MAX_PLAYER][RECORDS+1]
new TopPlayerName[RECORDS+1][MAX_NAME_LENGTH]
new g_Experience[MAX_PLAYER]
new timer
new Float:testorigin[3]
new Float:velocity[3]
new score[TEAMS]
new scoreboard[1025]
new temp1[64], temp2[64]
new distorig[2][3] //distance recorder
new gmsgShake
new gmsgDeathMsg
new gmsgSayText
new gmsgTextMsg
new goaldied[MAX_PLAYER]
new bool:is_dead[MAX_PLAYER]
new terr[33], ct[33], cntCT, cntT
new PowerPlay, powerplay_list[MAX_LVL_POWERPLAY+1]
new assist[16]
new iassist[TEAMS]
new gamePlayerEquip
new CVAR_SCORE
new CVAR_RESET
new CVAR_GOALSAFETY
new CVAR_KICK
new Float:CVAR_RESPAWN
new CVAR_RANDOM
new CVAR_KILLNEARBALL
new CVAR_KILLNEARHOLDER
new fire
new smoke
new beamspr
new g_fxBeamSprite
new Burn_Sprite
new ballholder
new ballowner
new aball
new is_kickball
new g_TimeLimit;
new bool:has_knife[MAX_PLAYER]
 
new pop=1
 
new OFFSET_INTERNALMODEL;
 
/*====================================================================================================
 [Precache]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
PrecacheSounds() {
	new x
	for(x=0;x<MAX_SOUNDS;x++)
		engfunc( EngFunc_PrecacheSound, SCORED_SOUNDS[x])
 
	engfunc( EngFunc_PrecacheSound, STOLE_BALL_FAST)
	engfunc( EngFunc_PrecacheSound, ROUND_START)
	engfunc( EngFunc_PrecacheSound, BALL_BOUNCE_GROUND)
	engfunc( EngFunc_PrecacheSound, BALL_PICKED_UP)
	engfunc( EngFunc_PrecacheSound, BALL_RESPAWN)
	engfunc( EngFunc_PrecacheSound, SCORED_GOAL)
	engfunc( EngFunc_PrecacheSound, BALL_KICKED)
	engfunc( EngFunc_PrecacheSound, UPGRADED_MAX_LEVEL)
}
 
PrecacheBall() {
	engfunc( EngFunc_PrecacheModel, ball)
}
 
PrecacheMonsters(team) {
	engfunc( EngFunc_PrecacheModel, TeamMascots[team-1])
}
 
PrecacheSprites() {
	beamspr = engfunc( EngFunc_PrecacheModel,"sprites/laserbeam.spr")
	fire = engfunc( EngFunc_PrecacheModel,"sprites/shockwave.spr")
	smoke = engfunc( EngFunc_PrecacheModel,"sprites/steam1.spr")
	Burn_Sprite = engfunc( EngFunc_PrecacheModel,"sprites/xfireball3.spr")
	g_fxBeamSprite = engfunc( EngFunc_PrecacheModel,"sprites/lgtning.spr")
}
 
PrecacheOther() {
	engfunc( EngFunc_PrecacheModel, "models/chick.mdl")
}
 
/*====================================================================================================
 [Initialize]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
public plugin_init() {
 
	new mapname[64]
	get_mapname(mapname,63)
 
	register_cvar("soccer_jam_online", "0", FCVAR_SERVER)
	register_cvar("soccer_jam_version", VERSION, FCVAR_SERVER)
	set_cvar_string("soccer_jam_version", VERSION)
	register_dictionary("soccerjam.txt")
	register_dictionary("soccerjam_help.txt")
	if(is_kickball > 0)
	{
		PrecacheSprites()
 
		register_plugin("Soccer Jam(ON)", VERSION, AUTHOR)
		set_cvar_num("soccer_jam_online", 1)
 
		timer = COUNTDOWN_TIME
 
		gmsgTextMsg = get_user_msgid("TextMsg")
		gmsgDeathMsg = get_user_msgid("DeathMsg")
		gmsgShake = get_user_msgid("ScreenShake")
		gmsgSayText = get_user_msgid("SayText")
 
		maxplayers = get_maxplayers()
 
		if(equali(mapname,"soccerjam")) {
			PrecacheOther()
			CreateGoalNets()
			create_wall()
		}
 
		register_clcmd("say","handle_say")
 
		register_event("ResetHUD", "Event_ResetHud", "be")
		register_event("HLTV","Event_StartRound","a","1=0","2=0")
		register_event("Damage", "Event_Damage", "b", "2!0", "3=0", "4!0" )
 
		CVAR_SCORE = register_cvar("sj_score","15")
		CVAR_RESET = register_cvar("sj_reset","30.0")
		CVAR_GOALSAFETY = register_cvar("sj_goalsafety","725")
		CVAR_KICK = register_cvar("sj_kick","680")
		CVAR_RESPAWN = 2.0 //register_cvar("kickball_respawn","2.0")
		CVAR_RANDOM = register_cvar("sj_random","1")
		CVAR_KILLNEARBALL = register_cvar("sj_kill_distance_ball", "200.0")
		CVAR_KILLNEARHOLDER = register_cvar("sj_kill_distance_holder", "96.0")
 
		register_cvar( "sj_timelimit", "0" );
 
		register_cvar("SCORE_CT","0")
		register_cvar("SCORE_T","0")
 
		register_menucmd(register_menuid("Team_Select",1), (1<<0)|(1<<1)|(1<<4)|(1<<5), "team_select")
 
		register_touch("PwnBall", "player", 			"touchPlayer")
		register_touch("PwnBall", "soccerjam_goalnet",	"touchNet")
 
		register_touch("PwnBall", "worldspawn",			"touchWorld")
		register_touch("PwnBall", "func_wall",			"touchWorld")
		register_touch("PwnBall", "func_door",			"touchWorld")
		register_touch("PwnBall", "func_door_rotating", "touchWorld")
		register_touch("PwnBall", "func_wall_toggle",	"touchWorld")
		register_touch("PwnBall", "func_breakable",		"touchWorld")
		register_touch("PwnBall", "Blocker",			"touchBlocker")
		register_touch("player", "player","touchtouch")
 
		set_task(0.4,"meter",0,_,_,"b")
		set_task(0.5,"statusDisplay",7654321,"",0,"b")
 
		register_think("PwnBall","ball_think")
		register_think("Mascot", "mascot_think")
 
		register_clcmd("radio1", "LeftDirection", 0)
		register_clcmd("radio2", "RightDirection", 0)
		register_clcmd("drop","Turbo")
  	 	register_clcmd("lastinv","BuyUpgrade")
  	 	register_clcmd("fullupdate","fullupdate")
  	 	register_message(gmsgTextMsg, "editTextMsg")
 
  	 	register_event("ShowMenu", "menuclass", "b", "4&CT_Select", "4&Terrorist_Select");
  	 	register_event("VGUIMenu", "menuclass", "b", "1=26", "1=27");
 
  	 	OFFSET_INTERNALMODEL = is_amd64_server() ? 152 : 126;
	}
	else {
		register_plugin("Soccer Jam(OFF)", VERSION, AUTHOR)
		set_cvar_num("soccer_jam_online",0)
	}
	return PLUGIN_HANDLED
}
 
//public plugin_end() {
	//server_cmd("mp_timelimit %i", g_TimeLimit)
//}
 
/*====================================================================================================
 [Initialize Entities]
 
 Purpose:	Handles our custom entities, created with Valve Hammer, and fixes for soccerjam.bsp.
 
 Comment:	$$
 
====================================================================================================*/
public pfn_keyvalue(entid) {
 
	new classname[32], key[32], value[32]
	copy_keyvalue(classname, 31, key, 31, value, 31)
 
	new temp_origins[3][10], x, team
	new temp_angles[3][10]
 
	if(equal(key, "classname") && equal(value, "soccerjam_goalnet"))
		DispatchKeyValue("classname", "func_wall")
 
	if(equal(classname, "game_player_equip")){
		if(!is_kickball || !gamePlayerEquip)
			gamePlayerEquip = entid
		else {
			remove_entity(entid)
		}
	}
	else if(equal(classname, "func_wall"))
	{
		if(equal(key, "team"))
		{
			team = str_to_num(value)
			if(team == 1 || team == 2) {
				GoalEnt[team] = entid
				set_task(1.0, "FinalizeGoalNet", team)
			}
		}
	}
	else if(equal(classname, "soccerjam_mascot"))
	{
 
		if(equal(key, "team"))
		{
			team = str_to_num(value)
			create_mascot(team)
		}
		else if(equal(key, "origin"))
		{
			parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)
			for(x=0; x<3; x++)
				MascotsOrigins[x] = floatstr(temp_origins[x])
		}
		else if(equal(key, "angles"))
		{
			parse(value, temp_angles[0], 9, temp_angles[1], 9, temp_angles[2], 9)
			for(x=0; x<3; x++)
				MascotsAngles[x] = floatstr(temp_angles[x])
		}
	}
	else if(equal(classname, "soccerjam_teamball"))
	{
		if(equal(key, "team"))
		{
			team = str_to_num(value)
			for(x=0; x<3; x++)
				TeamBallOrigins[team][x] = TEMP_TeamBallOrigins[x]
		}
		else if(equal(key, "origin"))
		{
			parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)
			for(x=0; x<3; x++)
				TEMP_TeamBallOrigins[x] = floatstr(temp_origins[x])
		}
	}
	else if(equal(classname, "soccerjam_ballspawn"))
	{
		if(equal(key, "origin")) {
			is_kickball = 1
 
			create_Game_Player_Equip()
 
			PrecacheBall()
			PrecacheSounds()
 
			if(ballspawncount < MAX_BALL_SPAWNS) {
				parse(value, temp_origins[0], 9, temp_origins[1], 9, temp_origins[2], 9)
 
				BallSpawnOrigin[ballspawncount][0] = floatstr(temp_origins[0])
				BallSpawnOrigin[ballspawncount][1] = floatstr(temp_origins[1])
				BallSpawnOrigin[ballspawncount][2] = floatstr(temp_origins[2]) + 10.0
 
				ballspawncount++
			}
		}
	}
}
 
createball() {
 
	new entity = create_entity("info_target")
	if (entity) {
 
		entity_set_string(entity,EV_SZ_classname,"PwnBall")
		entity_set_model(entity, ball)
 
		entity_set_int(entity, EV_INT_solid, SOLID_BBOX)
		entity_set_int(entity, EV_INT_movetype, MOVETYPE_BOUNCE)
 
		new Float:MinBox[3]
		new Float:MaxBox[3]
		MinBox[0] = -15.0
		MinBox[1] = -15.0
		MinBox[2] = 0.0
		MaxBox[0] = 15.0
		MaxBox[1] = 15.0
		MaxBox[2] = 12.0
 
		entity_set_vector(entity, EV_VEC_mins, MinBox)
		entity_set_vector(entity, EV_VEC_maxs, MaxBox)
 
		glow(entity,ballcolor[0],ballcolor[1],ballcolor[2],10)
 
		entity_set_float(entity,EV_FL_framerate,0.0)
		entity_set_int(entity,EV_INT_sequence,0)
	}
	//save our entity ID to aball variable
	aball = entity
	entity_set_float(entity,EV_FL_nextthink,halflife_time() + 0.05)
	return PLUGIN_HANDLED
}
 
 
CreateGoalNets() {
 
	new endzone, x
	new Float:orig[3]
	new Float:MinBox[3], Float:MaxBox[3]
 
	for(x=1;x<3;x++) {
		endzone = create_entity("info_target")
		if (endzone) {
 
			entity_set_string(endzone,EV_SZ_classname,"soccerjam_goalnet")
			entity_set_model(endzone, "models/chick.mdl")
			entity_set_int(endzone, EV_INT_solid, SOLID_BBOX)
			entity_set_int(endzone, EV_INT_movetype, MOVETYPE_NONE)
 
			MinBox[0] = -25.0;	MinBox[1] = -145.0;	MinBox[2] = -36.0
			MaxBox[0] =  25.0;	MaxBox[1] =  145.0;	MaxBox[2] =  70.0
 
			entity_set_vector(endzone, EV_VEC_mins, MinBox)
			entity_set_vector(endzone, EV_VEC_maxs, MaxBox)
 
			switch(x) {
				case 1: {
					orig[0] = 2110.0
					orig[1] = 0.0
					orig[2] = 1604.0
				}
				case 2: {
					orig[0] = -2550.0
					orig[1] = 0.0
					orig[2] = 1604.0
				}
			}
 
			entity_set_origin(endzone,orig)
 
			entity_set_int(endzone, EV_INT_team, x)
			set_entity_visibility(endzone, 0)
			GoalEnt[x] = endzone
		}
	}
 
}
 
create_wall() {
	new wall = create_entity("func_wall")
	if(wall)
	{
		new Float:orig[3]
		new Float:MinBox[3], Float:MaxBox[3]
		entity_set_string(wall,EV_SZ_classname,"Blocker")
		entity_set_model(wall, "models/chick.mdl")
 
		entity_set_int(wall, EV_INT_solid, SOLID_BBOX)
		entity_set_int(wall, EV_INT_movetype, MOVETYPE_NONE)
 
		MinBox[0] = -72.0;	MinBox[1] = -100.0;	MinBox[2] = -72.0
		MaxBox[0] =  72.0;	MaxBox[1] =  100.0;	MaxBox[2] =  72.0
 
		entity_set_vector(wall, EV_VEC_mins, MinBox)
		entity_set_vector(wall, EV_VEC_maxs, MaxBox)
 
		orig[0] = 2355.0
		orig[1] = 1696.0
		orig[2] = 1604.0
		entity_set_origin(wall,orig)
		set_entity_visibility(wall, 0)
	}
}
 
create_mascot(team)
{
	new Float:MinBox[3], Float:MaxBox[3]
	new mascot = create_entity("info_target")
	if(mascot)
	{
		PrecacheMonsters(team)
		entity_set_string(mascot,EV_SZ_classname,"Mascot")
		entity_set_model(mascot, TeamMascots[team-1])
		Mascots[team] = mascot
 
		entity_set_int(mascot, EV_INT_solid, SOLID_NOT)
		entity_set_int(mascot, EV_INT_movetype, MOVETYPE_NONE)
		entity_set_int(mascot, EV_INT_team, team)
		MinBox[0] = -16.0;	MinBox[1] = -16.0;	MinBox[2] = -72.0
		MaxBox[0] =  16.0;	MaxBox[1] =  16.0;	MaxBox[2] =  72.0
		entity_set_vector(mascot, EV_VEC_mins, MinBox)
		entity_set_vector(mascot, EV_VEC_maxs, MaxBox)
		//orig[2] += 200.0
 
		entity_set_origin(mascot,MascotsOrigins)
		entity_set_float(mascot,EV_FL_animtime,2.0)
		entity_set_float(mascot,EV_FL_framerate,1.0)
		entity_set_int(mascot,EV_INT_sequence,0)
 
		if(team == 2)
			entity_set_byte(mascot, EV_BYTE_controller1, 115)
 
		entity_set_vector(mascot,EV_VEC_angles,MascotsAngles)
		entity_set_float(mascot,EV_FL_nextthink,halflife_time() + 1.0)
	}
}
 
create_Game_Player_Equip() {
	gamePlayerEquip = create_entity("game_player_equip")
	if(gamePlayerEquip) {
		//DispatchKeyValue(gamePlayerEquip, "weapon_knife", "1")
		//DispatchKeyValue(entity, "weapon_scout", "1")
		DispatchKeyValue(gamePlayerEquip, "targetname", "roundstart")
		DispatchSpawn(gamePlayerEquip)
	}
 
}
 
public FinalizeGoalNet(team)
{
	new goalnet = GoalEnt[team]
	entity_set_string(goalnet,EV_SZ_classname,"soccerjam_goalnet")
	entity_set_int(goalnet, EV_INT_team, team)
	set_entity_visibility(goalnet, 0)
}
 
public RightDirection(id) {
 
	if(id == ballholder) {
 
		direction--
		if(direction < -(DIRECTIONS))
			direction = -(DIRECTIONS)
		new temp = direction * CURVE_ANGLE
		SendCenterText( id, temp );
 
	}
	else
		client_print(id, print_chat, "%L", id, "CANT_CURVE_RIGHT");
	return PLUGIN_HANDLED
}
 
public LeftDirection(id) {
	if(id == ballholder) {
		direction++
		if(direction > DIRECTIONS)
			direction = DIRECTIONS
		new temp = direction * CURVE_ANGLE
		SendCenterText( id, temp );
 
	}
	else {
		client_print(id, print_chat, "%L", id, "CANT_CURVE_LEFT");
	}
	return PLUGIN_HANDLED
}
 
 
SendCenterText( id, dir )
{
	if(dir < 0)
		client_print(id, print_center, "%L", id, "CURVING_RIGHT", (dir<0?-(dir):dir));
	else if(dir == 0)
		client_print(id, print_center, "0 degrees");
	else if(dir > 0)
		client_print(id, print_center, "%L", id, "CURVING_LEFT", (dir<0?-(dir):dir));
}
 
public plugin_cfg() {
	if(is_kickball) {
		server_cmd("sv_maxspeed 999")
		server_cmd("sv_airaccelerate 10")
 
		//Fallback to make sure our mp_timelimit is correct.
		new mpTimelimit = get_cvar_num("mp_timelimit");
		new sjTimelimit = get_cvar_num("sj_timelimit");
 
		if( mpTimelimit > 3 )
			set_cvar_num("sj_timelimit", mpTimelimit);
		else {
			if(mpTimelimit && sjTimelimit > 3 )
				set_cvar_num("mp_timelimit", sjTimelimit);
		}
 
	}
	else {
		//server_cmd("exec server.cfg")
		new failed[64];
		format(failed,63,"%L", LANG_SERVER, "PLUGIN_FAILED");
		set_fail_state(failed);
	}
}
 
/*====================================================================================================
 [Ball Brain]
 
 Purpose:	These functions help control the ball and its activities.
 
 Comment:	$$
 
====================================================================================================*/
public ball_think() {
 
	new maxscore = get_pcvar_num(CVAR_SCORE)
	if(score[1] >= maxscore || score[2] >= maxscore) {
		entity_set_float(aball,EV_FL_nextthink,halflife_time() + 0.05)
		return PLUGIN_HANDLED
	}
 
	if(is_valid_ent(aball))
	{
 
		new Float:gametime = get_gametime()
		if(PowerPlay >= pop && gametime - fire_delay >= 0.3)
			on_fire()
 
		if(ballholder > 0)
		{
			new team = get_user_team(ballholder)
			entity_get_vector(ballholder, EV_VEC_origin,testorigin)
 
 
			if(!is_user_alive(ballholder)) {
 
				new tname[32]
				get_user_name(ballholder,tname,31)
 
				remove_task(55555)
				set_task(get_pcvar_float(CVAR_RESET),"clearBall",55555)
 
				if(!g_sprint[ballholder])
					set_speedchange(ballholder)
 
				format(temp1,63,"%L", LANG_PLAYER, "DROPPED_BALL", TeamNames[team], tname)
 
				//remove glow of owner and set ball velocity really really low
				glow(ballholder,0,0,0,0)
 
				ballowner = ballholder
				ballholder = 0
 
				testorigin[2] += 5
				entity_set_origin(aball, testorigin)
 
				new Float:vel[3], x
				for(x=0;x<3;x++)
					vel[x] = 1.0
 
				entity_set_vector(aball,EV_VEC_velocity,vel)
				entity_set_float(aball,EV_FL_nextthink,halflife_time() + 0.05)
				return PLUGIN_HANDLED
			}
			if(entity_get_int(aball,EV_INT_solid) != SOLID_NOT)
				entity_set_int(aball, EV_INT_solid, SOLID_NOT)
 
			//Put ball in front of player
			ball_infront(ballholder, 55.0)
			new i
			for(i=0;i<3;i++)
				velocity[i] = 0.0
			//Add lift to z axis
			new flags = entity_get_int(ballholder, EV_INT_flags)
			if(flags & FL_DUCKING)
				testorigin[2] -= 10
			else
				testorigin[2] -= 30
 
			entity_set_vector(aball,EV_VEC_velocity,velocity)
	  		entity_set_origin(aball,testorigin)
		}
		else {
			if(entity_get_int(aball,EV_INT_solid) != SOLID_BBOX)
				entity_set_int(aball, EV_INT_solid, SOLID_BBOX)
		}
	}
	entity_set_float(aball,EV_FL_nextthink,halflife_time() + 0.05)
	return PLUGIN_HANDLED
}
 
moveBall(where, team=0) {
 
	if(is_valid_ent(aball)) {
		if(team) {
			new Float:bv[3]
			bv[2] = 50.0
			entity_set_origin(aball, TeamBallOrigins[team])
			entity_set_vector(aball,EV_VEC_velocity,bv)
		}
		else {
			switch(where) {
				case 0: { //outside map
					new Float:orig[3], x
					for(x=0;x<3;x++)
						orig[x] = -9999.9
					entity_set_origin(aball,orig)
					ballholder = -1
				}
				case 1: { //at middle
 
					new Float:v[3], rand
					v[2] = 400.0
					if(ballspawncount > 1)
						rand = random_num(0, ballspawncount-1)
					else
						rand = 0
 
					entity_set_origin(aball, BallSpawnOrigin[rand])
					entity_set_vector(aball, EV_VEC_velocity, v)
 
					PowerPlay = 0
					ballholder = 0
					ballowner = 0
				}
			}
		}
	}
}
 
public ball_infront(id, Float:dist) {
 
	new Float:nOrigin[3]
	new Float:vAngles[3] // plug in the view angles of the entity
	new Float:vReturn[3] // to get out an origin fDistance away
 
	entity_get_vector(aball,EV_VEC_origin,testorigin)
	entity_get_vector(id,EV_VEC_origin,nOrigin)
	entity_get_vector(id,EV_VEC_v_angle,vAngles)
 
 
	vReturn[0] = floatcos( vAngles[1], degrees ) * dist
	vReturn[1] = floatsin( vAngles[1], degrees ) * dist
 
	vReturn[0] += nOrigin[0]
	vReturn[1] += nOrigin[1]
 
	testorigin[0] = vReturn[0]
	testorigin[1] = vReturn[1]
	testorigin[2] = nOrigin[2]
 
	/*
	//Sets the angle to face the same as the player.
	new Float:ang[3]
	entity_get_vector(id,EV_VEC_angles,ang)
	ang[0] = 0.0
	ang[1] -= 90.0
	ang[2] = 0.0
	entity_set_vector(aball,EV_VEC_angles,ang)
	*/
}
 
 
public CurveBall(id) {
	if(direction && get_speed(aball) > 5 && curvecount > 0) {
 
		new Float:dAmt = float((direction * CURVE_ANGLE) / ANGLEDIVIDE);
		new Float:v[3], Float:v_forward[3];
 
		entity_get_vector(aball, EV_VEC_velocity, v);
		vector_to_angle(v, BallSpinDirection);
 
		BallSpinDirection[1] = normalize( BallSpinDirection[1] + dAmt );
		BallSpinDirection[2] = 0.0;
 
		angle_vector(BallSpinDirection, 1, v_forward);
 
		new Float:speed = vector_length(v)// * 0.95;
		v[0] = v_forward[0] * speed
		v[1] = v_forward[1] * speed
 
		entity_set_vector(aball, EV_VEC_velocity, v);
 
		curvecount--;
		set_task(CURVE_TIME, "CurveBall", id);
	}
}
 
public clearBall() {
	play_wav(0, BALL_RESPAWN);
	format(temp1,63,"%L",LANG_PLAYER,"BALL_RESPAWNED")
	moveBall(1)
}
 
/*====================================================================================================
 [Mascot Think]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
public mascot_think(mascot)
{
	new team = entity_get_int(mascot, EV_INT_team)
	new indist[32], inNum, chosen
 
	new id, playerteam, dist
	for(id=1 ; id<=maxplayers ; id++)
	{
		if(is_user_alive(id))
		{
			playerteam = get_user_team(id)
			if(playerteam != team)
			{
				if(!chosen) {
					dist = get_entity_distance(id, mascot)
					if(dist < get_pcvar_num(CVAR_GOALSAFETY))
						if(id == ballholder) {
							chosen = id
							break
						}
						else
							indist[inNum++] = id
				}
			}
		}
	}
	if(!chosen) {
		new rnd = random_num(0, (inNum-1))
		chosen = indist[rnd]
	}
	if(chosen)
		TerminatePlayer(chosen, mascot, team, ( ballholder == chosen ? 230.0 : random_float(10.0, 20.0) ) )
	entity_set_float(mascot,EV_FL_nextthink,halflife_time() + 0.50)
}
 
goaly_checker(id, Float:gametime, team) {
	if(!is_user_alive(id) || (gametime - GoalyCheckDelay[id] < GOALY_DELAY) )
		return PLUGIN_HANDLED
 
	new dist, gcheck
	new Float:pOrig[3]
	entity_get_vector(id, EV_VEC_origin, pOrig)
	dist = floatround(get_distance_f(pOrig, TeamBallOrigins[team]))
 
	//--/* Goaly Exp System */--//
	if(dist < 600 ) {
 
		gcheck = GoalyCheck[id]
 
		if(id == ballholder && gcheck >= 2)
			kickBall(id, 1)
 
		GoalyPoints[id]++
 
		if(gcheck < 2)
			g_Experience[id] += gcheck * AMOUNT_GOALY
		else
			g_Experience[id] += gcheck * (AMOUNT_GOALY / 2)
 
		if(gcheck < 5)
			GoalyCheck[id]++
 
		GoalyCheckDelay[id] = gametime
	}
	else
		GoalyCheck[id] = 0
	return PLUGIN_HANDLED
}
 
/*====================================================================================================
 [Status Display]
 
 Purpose:	Displays the Scoreboard information.
 
 Comment:	$$
 
====================================================================================================*/
public statusDisplay()
{
	new id, team, bteam = get_user_team(ballholder>0?ballholder:ballowner)
	new score_t = score[T], score_ct = score[CT]
 
	set_hudmessage(20, 255, 20, 0.95, 0.20, 0, 1.0, 1.5, 0.1, 0.1, HUD_CHANNEL)
	new Float:gametime = get_gametime()
 
	for(id=1; id<=maxplayers; id++) {
		if(is_user_connected(id))
		{
			team = get_user_team(id)
			goaly_checker(id, gametime, team)
			if(!is_user_alive(id) && !is_dead[id] && (team == 1 || team == 2) && GetPlayerModel(id) != 0xFF)
			{
				//new Float:ballorig[3], x
				//entity_get_vector(id,EV_VEC_origin,ballorig)
				//for(x=0;x<3;x++)
				//	distorig[0][x] = floatround(ballorig[x])
				remove_task(id+1000)
				has_knife[id] = false;
				is_dead[id] = true
				new Float:respawntime = CVAR_RESPAWN
				set_task(respawntime,"AutoRespawn",id)
				set_task((respawntime+0.2), "AutoRespawn2",id)
			}
			if(!winner) {
				format(scoreboard,1024,"   %i %L^n%s - %i  |  %s - %i ^n%L %i ^n^n%s^n^n^n%s",get_pcvar_num(CVAR_SCORE),id,"GOALS_WINS",TeamNames[T],score_t,TeamNames[CT],score_ct,id,"EXPERIENCE",g_Experience[id],temp1,team==bteam?temp2:"")
				show_hudmessage(id,"%s",scoreboard)
			}
		}
	}
}
 
/*====================================================================================================
 [Touched]
 
 Purpose:	All touching stuff takes place here.
 
 Comment:	$$
 
====================================================================================================*/
public touchWorld(ball, world) {
 
	if(get_speed(ball) > 10)
	{
		new Float:v[3]
		entity_get_vector(ball, EV_VEC_velocity, v)
 
		v[0] = (v[0] * 0.85)
		v[1] = (v[1] * 0.85)
		v[2] = (v[2] * 0.85)
		entity_set_vector(ball, EV_VEC_velocity, v)
		emit_sound(ball, CHAN_ITEM, BALL_BOUNCE_GROUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
	}
 
	return PLUGIN_HANDLED
}
 
public touchPlayer(ball, player) {
 
	new playerteam = get_user_team(player)
	if((playerteam != 1 && playerteam != 2))
		return PLUGIN_HANDLED
 
	remove_task(55555)
 
	new aname[64], stolen, x
	get_user_name(player,aname,63)
	new ballteam = get_user_team(ballowner)
	if(ballowner > 0 && playerteam != ballteam )
	{
		new speed = get_speed(aball)
		if(speed > 500)
		{
			//configure catching algorithm
			new rnd = random_num(0,100)
			new bstr = (PlayerUpgrades[ballowner][STR] * AMOUNT_STR) / 10
			new dex = (PlayerUpgrades[player][DEX] * AMOUNT_DEX)
			new pct = ( PressedAction[player] ? 40:20 ) + dex
 
			pct += ( g_sprint[player] ? 5 : 0 )		//player turboing? give 5%
			pct -= ( g_sprint[ballowner] ? 5 : 0 ) 	//ballowner turboing? lose 5%
			pct -= bstr						//ballowner has strength? remove bstr
 
			//will player avoid damage?
			if( rnd > pct ) {
				new Float:dodmg = (float(speed) / 13.0) + bstr
 
				client_print(0,print_chat,"%L",LANG_PLAYER,"BALL_SMACKED",aname,floatround(dodmg))
				fakedamage(player,"AssWhoopin",dodmg,1)
				//set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
				//new health=get_user_health(player)
				//set_user_health ( player, health -floatround(dodmg))
				//set_msg_block(gmsgDeathMsg,BLOCK_NOT)
 
				if(!is_user_alive(player)) {
					message_begin(MSG_ALL, gmsgDeathMsg)
					write_byte(ballowner)
					write_byte(player)
					write_string("AssWhoopin")
					message_end()
 
					new frags = get_user_frags(ballowner)
					entity_set_float(ballowner, EV_FL_frags, float(frags + 1))
					setScoreInfo(ballowner)
					//set_user_frags(ballowner, get_user_frags(ballowner)+1)
					Event_Record(ballowner, KILL, -1, EXP_KILL)
 
					client_print(player,print_chat,"%L",player,"KILLED_BY_BALL")
					client_print(ballowner,print_chat,"%L",ballowner,"EXP_FOR_BALLKILL")
				}
				else {
					new Float:pushVel[3]
					pushVel[0] = velocity[0]
					pushVel[1] = velocity[1]
					pushVel[2] = velocity[2] + ((velocity[2] < 0)?random_float(-200.0,-50.0):random_float(50.0,200.0))
					entity_set_vector(player,EV_VEC_velocity,pushVel)
				}
				for(x=0;x<3;x++)
					velocity[x] = (velocity[x] * random_float(0.1,0.9))
				entity_set_vector(aball,EV_VEC_velocity,velocity)
				direction = 0
				return PLUGIN_HANDLED
			}
		}
 
		if(speed > 950)
			play_wav(0, STOLE_BALL_FAST)
 
		new Float:pOrig[3]
		entity_get_vector(player, EV_VEC_origin, pOrig)
		new dist = floatround(get_distance_f(pOrig, TeamBallOrigins[playerteam]))
		new gainedxp
 
		if(dist < 550) {
			gainedxp = EXP_STEAL + EXP_GOALY + (speed / 8)
			Event_Record(player, STEAL, -1, EXP_STEAL + EXP_GOALY + (speed / 8))
			GoalyPoints[player] += EXP_GOALY/2
		}
		else {
			gainedxp = EXP_STEAL
			Event_Record(player, STEAL, -1, EXP_STEAL)
		}
 
		format(temp1,63,"%L",LANG_PLAYER,"STOLE_BALL",TeamNames[playerteam],aname)
		client_print(0,print_console,"%s",temp1)
		stolen = 1
 
		message_begin(MSG_ONE, gmsgShake, {0,0,0}, player)
		write_short(255 << 12) //ammount
		write_short(1 << 11) //lasts this long
		write_short(255 << 10) //frequency
		message_end()
 
		client_print(player,print_chat,"%L",player,"EXP_FOR_STEAL",gainedxp)
 
	}
	if(ballholder == 0) {
		emit_sound(aball, CHAN_ITEM, BALL_PICKED_UP, 1.0, ATTN_NORM, 0, PITCH_NORM)
		new msg[64], check
		if(!has_knife[player])
			give_knife(player)
 
		if(stolen)
			PowerPlay = 0
		else
			format(temp1,63,"%L",LANG_PLAYER,"BALL_PICKUP",TeamNames[playerteam],aname)
 
		if(((PowerPlay > 1 && powerplay_list[PowerPlay-2] == player) || (PowerPlay > 0 && powerplay_list[PowerPlay-1] == player)) && PowerPlay != MAX_LVL_POWERPLAY)
			check = true
 
		if(PowerPlay <= MAX_LVL_POWERPLAY && !check) {
			g_Experience[player] += (PowerPlay==2?10:25)
			powerplay_list[PowerPlay] = player
			PowerPlay++
 
			new Players[32] 
			new playerCountT,playerCountCT
			get_players(Players, playerCountT, "ce","TERRORIST")	
			get_players(Players, playerCountCT, "ce","CT")	
 
			if((playerCountT>3)&&( playerCountCT>3))pop=3
			else if((playerCountT>2)&&( playerCountCT>2)) pop=2
			else pop=1
 
		}
		curvecount = 0
		direction = 0
		GoalyCheck[player] = 0
 
		format(temp2, 63, "%L %i",LANG_PLAYER,"POWER_PLAY", PowerPlay>0?PowerPlay-1:0)
 
		ballholder = player
		ballowner = 0
 
		if(!g_sprint[player])
			set_speedchange(player)
 
 
		set_hudmessage(255, 20, 20, POS_X, 0.4, 1, 1.0, 1.5, 0.1, 0.1, 2)
		format(msg,63,"%L",player,"YOU_HAVE_BALL")
		show_hudmessage(player,"%s",msg)
 
		//Glow Player who has ball their team color
		beam()
		glow(player, TeamColors[playerteam][0], TeamColors[playerteam][1], TeamColors[playerteam][2], 1)
	}
	return PLUGIN_HANDLED
}
 
public touchNet(ball, goalpost)
{
	remove_task(55555)
 
	new team = get_user_team(ballowner)
	new goalent = GoalEnt[team]
	if (goalpost != goalent && ballowner > 0) {
 
		new Players[32] 
		new playerCountT,playerCountCT
		get_players(Players, playerCountT, "ce","TERRORIST")	
		get_players(Players, playerCountCT, "ce","CT")	
 
		if((playerCountT>3)&&( playerCountCT>3))pop=3
		else if((playerCountT>2)&&( playerCountCT>2)) pop=2
		else pop=1
 
		if(PowerPlay<pop){
			user_slap(ballowner, 5)
			if(get_speed(ball) > 10){
				new Float:v[3]
				entity_get_vector(ball, EV_VEC_velocity, v)
 
				v[0] = (v[0] * 0.85)
				v[1] = (v[1] * 0.85)
				v[2] = (v[2] * 0.85)
				entity_set_vector(ball, EV_VEC_velocity, v)
				emit_sound(ball, CHAN_ITEM, BALL_BOUNCE_GROUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
			new text[64]
			format(text,63,"^x04*** By strzelic bramke PowerPlay musi byc minimum %i ***",pop-1)
 
			message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, ballowner)
			write_byte(ballowner)
			write_string(text)
			message_end()
			client_print(0, print_chat,"By zwiekszyc poziom power play nalezy podawac do swojej druzyny")
			client_print(0, print_chat,"Gdy power play bedzie conajmniej %i - bedzie mozna strzelic gola",pop-1)
			user_slap(ballowner, 5)
			return PLUGIN_HANDLED		
		}
 
		// Powerpaly ograniczenie koniec
 
		new aname[64]
		new Float:netOrig[3]
		new netOrig2[3]
 
		entity_get_vector(ball, EV_VEC_origin,netOrig)
		new l
		for(l=0;l<3;l++)
			netOrig2[l] = floatround(netOrig[l])
		flameWave(netOrig2)
		get_user_name(ballowner,aname,63)
		new frags = get_user_frags(ballowner)
		entity_set_float(ballowner, EV_FL_frags, float(frags + 10))
 
		play_wav(0, SCORED_GOAL)
 
		/////////////////////ASSIST CODE HERE///////////
 
		new assisters[4] = { 0, 0, 0, 0 }
		new iassisters = 0
		new ilastplayer = iassist[ team ]
 
		// We just need the last player to kick the ball
		// 0 means it has passed 15 at least once
		if ( ilastplayer == 0 )
			ilastplayer = 15
		else
			ilastplayer--
 
		if ( assist[ ilastplayer ] != 0 ) {
			new i, x, bool:canadd, playerid
			for(i=0; i<16; i++) {
				// Stop if we've already found 4 assisters
				if ( iassisters == MAX_ASSISTERS )
					break
				playerid = assist[ i ]
				// Skip if player is invalid
				if ( playerid == 0 )
					continue
				// Skip if kicker is counted as an assister
				if ( playerid == assist[ ilastplayer ] )
					continue
 
				canadd = true
				// Loop through each assister value
				for(x=0; x<3; x++)
					// make sure we can add them
					if ( playerid == assisters[ x ] ) {
						canadd = false
						break
					}
 
				// Skip if they've already been added
				if ( canadd == false )
					continue
				// They didn't kick the ball last, and they haven't been added, add them
				assisters[ iassisters++ ] = playerid
			}
			// This gives each person an assist, xp, and prints that out to them
			new c, pass
			for(c=0; c<iassisters; c++) {
				pass = assisters[ c ]
				Event_Record(pass, ASSIST, -1, EXP_ASSIST)
				client_print( pass, print_chat, "%L",pass,"EXP_FOR_ASSIST",EXP_ASSIST)
			}
		}
		iassist[ 0 ] = 0
		/////////////////////ASSIST CODE HERE///////////
 
		for(l=0; l<3; l++)
			distorig[1][l] = floatround(netOrig[l])
		new distshot = (get_distance(distorig[0],distorig[1])/12)
		new gainedxp = distshot + EXP_GOAL
 
		format(temp1,63,"%L",LANG_PLAYER,"SCORED_GOAL",TeamNames[team],aname,distshot)
		client_print(0,print_console,"%s",temp1)
 
 
		if(distshot > MadeRecord[ballowner][DISTANCE])
			Event_Record(ballowner, DISTANCE, distshot, 0)// record distance, and make that distance exp
 
		Event_Record(ballowner, GOAL, -1, gainedxp)	//zero xp for goal cause distance is what gives it.
 
		//Increase Score, and update cvar score
		score[team]++
		switch(team) {
			case 1: set_cvar_num("score_ct",score[team])
			case 2: set_cvar_num("score_t",score[team])
		}
		client_print(ballowner,print_chat,"%L",ballowner,"EXP_FOR_GOAL",gainedxp,distshot)
 
		new oteam = (team == 1 ? 2 : 1)
		increaseTeamXP(team, 75)
		increaseTeamXP(oteam, 50)
		moveBall(0)
 
		new x
		for(x=1; x<=maxplayers; x++) {
			if(is_user_connected(x))
			{
				Event_Record(x, GOALY, GoalyPoints[x], 0)
				new kills = get_user_frags(x)
				new deaths = cs_get_user_deaths(x)
				setScoreInfo(x)
				if( deaths > 0)
					PlayerDeaths[x] = deaths
				if( kills > 0)
					PlayerKills[x] = kills
			}
		}
 
		if(score[team] < get_pcvar_num(CVAR_SCORE)) {
			new r = random_num(0,MAX_SOUNDS-1)
			play_wav(0, SCORED_SOUNDS[r]);
 
		}
		else {
			winner = team
			format(scoreboard,1024,"%L",LANG_PLAYER,"TEAM_WINS",TeamNames[team])
			set_task(1.0,"showhud_winner",0,"",0,"a",3)
		}
 
		server_cmd("sv_restart 4")
 
	}
	else if(goalpost == goalent) {
		moveBall(0, team)
		client_print(ballowner,print_chat,"%L",ballowner,"CANNOT_KICK_GOAL")
	}
	return PLUGIN_HANDLED
}
 
//This is for soccerjam.bsp to fix locker room.
public touchBlocker(pwnball, blocker) {
	new Float:orig[3] = { 2234.0, 1614.0, 1604.0 }
	entity_set_origin(pwnball, orig)
}
 
/*====================================================================================================
 [Events]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
//public Event_DeathMsg() {
//	new id = read_data(2)
//	strip_user_weapons(id);
//}
 
public Event_Damage()
{
	new victim = read_data(0)
	new attacker = get_user_attacker(victim)
	if(is_user_alive(attacker)) {
		if(is_user_alive(victim) ) {
 
			#if !defined KNIFE_DISARM_ON
			if(victim == ballholder) {
			#endif
				new upgrade = PlayerUpgrades[attacker][DISARM]
				if(upgrade) {
					new disarm = upgrade * AMOUNT_DISARM
					new disarmpct = BASE_DISARM + (victim==ballholder?(disarm*2):0)
					new rand = random_num(1,100)
 
					if(disarmpct >= rand)
					{
						new vname[32], aname[32]
						get_user_name(victim,vname,31)
						get_user_name(attacker,aname,31)
 
						#if defined KNIFE_DISARM_ON
						if(victim == ballholder) {
						#endif
							kickBall(victim, 1)
							client_print(attacker,print_chat,"%L",attacker,"DISARM_BALL_ATTACKER",vname)
							client_print(victim,print_chat,"%L",victim,"DISARM_BALL_VICTIM",aname)
						#if defined KNIFE_DISARM_ON
						}
						else {
							new weapon, clip, ammo
							weapon = get_user_weapon(victim,clip,ammo)
							if(weapon == CSW_KNIFE)
							{
								strip_user_weapons(victim);
								has_knife[victim] = false;
								set_task(float(disarm / DISARM_MULTIPLIER), "give_knife", victim+1000)
								client_print(attacker,print_chat,"%L",attacker,"DISARM_KNIFE_ATTACKER",vname)
								client_print(victim,print_chat,"%L",victim,"DISARM_KNIFE_VICTIM",aname)
							}
						}
						#endif
					}
				}
			#if !defined KNIFE_DISARM_ON
			}
			#endif
		}
		else
			g_Experience[attacker] += (EXP_KILL/2)
	}
}
 
public Event_StartRound()
{
	g_TimeLimit = get_cvar_num("mp_timelimit");
	if(winner)
	{
		set_task(1.0,"displayWinnerAwards",0)
 
		//MP_TIMELIMIT replication
		new Float:gtime = float(g_TimeLimit) - (get_gametime() / 60.0);
 
		if( g_TimeLimit && gtime <= 0.0 )
		{
			//Fix for Map Vote plugins (2 min marker).
			new bool:check;
			if(cvar_exists("amx_extendmap_max"))
				check = true;
 
			server_cmd("mp_timelimit %i", (check ? 2 : 1));
			set_task(10.0, "CheckExtendMap", 555666, "", 0, "b");
		}
		else
			set_task(10.0,"PostGame",0)
	}
	else
		SetupRound()
}
 
public CheckExtendMap() {
 
	new timelimit = get_cvar_num("mp_timelimit");
	if(timelimit > g_TimeLimit) {
		PostGame();
		remove_task(555666);
	}
}
 
public SetupRound() {
 
	iassist[ 0 ] = 0
 
	if(!is_valid_ent(aball))
		createball()
 
	moveBall(1)
 
	new id
	for(id=1; id<=maxplayers; id++) {
		if(is_user_connected(id)) {
			is_dead[id] = false
			seconds[id] = 0
			g_sprint[id] = 0
			PressedAction[id] = 0
		}
	}
	play_wav(0, ROUND_START)
 
	set_task(0.5, "PostSetupRound", 0)
	set_task(1.0, "PostPostSetupRound", 0)
 
	return PLUGIN_HANDLED
}
 
public PostSetupRound() {
	new id
	for(id=1; id<=maxplayers; id++)
		if(is_user_alive(id))
			give_knife(id)
}
 
public PostPostSetupRound() {
	new id, kills, deaths
	for(id=1; id<=maxplayers; id++) {
		if(is_user_connected(id)) {
			kills = PlayerKills[id]
			deaths = PlayerDeaths[id]
			if(kills)
				entity_set_float(id, EV_FL_frags, float(kills))
			if(deaths)
				cs_set_user_deaths(id,deaths)
 
			setScoreInfo(id)
		}
	}
}
 
public Event_ResetHud(id) {
	goaldied[id] = 0
	set_task(1.0,"PostResetHud",id)
}
 
public PostResetHud(id) {
	if(is_user_alive(id))
	{
		new stam = PlayerUpgrades[id][STA]
 
		if(!has_knife[id]) {
			give_knife(id)
		}
 
		//compensate for our turbo
		if(!g_sprint[id])
			set_speedchange(id)
 
		if(stam > 0)
			entity_set_float(id, EV_FL_health, float(BASE_HP + (stam * AMOUNT_STA)))
	}
}
 
/*====================================================================================================
 [Client Commands]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
public Turbo(id)
{
	if(is_user_alive(id))
		g_sprint[id] = 1
	return PLUGIN_HANDLED
}
 
public client_PreThink(id)
{
	if( is_kickball && is_valid_ent(aball) && is_user_connected(id))
	{
		new button = entity_get_int(id, EV_INT_button)
		new usekey = (button & IN_USE)
		new relokay= (button & IN_RELOAD)
 
		new up = (button & IN_FORWARD)
		new down = (button & IN_BACK)
		new moveright = (button & IN_MOVERIGHT)
		new moveleft = (button & IN_MOVELEFT)
		new jump = (button & IN_JUMP)
		new flags = entity_get_int(id, EV_INT_flags)
		new onground = flags & FL_ONGROUND
		if( (moveright || moveleft) && !up && !down && jump && onground && !g_sprint[id] && id != ballholder)
			SideJump[id] = 1
 
		if(g_sprint[id])
			entity_set_float(id, EV_FL_fuser2, 0.0)
 
		if( id != ballholder )
			PressedAction[id] = usekey
		else {
			if( usekey && !PressedAction[id]) {
				kickBall(ballholder, 0)
			}
			else if( relokay && !PressedAction[id]){
				kickBall2(ballholder, 0)
			}
			else if( !usekey && PressedAction[id])
				PressedAction[id] = 0
		}
 
		if( id != ballholder && (button & IN_ATTACK || button & IN_ATTACK2) ) {
 
			static Float:maxdistance
			static reference
 
			if(ballholder > 0) {
				reference = ballholder
				maxdistance = get_pcvar_float(CVAR_KILLNEARHOLDER)
			}			
			else {
				reference = aball
				maxdistance = get_pcvar_float(CVAR_KILLNEARBALL)
			}
 
			if(!maxdistance)
				return
 
			if(entity_range(id, reference) > maxdistance)
				entity_set_int(id, EV_INT_button, (button & ~IN_ATTACK) & ~IN_ATTACK2)
 
		}
 
	}
}
 
public client_PostThink(id) {
	if(is_kickball && is_user_connected(id)) {
		new Float:gametime = get_gametime()
		new button = entity_get_int(id, EV_INT_button)
 
		new up = (button & IN_FORWARD)
		new down = (button & IN_BACK)
		new moveright = (button & IN_MOVERIGHT)
		new moveleft = (button & IN_MOVELEFT)
		new jump = (button & IN_JUMP)
		new Float:vel[3]
 
		entity_get_vector(id,EV_VEC_velocity,vel)
 
		if( (gametime - SideJumpDelay[id] > 4.5) && SideJump[id] && jump && (moveright || moveleft) && !up && !down) {
 
			vel[0] *= 2.0
			vel[1] *= 2.0
			vel[2] = 300.0
 
			entity_set_vector(id,EV_VEC_velocity,vel)
			SideJump[id] = 0
			SideJumpDelay[id] = gametime
		}
		else
			SideJump[id] = 0
	}
}
 
public kickBall(id, velType)
{
	remove_task(55555)
	set_task(get_pcvar_float(CVAR_RESET),"clearBall",55555)
 
	new team = get_user_team(id)
	new a,x
 
	//Give it some lift
	ball_infront(id, 55.0)
 
	testorigin[2] += 10
 
	new Float:tempO[3], Float:returned[3]
	new Float:dist2
 
	entity_get_vector(id, EV_VEC_origin, tempO)
	new tempEnt = trace_line( id, tempO, testorigin, returned )
 
	dist2 = get_distance_f(testorigin, returned)
 
	//ball_infront(id, 55.0)
 
	if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )//|| tempDist < 65)
		return PLUGIN_HANDLED
	else
	{
		//Check Make sure our ball isnt inside a wall before kicking
		new Float:ballF[3], Float:ballR[3], Float:ballL[3]
		new Float:ballB[3], Float:ballTR[3], Float:ballTL[3]
		new Float:ballBL[3], Float:ballBR[3]
 
		for(x=0; x<3; x++) {
				ballF[x] = testorigin[x];	ballR[x] = testorigin[x];
				ballL[x] = testorigin[x];	ballB[x] = testorigin[x];
				ballTR[x] = testorigin[x];	ballTL[x] = testorigin[x];
				ballBL[x] = testorigin[x];	ballBR[x] = testorigin[x];
			}
 
		for(a=1; a<=6; a++) {
 
			ballF[1] += 3.0;	ballB[1] -= 3.0;
			ballR[0] += 3.0;	ballL[0] -= 3.0;
 
			ballTL[0] -= 3.0;	ballTL[1] += 3.0;
			ballTR[0] += 3.0;	ballTR[1] += 3.0;
			ballBL[0] -= 3.0;	ballBL[1] -= 3.0;
			ballBR[0] += 3.0;	ballBR[1] -= 3.0;
 
			if(point_contents(ballF) != CONTENTS_EMPTY || point_contents(ballR) != CONTENTS_EMPTY ||
			point_contents(ballL) != CONTENTS_EMPTY || point_contents(ballB) != CONTENTS_EMPTY ||
			point_contents(ballTR) != CONTENTS_EMPTY || point_contents(ballTL) != CONTENTS_EMPTY ||
			point_contents(ballBL) != CONTENTS_EMPTY || point_contents(ballBR) != CONTENTS_EMPTY)
					return PLUGIN_HANDLED
		}
 
		new ent = -1
		testorigin[2] += 35.0
 
		while((ent = find_ent_in_sphere(ent, testorigin, 35.0)) != 0) {
			if(ent > maxplayers)
			{
				new classname[32]
				entity_get_string(ent, EV_SZ_classname, classname, 31)
 
				if((contain(classname, "goalnet") != -1 || contain(classname, "func_") != -1) &&
					!equal(classname, "func_water") && !equal(classname, "func_illusionary"))
					return PLUGIN_HANDLED
			}
		}
		testorigin[2] -= 35.0
 
	}
 
	new kickVel
	if(!velType)
	{
		new str = (PlayerUpgrades[id][STR] * AMOUNT_STR) + (AMOUNT_POWERPLAY*(PowerPlay*5))
		kickVel = get_pcvar_num(CVAR_KICK) + str
		kickVel += g_sprint[id] * 100
 
		if(direction) {
			entity_get_vector(id, EV_VEC_angles, BallSpinDirection)
			curvecount = CURVE_COUNT
		}
	}
	else {
		curvecount = 0
		direction = 0
		kickVel = random_num(100, 600)
	}
 
	new Float:ballorig[3]
	entity_get_vector(id,EV_VEC_origin,ballorig)
	for(x=0; x<3; x++)
		distorig[0][x] = floatround(ballorig[x])
 
	velocity_by_aim(id, kickVel, velocity)
 
	for(x=0; x<3; x++)
		distorig[0][x] = floatround(ballorig[x])
 
	/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////
	if ( iassist[ 0 ] == team ) {
		if ( iassist[ team ] == 15 )
			iassist[ team ] = 0
	}
	else {
		// clear the assist list
		new ind
		for(ind = 0; ind < 16; ind++ )
			assist[ ind ] = 0
		// clear the assist index
		iassist[ team ] = 0
		// set which team to track
		iassist[ 0 ] = team
	}
	assist[ iassist[ team ]++ ] = id
	/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////
 
	ballowner = id
	ballholder = 0
	entity_set_origin(aball,testorigin)
	entity_set_vector(aball,EV_VEC_velocity,velocity)
 
	set_task(CURVE_TIME*2, "CurveBall", id)
 
	emit_sound(aball, CHAN_ITEM, BALL_KICKED, 1.0, ATTN_NORM, 0, PITCH_NORM)
 
	glow(id,0,0,0,0)
 
	beam()
 
	new aname[64]
	get_user_name(id,aname,63)
 
	if(!g_sprint[id])
		set_speedchange(id)
 
	format(temp1,63,"%L",LANG_PLAYER,"KICKED_BALL",TeamNames[team],aname)
	client_print(0,print_console,"%s",temp1)
	return PLUGIN_HANDLED
}
 
public kickBall2(id, velType)
{
	remove_task(55555)
	set_task(get_pcvar_float(CVAR_RESET),"clearBall",55555)
 
	new team = get_user_team(id)
	new a,x
 
	//Give it some lift
	ball_infront(id, 55.0)
 
	testorigin[2] += 10
 
	new Float:tempO[3], Float:returned[3]
	new Float:dist2
 
	entity_get_vector(id, EV_VEC_origin, tempO)
	new tempEnt = trace_line( id, tempO, testorigin, returned )
 
	dist2 = get_distance_f(testorigin, returned)
 
	//ball_infront(id, 55.0)
 
	if( point_contents(testorigin) != CONTENTS_EMPTY || (!is_user_connected(tempEnt) && dist2 ) )//|| tempDist < 65)
		return PLUGIN_HANDLED
	else
	{
		//Check Make sure our ball isnt inside a wall before kicking
		new Float:ballF[3], Float:ballR[3], Float:ballL[3]
		new Float:ballB[3], Float:ballTR[3], Float:ballTL[3]
		new Float:ballBL[3], Float:ballBR[3]
 
		for(x=0; x<3; x++) {
				ballF[x] = testorigin[x];	ballR[x] = testorigin[x];
				ballL[x] = testorigin[x];	ballB[x] = testorigin[x];
				ballTR[x] = testorigin[x];	ballTL[x] = testorigin[x];
				ballBL[x] = testorigin[x];	ballBR[x] = testorigin[x];
			}
 
		for(a=1; a<=6; a++) {
 
			ballF[1] += 3.0;	ballB[1] -= 3.0;
			ballR[0] += 3.0;	ballL[0] -= 3.0;
 
			ballTL[0] -= 3.0;	ballTL[1] += 3.0;
			ballTR[0] += 3.0;	ballTR[1] += 3.0;
			ballBL[0] -= 3.0;	ballBL[1] -= 3.0;
			ballBR[0] += 3.0;	ballBR[1] -= 3.0;
 
			if(point_contents(ballF) != CONTENTS_EMPTY || point_contents(ballR) != CONTENTS_EMPTY ||
			point_contents(ballL) != CONTENTS_EMPTY || point_contents(ballB) != CONTENTS_EMPTY ||
			point_contents(ballTR) != CONTENTS_EMPTY || point_contents(ballTL) != CONTENTS_EMPTY ||
			point_contents(ballBL) != CONTENTS_EMPTY || point_contents(ballBR) != CONTENTS_EMPTY)
					return PLUGIN_HANDLED
		}
 
		new ent = -1
		testorigin[2] += 35.0
 
		while((ent = find_ent_in_sphere(ent, testorigin, 35.0)) != 0) {
			if(ent > maxplayers)
			{
				new classname[32]
				entity_get_string(ent, EV_SZ_classname, classname, 31)
 
				if((contain(classname, "goalnet") != -1 || contain(classname, "func_") != -1) &&
					!equal(classname, "func_water") && !equal(classname, "func_illusionary"))
					return PLUGIN_HANDLED
			}
		}
		testorigin[2] -= 35.0
 
	}
 
	new kickVel
	if(!velType)
	{
		kickVel = get_pcvar_num(CVAR_KICK)
		kickVel += g_sprint[id] * 100
 
		if(direction) {
			entity_get_vector(id, EV_VEC_angles, BallSpinDirection)
			curvecount = CURVE_COUNT
		}
	}
	else {
		curvecount = 0
		direction = 0
		kickVel = random_num(100, 600)
	}
 
	new Float:ballorig[3]
	entity_get_vector(id,EV_VEC_origin,ballorig)
	for(x=0; x<3; x++)
		distorig[0][x] = floatround(ballorig[x])
 
	velocity_by_aim(id, kickVel, velocity)
 
	for(x=0; x<3; x++)
		distorig[0][x] = floatround(ballorig[x])
 
	/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////
	if ( iassist[ 0 ] == team ) {
		if ( iassist[ team ] == 15 )
			iassist[ team ] = 0
	}
	else {
		// clear the assist list
		new ind
		for(ind = 0; ind < 16; ind++ )
			assist[ ind ] = 0
		// clear the assist index
		iassist[ team ] = 0
		// set which team to track
		iassist[ 0 ] = team
	}
	assist[ iassist[ team ]++ ] = id
	/////////////////////WRITE ASSIST CODE HERE IF NEEDED///////////
 
	ballowner = id
	ballholder = 0
	entity_set_origin(aball,testorigin)
	entity_set_vector(aball,EV_VEC_velocity,velocity)
 
	set_task(CURVE_TIME*2, "CurveBall", id)
 
	emit_sound(aball, CHAN_ITEM, BALL_KICKED, 1.0, ATTN_NORM, 0, PITCH_NORM)
 
	glow(id,0,0,0,0)
 
	beam()
 
	new aname[64]
	get_user_name(id,aname,63)
 
	if(!g_sprint[id])
		set_speedchange(id)
 
	format(temp1,63,"%L",LANG_PLAYER,"KICKED_BALL",TeamNames[team],aname)
	client_print(0,print_console,"%s",temp1)
	return PLUGIN_HANDLED
}
 
 
/*====================================================================================================
 [Command Blocks]
 
 Purpose:	$$
 
 Comment:	$$
 
====================================================================================================*/
public client_kill(id) {
	if(is_kickball)
		return PLUGIN_HANDLED
	return PLUGIN_CONTINUE
}
 
public client_command(id) {
	if(!is_kickball) return PLUGIN_CONTINUE
	new arg[13]
	read_argv( 0, arg , 12 )
 
	if ( equal("buy",arg) || equal("autobuy",arg) )
		return PLUGIN_HANDLED
 
	return PLUGIN_CONTINUE
}
 
//fix for an exploit.
public menuclass(id) {
 
	// They changed teams
	SetPlayerModel(id, 0xFF);
}
 
GetPlayerModel(id)
{
	if(!is_user_connected(id))
		return 0;
 
	return get_pdata_int(id, OFFSET_INTERNALMODEL, 5);
}
 
SetPlayerModel(id, int)
{
	if(!is_user_connected(id))
		return;
 
	set_pdata_int(id, OFFSET_INTERNALMODEL, int, 5);
}
 
public team_select(id, key) {
	if(is_kickball) {
		new team = get_user_team(id)
		//SetPlayerModel(id, 0xFF);
		if( (team == 1 || team == 2) && (key == team-1) )
		{
			new message[64]
			format(message, 63, "%L",id,"CANT_REJOIN_TEAM")
 
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("StatusText"), {0, 0, 0}, id)
			write_byte(0)
			write_string(message)
			message_end()
 
			engclient_cmd(id,"chooseteam")
 
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}
 
public fullupdate(id)
	return PLUGIN_HANDLED
 
/*====================================================================================================
 [Upgrades]
 
 Purpose:	This handles the upgrade menu.
 
 Comment:	$$
 
====================================================================================================*/
public BuyUpgrade(id) {
 
	new level[65], num[11], mTitle[101]//, max_count
	format(mTitle,100,"%L",id,"MENU_TITLE")
 
	menu_upgrade[id] = menu_create(mTitle, "Upgrade_Handler")
	new x
	for(x=1; x<=UPGRADES; x++)
	{
		new price = ((PlayerUpgrades[id][x] * UpgradePrice[x]) / 2) + UpgradePrice[x]
		if((PlayerUpgrades[id][x] + 1) > UpgradeMax[x]) {
			//max_count++
			format(level,64,"r%s %L",UpgradeTitles[x],id,"MENU_CHOICE_MAXED",UpgradeMax[x])
		}
		else {
			format(level,64,"%s r%L y-- w%i XP",UpgradeTitles[x], id, "MENU_CHOICE_NEXT", PlayerUpgrades[id][x]+1, price)
		}
		format(num, 10,"%i",x)
		menu_additem(menu_upgrade[id], level, num, 0)
	}
 
	menu_addblank(menu_upgrade[id], (UPGRADES+1))
	menu_setprop(menu_upgrade[id], MPROP_EXIT, MEXIT_NORMAL)
 
	menu_display(id, menu_upgrade[id], 0)
	return PLUGIN_HANDLED
}
 
public Upgrade_Handler(id, menu, item) {
 
	if(item == MENU_EXIT)
		return PLUGIN_HANDLED
 
	new cmd[6], iName[64]
	new access, callback
	menu_item_getinfo(menu, item, access, cmd,5, iName, 63, callback)
 
	new upgrade = str_to_num(cmd)
 
	new playerupgrade = PlayerUpgrades[id][upgrade]
	new price = ((playerupgrade * UpgradePrice[upgrade]) / 2) + UpgradePrice[upgrade]
	new maxupgrade = UpgradeMax[upgrade]
 
	if(playerupgrade != maxupgrade && playerupgrade != maxupgrade+MAX_LVL_BONUS)
	{
		new needed = g_Experience[id] - price
 
		if( (needed >= 0) )
		{
			if(playerupgrade < maxupgrade-1)
				playerupgrade += 1
			else
				playerupgrade += MAX_LVL_BONUS+1
 
			g_Experience[id] -= price
 
			if(playerupgrade < maxupgrade)
				client_print(id,print_chat,"%L",id,"MENU_UPGRADED",playerupgrade,UpgradeTitles[upgrade],price)
			else {
				client_print(id,print_chat,"%L",id,"MENU_UPGRADED",maxupgrade,UpgradeTitles[upgrade],price)
				#if(MAX_LVL_BONUS > 1)
					client_print(id,print_chat,"%L",id,"MENU_MAX_LVL_BONUS",maxupgrade,MAX_LVL_BONUS)
				#else
					client_print(id,print_chat,"%L",id,"MENU_MAX_LVL",maxupgrade)
				#endif
 
				play_wav(id, UPGRADED_MAX_LEVEL)
			}
			switch(upgrade) {
				case STA: {
					new stam = playerupgrade * AMOUNT_STA
					entity_set_float(id, EV_FL_health, float(BASE_HP + stam))
				}
				case AGI: {
					if(!g_sprint[id])
						set_speedchange(id)
				}
			}
			PlayerUpgrades[id][upgrade] = playerupgrade
		}
		else
			client_print(id,print_chat,"%L",id,"MENU_MISSING_EXP",(needed * -1),(playerupgrade+1),UpgradeTitles[upgrade])
	}
	else {
		client_print(id,print_chat,"%L",id,"MENU_UPGRADE_MAXED",UpgradeTitles[upgrade],maxupgrade)
	}
	return PLUGIN_HANDLED
}
 
/*====================================================================================================
 [Meters]
 
 Purpose:	This controls the turbo meter and curve angle meter.
 
 Comment:	$$
 
====================================================================================================*/
public meter()
{
	new id
	new turboTitle[32]
	new sprintText[128], sec
	new r, g, b, team
	new len, x
	new ndir = -(DIRECTIONS)
	format(turboTitle,31,"%L",LANG_PLAYER,"TURBO_TITLE");
	for(id=1; id<=maxplayers; id++)
	{
		if(!is_user_connected(id) || !is_user_alive(id))
			continue
 
		sec = sec
			

Dodanych wklejek: 4031
Powered By (Pav32) Pastebin © 2011