Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.78 KB | None | 0 0
  1. function LocalTimer() {
  2. new string[200], query[200];
  3. // licitatii automate
  4. new year, month, day;
  5. getdate(year, month, day);
  6. new days[180];
  7. format(days, sizeof(days), GetWeekDay(day, month, year));
  8. new hour,minute,second;
  9. gettime(hour,minute,second);
  10. if(strcmp(days,"Monday",true) == 0 && hour == 00 && second == 0) {
  11. format(query, sizeof(query), "UPDATE `users` SET `HelpedPlayersToday`='0' WHERE `Admin`>='1'");
  12. mysql_query(SQL ,query);
  13.  
  14. foreach(Player, i) {
  15. if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) {
  16. if(PlayerInfo[i][pAdmin] != 0) PlayerInfo[i][pHelpedPlayersToday] = 0;
  17. }
  18. }
  19. }
  20. if(strcmp(days,"Saturday",true) == 0 || strcmp(days,"Sunday",true) == 0 || strcmp(days,"Friday",true) == 0) {
  21. if(ServerSystem[10] == 0) {
  22. if(hour == 20 && Licitatie == 0 || hour == 21 && Licitatie == 0) {
  23. if(FreeBusinesses() > 0) {
  24. new id = GetBizzID();
  25. Licitatie = 1;
  26. TipLicitatie = 2;
  27. TimpLicitatie = 5*60;
  28. TotalBani = 0;
  29. foreach(Player, i) {
  30. if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) TotalMoney[i] = 0;
  31. }
  32. IDLicitatie = id;
  33. LastPlayer = -1;
  34.  
  35. foreach(Player, i) {
  36. if(IsPlayerConnected(i) && toglicitatie[i] == 0) {
  37. SCM(i, COLOR_YELLOW, "O licitatie tocmai a inceput. Optiunea de a vedea mesajele de la licitatie este dezactivata.");
  38. SCM(i, COLOR_YELLOW, "Daca vrei sa vezi mesajele, foloseste comanda /tog iar daca vrei sa vezi pentru ce se liciteaza, foloseste /info.");
  39. }
  40. }
  41.  
  42. MesajLicitatie(0x7A45FFFF, "O noua licitatie tocmai a inceput!");
  43. switch(TipLicitatie) {
  44. case 1: format(string, sizeof(string), "De data aceasta, se liciteaza pentru casa cu ID-ul %d. (/findhouse %d). ", id, id);
  45. case 2: format(string, sizeof(string), "De data aceasta, se liciteaza pentru afacerea cu ID-ul %d. (/findbiz %d). ", id, id);
  46. }
  47. MesajLicitatie(0x7A45FFFF, string);
  48. format(string, sizeof(string), "Ai la dispozitie 5 minute pentru a licita.");
  49. MesajLicitatie(0x7A45FFFF, string);
  50. MesajLicitatie(0x7A45FFFF, "Comenzi disponibile: (/bid - licitezi), (/info - informatii)");
  51. }
  52. else if(FreeHouses() > 0) {
  53. new id = GetHouseID();
  54. Licitatie = 1;
  55. TipLicitatie = 1;
  56. TimpLicitatie = 5*60;
  57. TotalBani = 0;
  58. foreach(Player, i) {
  59. if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) TotalMoney[i] = 0;
  60. }
  61. IDLicitatie = id;
  62. LastPlayer = -1;
  63.  
  64. foreach(Player, i) {
  65. if(IsPlayerConnected(i) && toglicitatie[i] == 0) {
  66. SCM(i, COLOR_YELLOW, "O licitatie tocmai a inceput. Optiunea de a vedea mesajele de la licitatie este dezactivata.");
  67. SCM(i, COLOR_YELLOW, "Daca vrei sa vezi mesajele, foloseste comanda /tog iar daca vrei sa vezi pentru ce se liciteaza, foloseste /info.");
  68. }
  69. }
  70.  
  71. MesajLicitatie(0x7A45FFFF, "O noua licitatie tocmai a inceput!");
  72. switch(TipLicitatie) {
  73. case 1: format(string, sizeof(string), "De data aceasta, se liciteaza pentru casa cu ID-ul %d. (/findhouse %d). ", id, id);
  74. case 2: format(string, sizeof(string), "De data aceasta, se liciteaza pentru afacerea cu ID-ul %d. (/findbiz %d). ", id, id);
  75. }
  76. MesajLicitatie(0x7A45FFFF, string);
  77. format(string, sizeof(string), "Ai la dispozitie 5 minute pentru a licita.");
  78. MesajLicitatie(0x7A45FFFF, string);
  79. MesajLicitatie(0x7A45FFFF, "Comenzi disponibile: (/bid - licitezi), (/info - informatii)");
  80. }
  81. else if(minute == 0 && second == 0) SendAdminMessage(COLOR_WHITE, "AdmBot: Nu sunt proprietati ce poti fi scoase la licitatie.", 1);
  82. }
  83. }
  84. }
  85.  
  86. // CS Arena
  87. if(GameStep == 1) {
  88. if(RoundTime > 0) {
  89. RoundTime --;
  90. if(RoundTime == 120) {
  91. foreach(Player, i) {
  92. if(IsPlayerConnected(i) && InGame[i] == 1) {
  93. TogglePlayerControllable(i, 1);
  94. Freezed[i] = 0;
  95. GameTextForPlayer(i, "~y~GO! GO! GO!", 1500, 4);
  96. }
  97. }
  98. }
  99. if(UsedBomb == 1) format(string, sizeof(string), "~r~%s", CalculeazaTimp2(RoundTime));
  100. else if(RoundTime >= 120) format(string, sizeof(string), "~y~%s", CalculeazaTimp2(RoundTime));
  101. else if(RoundTime < 10) format(string, sizeof(string), "~r~%s", CalculeazaTimp2(RoundTime));
  102. else format(string, sizeof(string), "%s", CalculeazaTimp2(RoundTime));
  103. TextDrawSetString(GameTD[4], string);
  104. if(RoundTime == 0) {
  105. if(UsedBomb == 1) {
  106. UsedBomb = 0;
  107. foreach(Player, i) {
  108. if(HaveDef[i] == 1) {
  109. DefBomb = 0;
  110. KillTimer(DefTimer[i]);
  111. SCM(i, COLOR_LGREEN, "Dezamorsarea a esuat!");
  112. }
  113. }
  114. SendGameMessage(COLOR_WARNING, "Bomba a explodat! Teroristii au castigat aceasta runda.");
  115. CreateExplosion(BombPos[0], BombPos[1], BombPos[2], 3, 0.0);
  116. CreateExplosion(BombPos[0], BombPos[1]+1, BombPos[2], 3, 0.0);
  117. CreateExplosion(BombPos[0]+2, BombPos[1]-1, BombPos[2], 3, 0.0);
  118. CreateExplosion(BombPos[0], BombPos[1]+3, BombPos[2]+1, 3, 0.0);
  119. CreateExplosion(BombPos[0], BombPos[1]+4, BombPos[2], 3, 0.0);
  120. CreateExplosion(BombPos[0], BombPos[1]+5, BombPos[2], 3, 0.0);
  121. CreateExplosion(BombPos[0]+2, BombPos[1], BombPos[2]+3, 3, 0.0);
  122. CreateExplosion(BombPos[0], BombPos[1]+3, BombPos[2]+5, 3, 0.0);
  123. WonRound(TEAM_TERRORIST);
  124. DestroyPickup(BombPickup);
  125. }
  126. else WonRound(TEAM_CTERRORIST);
  127. }
  128. }
  129. }
  130.  
  131. // War deelay
  132. for(new i = 0; i < 17; i++) {
  133. if(FactionDeelay[i] >= 1) {
  134. FactionDeelay[i] --;
  135. if(FactionDeelay[i] == 0) {
  136. SendFactionMessage(i, COLOR_MONEY, "[WAR] Acum mafia ta poate ataca un teritoriu!");
  137. }
  138. }
  139. }
  140.  
  141. // Record players
  142. if(PlayersOnline() > MaxPlayers) {
  143. MaxPlayers = PlayersOnline();
  144. SaveInfo();
  145. format(string, sizeof(string), "Warning: Noul record de playeri conectati este acum %d.", MaxPlayers);
  146. SendAdminMessage(COLOR_WARNING, string, 1);
  147. }
  148.  
  149. // Race Arena
  150. if(RaceStarted == 1 && PlayersInRace() == 0) RaceStarted = 0;
  151. if(RaceTime > 0) {
  152. RaceTime --;
  153. format(string, sizeof(string), "~y~%d", RaceTime);
  154. GameTextForRace(string);
  155. if(RaceTime == 0) {
  156. StartRaceArena();
  157. format(string, sizeof(string), "~y~GO! GO! GO!");
  158. GameTextForRace(string);
  159. }
  160. }
  161.  
  162. // Paintball arena
  163. if(painttime > 0) painttime--;
  164. if(PaintText[0] != 0) {
  165. PaintText[0] --;
  166. if(PaintText[0] == 0) format(string, sizeof(string), "~w~Runda a inceput~n~Succes tuturor!");
  167. else format(string, sizeof(string), "~w~Runda incepe in ~n~~b~%d secunde", PaintText[0]);
  168. GameTextForPaint(string, 0);
  169. }
  170. if(PaintText[1] != 0) {
  171. PaintText[1] --;
  172. if(PaintText[1] == 0) format(string, sizeof(string), "~w~Runda a inceput~n~Succes tuturor!");
  173. else format(string, sizeof(string), "~w~Runda incepe in ~n~~b~%d secunde", PaintText[1]);
  174. GameTextForPaint(string, 1);
  175. }
  176. if(PaintText[2] != 0) {
  177. PaintText[2] --;
  178. if(PaintText[2] == 0) format(string, sizeof(string), "~w~Runda a inceput~n~Succes tuturor!");
  179. else format(string, sizeof(string), "~w~Runda incepe in ~n~~b~%d secunde", PaintText[2]);
  180. GameTextForPaint(string, 2);
  181. }
  182. if(PlayersOnPaint(0) >= 2 && PaintTime[0] > 0) {
  183. PaintTime[0] --;
  184. if(PaintTime[0] == 0) {
  185. SendPaintMessage(1, COLOR_YELLOW, "Runda va incepe peste un minut. Pentru a vota o mapa, folositi comanda /votemap.");
  186. PaintVote[0] = 1;
  187. if(PaintTimer[0] != 0) KillTimer(PaintTimer[0]), PaintTimer[0] = 0;
  188. PaintTimer[0] = SetTimerEx("CalculateVote", 60000, 0, "i", 0);
  189. }
  190. }
  191. if(PlayersOnPaint(1) >= 2 && PaintTime[1] > 0) {
  192. PaintTime[1] --;
  193. if(PaintTime[1] == 0) {
  194. SendPaintMessage(1+1, COLOR_YELLOW, "Runda va incepe peste un minut. Pentru a vota o mapa, folositi comanda /votemap.");
  195. PaintVote[1] = 1;
  196. if(PaintTimer[1] != 0) KillTimer(PaintTimer[1]), PaintTimer[1] = 0;
  197. PaintTimer[1] = SetTimerEx("CalculateVote", 60000, 0, "i", 1);
  198. }
  199. }
  200. if(PlayersOnPaint(2) >= 2 && PaintTime[2] > 0) {
  201. PaintTime[2] --;
  202. if(PaintTime[2] == 0) {
  203. SendPaintMessage(2+1, COLOR_YELLOW, "Runda va incepe peste un minut. Pentru a vota o mapa, folositi comanda /votemap.");
  204. PaintVote[2] = 1;
  205. if(PaintTimer[2] != 0) KillTimer(PaintTimer[2]), PaintTimer[2] = 0;
  206. PaintTimer[2] = SetTimerEx("CalculateVote", 60000, 0, "i", 2);
  207. }
  208. }
  209.  
  210. // Restart Server
  211. if(RestartTime >= 1) {
  212. RestartTime--;
  213.  
  214. if(RestartTime <= 60) {
  215. format( string, sizeof(string), "~w~Urmeaza un restart in~n~~r~%d secunde", RestartTime);
  216. GameTextForAll( string, 1100, 4 );
  217. }
  218. if(RestartTime == 3) {
  219. foreach(Player, i) {
  220. if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1 && PlayerInfo[i][pAdmin] < 7) KickEx(i);
  221. }
  222. }
  223. if(RestartTime == 0) GameModeExit();
  224. }
  225.  
  226. // Dynamic Event
  227. if(ActiveEvent == 1 && EventTime == 0) {
  228. if(EventType == 3) {
  229. format(string, sizeof(string), "~r~Teroristi: ~w~~h~%d~n~~b~Politisti: ~w~~h~%d", GetTeamMembers(1), GetTeamMembers(2));
  230. TextDrawSetString(EventCS, string);
  231. }
  232. else if(EventType == 6) {
  233. format(string, sizeof(string), "~p~Zombies: ~w~~h~%d~n~~w~Humans: ~w~~h~%d", GetTeamMembers(1), GetTeamMembers(2));
  234. TextDrawSetString(EventCS, string);
  235. }
  236. else {
  237. format(string, sizeof(string), "~p~Alive: ~w~~h~%d", GetPlayersOnEvent());
  238. TextDrawSetString(EventCS, string);
  239. }
  240.  
  241. if(EventType == 3) {
  242. if(GetTeamMembers(1) == 0) {
  243. format(string, sizeof(string), "(( AdmBot: Echipa {5AAFFA}Politistilor{A9C4E4} a castigat evenimentul si a primit $%s. Felicitari! ))", FormatNumber(EventMoney));
  244. SCMTA(COLOR_CLIENT, string);
  245. foreach(Player, i) {
  246. if(Team[i] == 2 && IsPlayerConnected(i)) GivePlayerCash(i, EventMoney), SpawnPlayer(i);
  247. if(InEvent[i]) InEvent[i] = 0;
  248. }
  249. ActiveEvent = 0;
  250. }
  251. else if(GetTeamMembers(2) == 0) {
  252. format(string, sizeof(string), "(( AdmBot: Echipa {FA5A5A}Teroristilor{A9C4E4} a castigat evenimentul si a primit $%s. Felicitari! ))", FormatNumber(EventMoney));
  253. SCMTA(COLOR_CLIENT, string);
  254. foreach(Player, i) {
  255. if(Team[i] == 1 && IsPlayerConnected(i)) GivePlayerCash(i, EventMoney), SpawnPlayer(i);
  256. if(InEvent[i]) InEvent[i] = 0;
  257. }
  258. ActiveEvent = 0;
  259. }
  260. }
  261. else if(EventType == 6) {
  262. if(GetTeamMembers(2) == 0) {
  263. format(string, sizeof(string), "(( AdmBot: Echipa {B366FF}Zombie{A9C4E4} a castigat evenimentul si a primit $%s. Felicitari! ))", FormatNumber(EventMoney));
  264. SCMTA(COLOR_CLIENT, string);
  265. foreach(Player, i) {
  266. if(Team[i] == 1 && IsPlayerConnected(i)) GivePlayerCash(i, EventMoney), SpawnPlayer(i);
  267. if(InEvent[i]) InEvent[i] = 0;
  268. }
  269. ActiveEvent = 0;
  270. }
  271. else if(GetTeamMembers(1) == 0) {
  272. format(string, sizeof(string), "(( AdmBot: Echipa {FFFFFF}Human{A9C4E4} a castigat evenimentul si a primit $%s. Felicitari! ))", FormatNumber(EventMoney));
  273. SCMTA(COLOR_CLIENT, string);
  274. foreach(Player, i) {
  275. if(Team[i] == 2 && IsPlayerConnected(i)) GivePlayerCash(i, EventMoney), SpawnPlayer(i);
  276. if(InEvent[i]) InEvent[i] = 0;
  277. }
  278. ActiveEvent = 0;
  279. }
  280. }
  281. else CheckEventWinner();
  282. }
  283.  
  284. // Licitatie
  285. if(Licitatie == 1) {
  286. TimpLicitatie --;
  287. if(TimpLicitatie == 0) {
  288. Licitatie = 0;
  289. if(LastPlayer == -1) SCMTA(COLOR_YELLOW, "Licitatia a fost anulata deoarece nu s-a licitat nicio suma.");
  290. else {
  291. if(!IsPlayerConnected(LastPlayer) || TotalMoney[LastPlayer] == 0) SCMTA(COLOR_YELLOW, "Licitatia a fost anulata deoarece ultimul jucator care a licitat nu mai este conectat.");
  292. else {
  293. SCMTA(0x7A45FFFF, "Licitatia s-a terminat.");
  294. format(string, sizeof(string), "Cel mai mult a licitat %s(%d) cu suma de $%s.", GetName(LastPlayer), LastPlayer, FormatNumber(TotalMoney[LastPlayer]));
  295. SCMTA(0x7A45FFFF, string);
  296. GivePlayerCash(LastPlayer, -TotalBani);
  297. switch(TipLicitatie) {
  298. case 1: {
  299. format(string, sizeof(string), "Ai pierdut casa (%d) deoarece a fost licitata din cauza inactivitatii tale.", IDLicitatie);
  300. InsertEmail(HouseInfo[IDLicitatie][hOwner], "AdmBot", string, 0);
  301. format(string, sizeof(string), "Ai primit casa %d cu succes. Felicitari!", IDLicitatie);
  302. SCM(LastPlayer, COLOR_YELLOW, string);
  303. finishAchievement(LastPlayer, 3);
  304. format(query, sizeof(query), "UPDATE `users` SET `House`='999' WHERE `House`='%d'", IDLicitatie);
  305. mysql_query(SQL, query);
  306. foreach(Player, i) {
  307. if(IsPlayerConnected(i) && PlayerInfo[i][pHouse] == IDLicitatie) {
  308. SCM(i, COLOR_YELLOW, "Ai ramas fara casa deoarece a fost luata la licitatie. Motivul: probabil ai fost inactiv.");
  309. PlayerInfo[i][pHouse] = 999;
  310. Update(i,pHousex);
  311. }
  312. }
  313. PlayerInfo[LastPlayer][pHouse] = IDLicitatie;
  314. PlayerInfo[LastPlayer][pRented] = -1;
  315. HouseInfo[IDLicitatie][hOwned] = 1;
  316. HouseInfo[IDLicitatie][hValue] = 0;
  317.  
  318. strmid(HouseInfo[IDLicitatie][hOwner], GetName(LastPlayer), 0, strlen(GetName(LastPlayer)), 255);
  319. Update(LastPlayer,pHousex);
  320. format(query, sizeof(query),"UPDATE `houses` SET `Owned`='1',`Owner`='%s',`Value`='0' WHERE `ID`='%d'",GetName(LastPlayer),IDLicitatie);
  321. mysql_query(SQL,query);
  322. UpdateLabel(1,IDLicitatie);
  323. }
  324. case 2: {
  325. format(string, sizeof(string), "Ai pierdut afacerea (%d) deoarece a fost licitata din cauza inactivitatii tale.", IDLicitatie);
  326. InsertEmail(BizzInfo[IDLicitatie][bOwner], "AdmBot", string, 0);
  327. format(string, sizeof(string), "Ai primit afacerea %d cu succes. Felicitari!", IDLicitatie);
  328. SCM(LastPlayer, COLOR_YELLOW, string);
  329. finishAchievement(LastPlayer, 2);
  330. format(query, sizeof(query), "UPDATE `users` SET `Bizz`='255' WHERE `Bizz`='%d'", IDLicitatie);
  331. mysql_query(SQL, query);
  332. foreach(Player, i) {
  333. if(IsPlayerConnected(i) && PlayerInfo[i][pBizz] == IDLicitatie) {
  334. SCM(i, COLOR_YELLOW, "Ai ramas fara afacere deoarece a fost luata la licitatie. Motivul: probabil ai fost inactiv.");
  335. PlayerInfo[i][pBizz] = 255;
  336. Update(i,pBizzx);
  337. }
  338. }
  339. PlayerInfo[LastPlayer][pBizz] = IDLicitatie;
  340. BizzInfo[IDLicitatie][bOwned] = 1;
  341. BizzInfo[IDLicitatie][bBuyPrice] = 0;
  342. strmid(BizzInfo[IDLicitatie][bOwner], GetName(LastPlayer), 0, strlen(GetName(LastPlayer)), 255);
  343. format(query, sizeof(query),"UPDATE users SET `Money`='%d',`Bizz`='%d' WHERE `ID`='%d'",GetPlayerCash(LastPlayer),PlayerInfo[LastPlayer][pBizz],PlayerInfo[LastPlayer][pSQLID]);
  344. mysql_query(SQL,query);
  345. format(query, sizeof(query),"UPDATE `bizz` SET `Owned`='1',`Owner`='%s',`BuyPrice`='0' WHERE `ID`='%d'",BizzInfo[IDLicitatie][bOwner],IDLicitatie);
  346. mysql_query(SQL,query);
  347. UpdateLabel(2,IDLicitatie);
  348. }
  349. }
  350. }
  351. }
  352. }
  353. }
  354.  
  355. if(GameTime > 0) {
  356. GameTime --;
  357. if(GameTime == 0) MapResult();
  358. }
  359. return 1;
  360. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement