Advertisement
bimadk

ANTICHEAT BALKAN

Nov 28th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.45 KB | None | 0 0
  1.  
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #define COLOR_NOTES 0x2894FFFF
  6. #define COLOR_NOTES2 0xFF0000AA
  7.  
  8. #define WEBSITE "www.google.com"
  9. #define BOT_NAME "zBlock"
  10.  
  11. #define DIALOG_LOCKMODE 1
  12. #define DIALOG_SETTINGS 2
  13. #define DIALOG_SUSPECTS 3
  14.  
  15. #define ResetMoneyBar ResetPlayerMoney
  16. #define UpdateMoneyBar GivePlayerMoney
  17.  
  18. #include <a_samp>
  19. #include <zcmd>
  20. #include <sscanf2>
  21. #include <foreach>
  22.  
  23. #if defined FILTERSCRIPT
  24.  
  25. new DB:zBlock;
  26. new
  27. datestring[ 24 ],
  28. timestring[ 24 ]
  29. ;
  30. new
  31. bool: Muted[ MAX_PLAYERS char ],
  32. bool: ACDetected[ MAX_PLAYERS char ],
  33. bool: FirstSpawn[ MAX_PLAYERS char ],
  34. bool: AdminImmunity[ MAX_PLAYERS char ],
  35. bool: LoggedIn[ MAX_PLAYERS char ],
  36. AntiSpam[ MAX_PLAYERS ],
  37. MutedTimes[ MAX_PLAYERS ],
  38. ACTimesDetected[ MAX_PLAYERS ],
  39. WarnForAdvert[ MAX_PLAYERS ],
  40. RCONLoginFails[ MAX_PLAYERS ],
  41. Cash[ MAX_PLAYERS ]
  42. ;
  43. new
  44. DefaultPass = 1,
  45. ServerLocked = 0,
  46. BanForMoneyHack = 0,
  47. BanForSpeedHack = 1
  48. ;
  49. public OnFilterScriptInit()
  50. {
  51. print("--------------------------------------");
  52. print("Loading zBlock Anti-Cheat. . .");
  53. print("--------------------------------------\n");
  54.  
  55. zBlock = db_open("zBlock.db");
  56. db_query(zBlock, "CREATE TABLE IF NOT EXISTS `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`)");
  57.  
  58. if(!fexist("/zblock"))
  59. {
  60. print("WARNING: folder 'zblock' at 'scriptfiles' does NOT exist");
  61. print("ERROR: server has crashed due to a missing folder (scriptfiles/zblock)");
  62. }
  63. if(!fexist("/zblock/password.txt"))
  64. {
  65. print("WARNING: 'password.txt' does NOT exist at the 'scriptfiles/zblock' folder");
  66. print("NOTIFICATION: attempting to create 'password.txt'");
  67. SetTimer("CheckForFile", 5000, false);
  68. fcreate("/zblock/password.txt");
  69. }
  70. else
  71. {
  72. new
  73. File: zBlockstuff = fopen("/zblock/password.txt", io_read),
  74. string[50]
  75. ;
  76. if(zBlockstuff)
  77. {
  78. if (!fread(zBlockstuff, string))
  79. {
  80. new
  81. File: zBlockstuff2 = fopen("/zblock/password.txt", io_write)
  82. ;
  83. fwrite(zBlockstuff2, "defaultpassword5791");
  84. fclose(zBlockstuff2);
  85. DefaultPass = 1;
  86. print("** zBlock: 'password.txt' was empty, default password was writen");
  87. }
  88. else
  89. {
  90. if(!strcmp(string, "defaultpassword5791", true))
  91. {
  92. DefaultPass = 1;
  93. print("** zBlock: Server is using the default password\n** zBlock: Please change it for your own safety.");
  94. }
  95. else
  96. {
  97. DefaultPass = 0;
  98. print("** zBlock: Server is NOT using the default password\n** zBlock: The 'CP' is ready for use.");
  99. }
  100. }
  101. fclose(zBlockstuff);
  102. }
  103. return 1;
  104. }
  105. SetTimer("AntiCheat", 6500, true);
  106. foreach(Player, i)
  107. {
  108. ResetInfo(i);
  109. }
  110. ServerLocked = 0;
  111. BanForMoneyHack = 0;
  112. BanForSpeedHack = 1;
  113. return 1;
  114. }
  115.  
  116. public OnFilterScriptExit()
  117. {
  118. print("\n--------------------------------------");
  119. print("zBlock Anti-Cheat has been disabled. . .");
  120. print("--------------------------------------\n");
  121. return 1;
  122. }
  123.  
  124. #endif
  125.  
  126. public OnPlayerConnect(playerid)
  127. {
  128. if(ServerLocked == 1)
  129. {
  130. SendClientMessage(playerid, COLOR_NOTES2, "zBlock: The server is in 'Lock-Mode #1', you can't connect.");
  131. SetTimerEx("KickTimer", 100, false, "i", playerid);
  132. }
  133. else
  134. {
  135. new Query[120], DBResult:Result, day, month, year, second, minute, hour, reason[20] = "Ban Evade";
  136. getdate(day, month, year);
  137. gettime(hour, minute, second);
  138.  
  139. format(Query, sizeof(Query), "SELECT `NAME` FROM `BANNED` WHERE `NAME` = '%s'", DB_Escape(GetName(playerid)));
  140. Result = db_query(zBlock, Query);
  141. if(db_num_rows(Result))
  142. {
  143. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FC4949}Ban detected.", "{FFFFFF}Our system has detected that your username is banned.\nIf you think this is a mistake visit our website.\n"WEBSITE"", "Close", "");
  144. printf(">> %s has been kicked from OnPlayerConnect - Username ban detection", GetName(playerid));
  145. SetTimerEx("KickTimer", 100, false, "i", playerid);
  146.  
  147. format(Query, sizeof(Query), "SELECT `IP` FROM `BANNED` WHERE `IP` = '%s'", DB_Escape(PlayerIP(playerid)));
  148. Result = db_query(zBlock, Query);
  149. if(!db_num_rows(Result))
  150. {
  151. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  152. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  153.  
  154. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  155. Result = db_query(zBlock, Query);
  156. }
  157. }
  158. else
  159. {
  160. format(Query, sizeof(Query), "SELECT `IP` FROM `BANNED` WHERE `IP` = '%s'", DB_Escape(PlayerIP(playerid)));
  161. Result = db_query(zBlock, Query);
  162. if(db_num_rows(Result))
  163. {
  164. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FC4949}Ban detected.", "{FFFFFF}Our system has detected that your ip is banned.\nIf you think this is a mistake visit our website.\n"WEBSITE"", "Close", "");
  165. printf(">> %s has been kicked from OnPlayerConnect - IP ban detection", GetName(playerid));
  166. SetTimerEx("KickTimer", 100, false, "i", playerid);
  167.  
  168. format(Query, sizeof(Query), "SELECT `NAME` FROM `BANNED` WHERE `NAME` = '%s'", DB_Escape(GetName(playerid)));
  169. Result = db_query(zBlock, Query);
  170. if(!db_num_rows(Result))
  171. {
  172. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  173. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  174.  
  175. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  176. Result = db_query(zBlock, Query);
  177. }
  178. }
  179. }
  180.  
  181. ResetInfo(playerid);
  182. }
  183. return 1;
  184. }
  185.  
  186. public OnPlayerDisconnect(playerid, reason)
  187. {
  188. ResetInfo(playerid);
  189. return 1;
  190. }
  191. public OnPlayerRequestSpawn(playerid)
  192. {
  193. if(ServerLocked == 2)
  194. {
  195. SendClientMessage(playerid, COLOR_NOTES2, "zBlock: The server is in 'Lock-Mode #2', you can't spawn.");
  196. return 0;
  197. }
  198. return 1;
  199. }
  200. public OnPlayerSpawn(playerid)
  201. {
  202. if(FirstSpawn{ playerid })
  203. {
  204. TogglePlayerControllable(playerid, 0);
  205. SendClientMessage(playerid, COLOR_NOTES2, "* Please wait for the server to processes you, and sets up data for you.");
  206. SetTimerEx("EndProcessing", 3500, false, "i", playerid);
  207. }
  208. return 1;
  209. }
  210.  
  211. public OnPlayerDeath(playerid, killerid, reason)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerText(playerid, text[])
  217. {
  218. new stringz[108];
  219. if(!AdminImmunity{ playerid })
  220. {
  221. if(!Muted{ playerid })
  222. {
  223. AntiSpam[playerid]++;
  224. if(AntiSpam[playerid] >= 3 && AntiSpam[playerid] < 4) SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Please stop flooding.");
  225. else if(AntiSpam[playerid] >= 4)
  226. {
  227. Muted{ playerid } = true;
  228. MutedTimes[playerid]++;
  229. if(MutedTimes[playerid] < 2)
  230. {
  231. SendClientMessage(playerid, COLOR_NOTES, "zBlock: You've been muted for 5 seconds due to flooding the chat.");
  232. SetTimerEx("Unmute", 5000, false, "i", playerid);
  233. }
  234. else if(MutedTimes[playerid] < 5 && MutedTimes[playerid] >= 2)
  235. {
  236. SendClientMessage(playerid, COLOR_NOTES, "zBlock: You've been muted for 20 seconds due to flooding the chat.");
  237. SetTimerEx("Unmute", 20000, false, "i", playerid);
  238. }
  239. else if(MutedTimes[playerid] >= 5)
  240. {
  241. Muted{ playerid } = false;
  242. format(stringz, sizeof(stringz), "zBlock: %s(%d) has been kicked for constant flood ( %d mutes )", GetName(playerid), playerid, MutedTimes[playerid]);
  243. SendClientMessageToAll(COLOR_NOTES2, stringz);
  244.  
  245. format(stringz, sizeof(stringz), "zBlock: You've been kicked for constant flood ( %d mutes )", MutedTimes[playerid]);
  246. SendClientMessage(playerid, COLOR_NOTES2, stringz);
  247.  
  248. SetTimerEx("KickTimer", 100, false, "i", playerid);
  249. }
  250. }
  251. }
  252. SetTimerEx("ResetAntiSpam", 1700, false, "i", playerid);
  253. }
  254.  
  255. if(strfind(text, ":", true) != -1)
  256. {
  257. new i_numcount, i_period, i_pos;
  258. while(text[i_pos])
  259. {
  260. if('0' <= text[i_pos] <= '9') i_numcount ++;
  261. else if(text[i_pos] == '.') i_period ++;
  262. i_pos++;
  263. }
  264. if(i_numcount >= 8 && i_period >= 3)
  265. {
  266. WarnForAdvert[playerid]++;
  267. if(WarnForAdvert[playerid] < 2)
  268. {
  269. format(stringz, sizeof(stringz), "zBlock: Advertising here isn't allowed.. ( %d warnings )", WarnForAdvert[playerid]);
  270. SendClientMessage(playerid, COLOR_NOTES2, stringz);
  271.  
  272. format(stringz, sizeof(stringz), "zBlock: Player %s(%d) has tried to advertise on the main-chat!", GetName(playerid), playerid);
  273. SendMessageToAdmins(COLOR_NOTES2, stringz);
  274.  
  275. printf("* zBlock: Advertise attempt by %s, proof: %s", GetName(playerid), text);
  276. return 0;
  277. }
  278. else if(WarnForAdvert[playerid] >= 2)
  279. {
  280. new Query[240], reason[20] = "Advertisement", day, month, year, second, minute, hour;
  281. getdate(day, month, year);
  282. gettime(hour, minute, second);
  283.  
  284. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  285. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  286.  
  287. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  288. db_query(zBlock, Query);
  289. SetTimerEx("KickTimer", 100, false, "i", playerid);
  290.  
  291. printf("* zBlock: Ban applied on '%s'\n* zBlock: Reason: Advertisement\n* zBlock: Proof: %s", GetName(playerid), text);
  292.  
  293. format(stringz, sizeof(stringz), "zBlock: %s(%d) has been banned for advertising", GetName(playerid), playerid);
  294. SendClientMessageToAll(COLOR_NOTES2, stringz);
  295. return 0;
  296. }
  297. }
  298. }
  299. return 1;
  300. }
  301. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  302. {
  303. new stringz[72];
  304. if(strfind(cmdtext, ":", true) != -1)
  305. {
  306. new i_numcount, i_period, i_pos;
  307. while(cmdtext[i_pos])
  308. {
  309. if('0' <= cmdtext[i_pos] <= '9') i_numcount ++;
  310. else if(cmdtext[i_pos] == '.') i_period ++;
  311. i_pos++;
  312. }
  313. if(i_numcount >= 8 && i_period >= 3)
  314. {
  315. WarnForAdvert[playerid]++;
  316. if(WarnForAdvert[playerid] < 2)
  317. {
  318. format(stringz, sizeof(stringz), "zBlock: Advertising here isn't allowed.. ( %d warnings )", WarnForAdvert[playerid]);
  319. SendClientMessage(playerid, COLOR_NOTES2, stringz);
  320.  
  321. format(stringz, sizeof(stringz), "zBlock: Player %s(%d) has tried to advertise via a command!", GetName(playerid), playerid);
  322. SendMessageToAdmins(COLOR_NOTES2, stringz);
  323.  
  324. printf("* zBlock: Advertise attempt by %s, proof: %s", GetName(playerid), cmdtext);
  325. return 0;
  326. }
  327. else if(WarnForAdvert[playerid] >= 2)
  328. {
  329. new Query[240], reason[20] = "Advertisement", day, month, year, second, minute, hour;
  330. getdate(day, month, year);
  331. gettime(hour, minute, second);
  332.  
  333. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  334. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  335.  
  336. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  337. db_query(zBlock, Query);
  338. SetTimerEx("KickTimer", 100, false, "i", playerid);
  339.  
  340. printf("* zBlock: Ban applied on '%s'\n* zBlock: Reason: Advertisement\n* zBlock: Proof: %s", GetName(playerid), cmdtext);
  341.  
  342. format(stringz, sizeof(stringz), "zBlock: %s(%d) has been banned for advertising", GetName(playerid), playerid);
  343. SendClientMessageToAll(COLOR_NOTES2, stringz);
  344. return 0;
  345. }
  346. }
  347. }
  348. return 1;
  349. }
  350. CMD:zblock_login(playerid, params[])
  351. {
  352. new FirstParam[50], string[82];
  353. if(fexist("/zblock/password.txt"))
  354. {
  355. if(!DefaultPass)
  356. {
  357. if(sscanf(params, "s[50]", FirstParam)) return SendClientMessage(playerid, COLOR_NOTES, "/zblock_login (password)");
  358. if(isnull(params)) return SendClientMessage(playerid, COLOR_NOTES2, "* You didn't type anything in the Password 'slot'!");
  359.  
  360. new
  361. File: zBlockstuff = fopen("/zblock/password.txt", io_read)
  362. ;
  363. if(zBlockstuff)
  364. {
  365. if(!LoggedIn{ playerid })
  366. {
  367. fread(zBlockstuff, string);
  368. fclose(zBlockstuff);
  369. if(!strcmp(FirstParam, string, true))
  370. {
  371. LoggedIn{ playerid } = true;
  372. AdminImmunity{ playerid } = true;
  373.  
  374. format(string, sizeof(string), "zBlock: %s(%d) has logged in the zBlock 'CP', and has received his 'Immunity'", GetName(playerid), playerid);
  375. SendMessageToAdmins(COLOR_NOTES, string);
  376. }
  377. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Invalid Password!");
  378. }
  379. else SendClientMessage(playerid, COLOR_NOTES, "zBlock: You're already logged in!");
  380. }
  381. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Can't find 'password.txt' file..");
  382. }
  383. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: Server is using Default Password, logging in is forbidden!");
  384. }
  385. FirstParam = "\0", string = "\0";
  386. return 1;
  387. }
  388. CMD:zblock(playerid, params[])
  389. {
  390. new FirstParam[18], SecondParam[50], messagestring[112], extradialog[240], string[82], hackerstring[148], count = 0;
  391. if(fexist("/zblock/password.txt"))
  392. {
  393. new
  394. File: zBlockstuff = fopen("/zblock/password.txt", io_read)
  395. ;
  396. if(zBlockstuff)
  397. {
  398. fread(zBlockstuff, string);
  399. fclose(zBlockstuff);
  400. }
  401. if(LoggedIn{ playerid })
  402. {
  403. if(sscanf(params, "s[18]", FirstParam)) return SendClientMessage(playerid, COLOR_NOTES, "/zblock (hackers/changepassword/lock/settings)");
  404. {
  405. if(strcmp(FirstParam, "suspects", true, 8) == 0 || strcmp(FirstParam, "hackers", true, 7) == 0 )
  406. {
  407. if(AdminImmunity{ playerid })
  408. {
  409. foreach(Player, i)
  410. {
  411. if(ACTimesDetected[i] >= 1) count++;
  412. }
  413. if(count >= 1)
  414. {
  415. foreach(Player, i)
  416. {
  417. if(ACTimesDetected[i] >= 1)
  418. {
  419. format(hackerstring, sizeof(hackerstring), "{FFCC66}%s\n%s(%d) - IP: %s - Has been detected %d times", hackerstring, GetName(i), i, PlayerIP(i), ACTimesDetected[i]);
  420. }
  421. }
  422. ShowPlayerDialog(playerid, DIALOG_SUSPECTS, DIALOG_STYLE_MSGBOX, "{FF9933}zBlock CP {FF6633}(v1.5)", hackerstring, "Close", "");
  423. }
  424. else ShowPlayerDialog(playerid, DIALOG_SUSPECTS, DIALOG_STYLE_MSGBOX, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FFCC66}No hackers detected", "Close", "");
  425. }
  426. }
  427. else if(strcmp(FirstParam, "changepassword", true, 14) == 0)
  428. {
  429. if(IsPlayerAdmin(playerid) && AdminImmunity{ playerid })
  430. {
  431. if(zBlockstuff)
  432. {
  433. if(sscanf(params, "s[50]", SecondParam))
  434. {
  435. SendClientMessage(playerid, COLOR_NOTES, "/zblock (changepassword) (newpass)");
  436. }
  437. else
  438. {
  439. if(!isnull(SecondParam))
  440. {
  441. SecondParam = "\0";
  442.  
  443. zBlockstuff = fopen("/zblock/password.txt", io_write);
  444. fwrite(zBlockstuff, SecondParam);
  445. fclose(zBlockstuff);
  446.  
  447. format(messagestring, sizeof(messagestring), "zBlock: %s(%d) has changed the password to %s", GetName(playerid), playerid, SecondParam);
  448. SendMessageToAdmins(COLOR_NOTES2, messagestring);
  449.  
  450. printf("* zBlock: PASS CHANGE! %s has changed the password to %s!", GetName(playerid), SecondParam);
  451. }
  452. }
  453. }
  454. }
  455. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You aren't an RCON admin, or an zBlock 'CP admin'!");
  456. }
  457. else if(strcmp(FirstParam, "lock", true, 4) == 0)
  458. {
  459. if(IsPlayerAdmin(playerid) && AdminImmunity{ playerid })
  460. {
  461. if(zBlockstuff)
  462. {
  463. if(ServerLocked == 0)
  464. {
  465. ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #1 {FF6633}- Disable connections\n{FF9933}Lock Mode #2 {FF6633}- Disable spawning", "Select", "Close");
  466. }
  467. else if(ServerLocked == 1)
  468. {
  469. ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #0 {FF6633}- Disable lock-mode\n{FF9933}Lock Mode #2 {FF6633}- Disable spawning", "Select", "Close");
  470. }
  471. else if(ServerLocked == 2)
  472. {
  473. ShowPlayerDialog(playerid, DIALOG_LOCKMODE, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", "{FF9933}Lock Mode #0 {FF6633}- Disable lock-mode\n{FF9933}Lock Mode #1 {FF6633}- Disable connections", "Select", "Close");
  474. }
  475. }
  476. }
  477. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You aren't an RCON admin, or an zBlock 'CP admin'!");
  478. }
  479. else if(strcmp(FirstParam, "settings", true, 8) == 0)
  480. {
  481. if(AdminImmunity{ playerid })
  482. {
  483. if(zBlockstuff)
  484. {
  485. if(!BanForMoneyHack)
  486. {
  487. format(extradialog, sizeof(extradialog), "{FF9933}Enable {FF6633}'Ban for Money-Hack'");
  488. }
  489. else
  490. {
  491. format(extradialog, sizeof(extradialog), "{FF9933}Disable {FF6633}'Ban for Money-Hack'");
  492. }
  493. if(!BanForSpeedHack)
  494. {
  495. format(extradialog, sizeof(extradialog), "%s\n{FF9933}Enable {FF6633}'Ban for Speed-Hack'", extradialog);
  496. }
  497. else
  498. {
  499. format(extradialog, sizeof(extradialog), "%s\n{FF9933}Disable {FF6633}'Ban for Speed-Hack'", extradialog);
  500. }
  501. ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "{FF9933}zBlock CP {FF6633}(v1.5)", extradialog, "Select", "Close");
  502. }
  503. }
  504. }
  505. }
  506. }
  507. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: You have to be logged in via the zBlock 'CP'!");
  508. }
  509. else SendClientMessage(playerid, COLOR_NOTES2, "zBlock: File 'password.txt' does NOT exist, zBlock CP is DISABLED.");
  510.  
  511. FirstParam = "\0", SecondParam = "\0", messagestring = "\0", hackerstring = "\0", string = "\0", extradialog = "\0";
  512. return 1;
  513. }
  514. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  515. {
  516. new string[92];
  517. switch(dialogid)
  518. {
  519. case DIALOG_LOCKMODE:
  520. {
  521. if(response)
  522. {
  523. if(ServerLocked == 0)
  524. {
  525. switch(listitem)
  526. {
  527. case 0:
  528. {
  529. ServerLocked = 1;
  530. format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #1 ( Connections will be 'rejected' )", GetName(playerid), playerid);
  531. SendClientMessageToAll(COLOR_NOTES2, string);
  532. foreach(Player, i)
  533. {
  534. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  535. }
  536. }
  537. case 1:
  538. {
  539. ServerLocked = 2;
  540. format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #2 ( Spawning is disabled )", GetName(playerid), playerid);
  541. SendClientMessageToAll(COLOR_NOTES2, string);
  542. foreach(Player, i)
  543. {
  544. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  545. }
  546. }
  547. }
  548. }
  549. else if(ServerLocked == 1)
  550. {
  551. switch(listitem)
  552. {
  553. case 0:
  554. {
  555. ServerLocked = 0;
  556. format(string, sizeof(string), "zBlock: %s(%d) has disabled Lock-Mode ( Spawning/Connecting is allowed )", GetName(playerid), playerid);
  557. SendClientMessageToAll(COLOR_NOTES, string);
  558. foreach(Player, i)
  559. {
  560. PlayerPlaySound(i, 1083, 0.0, 0.0, 0.0);
  561. }
  562. }
  563. case 1:
  564. {
  565. ServerLocked = 2;
  566. format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #2 ( Spawning is disabled )", GetName(playerid), playerid);
  567. SendClientMessageToAll(COLOR_NOTES2, string);
  568. foreach(Player, i)
  569. {
  570. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  571. }
  572. }
  573. }
  574. }
  575. else if(ServerLocked == 2)
  576. {
  577. switch(listitem)
  578. {
  579. case 0:
  580. {
  581. ServerLocked = 0;
  582. format(string, sizeof(string), "zBlock: %s(%d) has disabled Lock-Mode ( Spawning/Connecting is allowed )", GetName(playerid), playerid);
  583. SendClientMessageToAll(COLOR_NOTES, string);
  584. foreach(Player, i)
  585. {
  586. PlayerPlaySound(i, 1083, 0.0, 0.0, 0.0);
  587. }
  588. }
  589. case 1:
  590. {
  591. ServerLocked = 1;
  592. format(string, sizeof(string), "zBlock: %s(%d) has enabled Lock-Mode #1 ( Connections will be 'rejected' )", GetName(playerid), playerid);
  593. SendClientMessageToAll(COLOR_NOTES2, string);
  594. foreach(Player, i)
  595. {
  596. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  597. }
  598. }
  599. }
  600. }
  601. }
  602. }
  603. case DIALOG_SETTINGS:
  604. {
  605. if(response)
  606. {
  607. switch(listitem)
  608. {
  609. case 0:
  610. {
  611. if(!BanForMoneyHack)
  612. {
  613. BanForMoneyHack = 1;
  614. format(string, sizeof(string), "zBlock: %s(%d) has enabled the 'Ban for Money-Hack' feature.", GetName(playerid), playerid);
  615. SendClientMessageToAll(COLOR_NOTES, string);
  616. foreach(Player, i)
  617. {
  618. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  619. }
  620. }
  621. else
  622. {
  623. BanForMoneyHack = 0;
  624. format(string, sizeof(string), "zBlock: %s(%d) has disabled the 'Ban for Money-Hack' feature.", GetName(playerid), playerid);
  625. SendClientMessageToAll(COLOR_NOTES2, string);
  626. SendMessageToAdmins(COLOR_NOTES2, "zBlock: The hacked money will be removed!");
  627. foreach(Player, i)
  628. {
  629. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  630. }
  631. }
  632. }
  633. case 1:
  634. {
  635. if(!BanForSpeedHack)
  636. {
  637. BanForSpeedHack = 1;
  638. format(string, sizeof(string), "zBlock: %s(%d) has enabled the 'Ban for Speed-Hack' feature.", GetName(playerid), playerid);
  639. SendClientMessageToAll(COLOR_NOTES, string);
  640. foreach(Player, i)
  641. {
  642. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  643. }
  644. }
  645. else
  646. {
  647. BanForSpeedHack = 0;
  648. format(string, sizeof(string), "zBlock: %s(%d) has disabled the 'Ban for Speed-Hack' feature.", GetName(playerid), playerid);
  649. SendClientMessageToAll(COLOR_NOTES2, string);
  650. foreach(Player, i)
  651. {
  652. PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
  653. }
  654. }
  655. }
  656. }
  657. }
  658. }
  659. }
  660. return 1;
  661. }
  662. public OnPlayerExitVehicle(playerid, vehicleid)
  663. {
  664. return 1;
  665. }
  666.  
  667. public OnPlayerStateChange(playerid, newstate, oldstate)
  668. {
  669. return 1;
  670. }
  671.  
  672. public OnVehicleMod(playerid, vehicleid, componentid)
  673. {
  674. return 1;
  675. }
  676.  
  677. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  678. {
  679. return 1;
  680. }
  681.  
  682. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  683. {
  684. return 1;
  685. }
  686.  
  687. public OnRconLoginAttempt(ip[], password[], success)
  688. {
  689. new stringz[92];
  690. if(!success)
  691. {
  692. foreach(Player, i)
  693. {
  694. GetPlayerIp(i, ip, 16);
  695.  
  696. if(strcmp(PlayerIP(i),ip) == 0)
  697. {
  698. RCONLoginFails[i]++;
  699. if(RCONLoginFails[i] <= 2)
  700. {
  701. SendClientMessage(i, COLOR_NOTES2, "zBlock: Please don't try to get the RCON pass..");
  702. return 0;
  703. }
  704. else
  705. {
  706. RCONLoginFails[i] = 0;
  707.  
  708. new Query[240], DBResult:result, day, month, year, second, minute, hour;
  709. new reason[20] = "RCON Login Attempt";
  710.  
  711. getdate(day, month, year);
  712. gettime(hour, minute, second);
  713. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  714. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  715.  
  716. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  717. result = db_query(zBlock, Query);
  718. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  719. else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  720.  
  721.  
  722. SetTimerEx("KickTimer", 100, false, "i", i);
  723.  
  724. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for {FFFFFF}RCON Login attempts!", GetName(i), i);
  725. SendClientMessageToAll(-1, stringz);
  726. }
  727. }
  728. }
  729. }
  730. else
  731. {
  732. foreach(Player, i)
  733. {
  734. GetPlayerIp(i, ip, 16);
  735. if(strcmp(PlayerIP(i),ip) == 0)
  736. {
  737. if(!AdminImmunity{ i })
  738. {
  739. SendClientMessage(i, COLOR_NOTES, "zBlock: RCON login successfull, use '/zblock_login (password)' to get your 'Immunity'");
  740. }
  741. }
  742. }
  743. }
  744. return 1;
  745. }
  746.  
  747. public OnPlayerUpdate(playerid)
  748. {
  749. return 1;
  750. }
  751.  
  752. /***** STOCKs, zBlock TIMERs etc. *****/
  753.  
  754. stock SendMessageToAdmins(color, text[])
  755. {
  756. foreach(Player, i)
  757. {
  758. if(AdminImmunity{ i })
  759. {
  760. SendClientMessage(i, color, text);
  761. }
  762. }
  763. }
  764.  
  765. stock GetName(playerid)
  766. {
  767. new pnameid[24];
  768. GetPlayerName(playerid,pnameid,sizeof(pnameid));
  769. return pnameid;
  770. }
  771. stock PlayerIP(playerid)
  772. {
  773. new str[16];
  774. GetPlayerIp(playerid, str, sizeof(str));
  775. return str;
  776. }
  777.  
  778. stock ResetInfo(playerid)
  779. {
  780. Muted{ playerid } = false;
  781. ACDetected{ playerid } = false;
  782. AdminImmunity{ playerid } = false;
  783. LoggedIn{ playerid } = false;
  784.  
  785. AntiSpam[playerid] = 0;
  786. MutedTimes[playerid] = 0;
  787. ACTimesDetected[playerid] = 0;
  788. WarnForAdvert[playerid] = 0;
  789. RCONLoginFails[playerid] = 0;
  790. }
  791. stock DB_Escape(text[])
  792. {
  793. new
  794. ret[80 * 2],
  795. ch,
  796. i,
  797. j;
  798. while ((ch = text[i++]) && j < sizeof (ret))
  799. {
  800. if (ch == '\'')
  801. {
  802. if (j < sizeof (ret) - 2)
  803. {
  804. ret[j++] = '\'';
  805. ret[j++] = '\'';
  806. }
  807. }
  808. else if (j < sizeof (ret))
  809. {
  810. ret[j++] = ch;
  811. }
  812. else
  813. {
  814. j++;
  815. }
  816. }
  817. ret[sizeof (ret) - 1] = '\0';
  818. return ret;
  819. }
  820. stock GetPlayerSpeed(playerid)
  821. {
  822. new Float:ST[4];
  823. if(IsPlayerInAnyVehicle(playerid))
  824. GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
  825. else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
  826. ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
  827. return floatround(ST[3]);
  828. }
  829. stock GivePlayerCash(playerid, money)
  830. {
  831. Cash[playerid] += money;
  832. ResetMoneyBar(playerid);
  833. UpdateMoneyBar(playerid,Cash[playerid]);
  834. return Cash[playerid];
  835. }
  836. stock SetPlayerCash(playerid, money)
  837. {
  838. Cash[playerid] = money;
  839. ResetMoneyBar(playerid);
  840. UpdateMoneyBar(playerid,Cash[playerid]);
  841. return Cash[playerid];
  842. }
  843. stock ResetPlayerCash(playerid)
  844. {
  845. Cash[playerid] = 0;
  846. ResetMoneyBar(playerid);
  847. UpdateMoneyBar(playerid,Cash[playerid]);
  848. return Cash[playerid];
  849. }
  850. stock GetPlayerCash(playerid)
  851. {
  852. return Cash[playerid];
  853. }
  854. forward KickTimer(playerid);
  855. public KickTimer(playerid)
  856. {
  857. Kick(playerid);
  858. return 1;
  859. }
  860. forward Unmute(playerid);
  861. public Unmute(playerid)
  862. {
  863. Muted{ playerid } = false;
  864. return 1;
  865. }
  866. forward ResetAntiSpam(playerid);
  867. public ResetAntiSpam(playerid)
  868. {
  869. AntiSpam[playerid] = 0;
  870. return 1;
  871. }
  872. forward AntiCheat();
  873. public AntiCheat()
  874. {
  875. new Float:health, Float:armour, reason[24], stringz[120];
  876. new Float:x,Float:y,Float:z;
  877. new anim;
  878. new Difference, Result;
  879.  
  880. new Query[240], DBResult:result, day, month, year, second, minute, hour;
  881. getdate(day, month, year);
  882. gettime(hour, minute, second);
  883.  
  884. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  885. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  886.  
  887. foreach(Player, i)
  888. {
  889. GetPlayerHealth(i, health);
  890. GetPlayerArmour(i, armour);
  891. anim = GetPlayerAnimationIndex(i);
  892. GetPlayerVelocity(i,x,y,z);
  893.  
  894. if(!AdminImmunity{ i })
  895. {
  896. if(GetPlayerWeapon(i) == 38)
  897. {
  898. reason = "Minigun";
  899. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using {FFFFFF}Weapon Hacks!", GetName(i), i);
  900. SendClientMessageToAll(-1, stringz);
  901. SetTimerEx("KickTimer", 100, false, "i", i);
  902.  
  903. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  904. result = db_query(zBlock, Query);
  905.  
  906. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  907. else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  908.  
  909. printf("« ANTI-CHEAT has banned %s for using Weapon-Hacks!", GetName(i));
  910. }
  911. if(x <= -0.800000 || y <= -0.800000 || z <= -0.800000 && anim == 1008)
  912. {
  913. if(GetPlayerWeapon(i) != 46)
  914. {
  915. ACTimesDetected[i]++;
  916. if(ACTimesDetected[i] < 3)
  917. {
  918. format(stringz, sizeof(stringz), "* {F81414}zBlock has detected {FFFFFF}%s(%d){F81414} using {FFFFFF}Fly hacks!", GetName(i), i);
  919. SendMessageToAdmins(-1, stringz);
  920. }
  921. else if(ACTimesDetected[i] >= 3)
  922. {
  923. reason = "Fly hack";
  924. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using {FFFFFF}Fly Hacks!", GetName(i), i);
  925. SendClientMessageToAll(-1, stringz);
  926. SetTimerEx("KickTimer", 100, false, "i", i);
  927.  
  928. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  929. result = db_query(zBlock, Query);
  930.  
  931. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  932. else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  933.  
  934. printf("zBlock: %s has been banned for using Fly-Hacks!", GetName(i));
  935. }
  936. }
  937. }
  938. if(armour >= 100)
  939. {
  940. if(ACTimesDetected[i] == 0)
  941. {
  942. ACTimesDetected[i]++;
  943.  
  944. format(stringz, sizeof(stringz), "* {F81414}zBlock has detected {FFFFFF}%s(%d) {F81414}POSSIBLY using {FFFFFF}Armour hacks!", GetName(i), i);
  945. SendMessageToAdmins(-1, stringz);
  946. }
  947. }
  948. if(GetPlayerSpeed(i) > 271)
  949. {
  950. ACTimesDetected[i]++;
  951. if(ACTimesDetected[i] <= 4)
  952. {
  953. format(stringz, sizeof(stringz), "zBlock: %s(%d) is possibly Speed-Hacking, KM/H: %d - %d warnings", GetName(i), i, GetPlayerSpeed(i), ACTimesDetected[i]);
  954. SendMessageToAdmins(COLOR_NOTES2, stringz);
  955. printf("zBlock: %s has been detected using Speed-Hacks | %d KM/H, %d/5 warnings |", GetName(i), GetPlayerSpeed(i), ACTimesDetected[i]);
  956. }
  957. else
  958. {
  959. if(BanForSpeedHack)
  960. {
  961. reason = "Speed Hack";
  962. format(stringz, sizeof(stringz), "zBlock: %s(%d) has been BANNED for using Speed-Hacks %d warnings", GetName(i), i, ACTimesDetected[i]);
  963. SendMessageToAdmins(COLOR_NOTES2, stringz);
  964.  
  965. SetTimerEx("KickTimer", 100, false, "i", i);
  966.  
  967. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using Speed hacks!", GetName(i), i);
  968. SendClientMessageToAll(-1, stringz);
  969. printf("zBlock: %s has been banned for using Speed-Hacks!", GetName(i));
  970.  
  971. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  972. result = db_query(zBlock, Query);
  973. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  974. else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  975. }
  976. }
  977. printf("*** zBlock: %s | Possibly speed-hacking, %d/271", GetName(i), GetPlayerSpeed(i));
  978. }
  979. if(GetPlayerCash(i) > GetPlayerMoney(i))
  980. {
  981. if(!BanForMoneyHack)
  982. {
  983. ACDetected{ i } = true;
  984. ACTimesDetected[i]++;
  985.  
  986. if(!ACDetected { i })
  987. {
  988. format(stringz, sizeof(stringz), "zBlock: %s(%d) is ( possibly ) Money-Hacking, money reset.", GetName(i), i);
  989. SendMessageToAdmins(COLOR_NOTES2, stringz);
  990. format(stringz, sizeof(stringz), "zBlock: Summary about %s's warning: SSM: %d$ PSM: %d$", GetPlayerCash(i), GetPlayerMoney(i));
  991. SendMessageToAdmins(COLOR_NOTES2, stringz);
  992. }
  993.  
  994. Difference = GetPlayerCash(i) - GetPlayerMoney(i);
  995. Result = GetPlayerCash(i) - Difference;
  996. SetPlayerCash(i, Result);
  997. }
  998. else
  999. {
  1000. ACTimesDetected[i]++;
  1001. reason = "Money hack";
  1002. Difference = GetPlayerCash(i) - GetPlayerMoney(i);
  1003. Result = GetPlayerCash(i) - Difference;
  1004.  
  1005. printf("* zBlock: Adding ban on '%s' due to Money-Hacks", GetName(i));
  1006. printf("* zBlock: Proof: (SERVER SIDE) %d$ - (PLAYER SIDE) %d$, %d$ difference.", GetPlayerCash(i), GetPlayerMoney(i), Difference);
  1007.  
  1008. SetTimerEx("KickTimer", 100, false, "i", i);
  1009.  
  1010. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d) {F81414}for using Money hacks!", GetName(i), i);
  1011. SendClientMessageToAll(-1, stringz);
  1012.  
  1013. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(i)), DB_Escape(PlayerIP(i)), reason, BOT_NAME, datestring, timestring);
  1014. result = db_query(zBlock, Query);
  1015. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(i));
  1016. else printf(">> SQLITE: could not add %s's ban info", GetName(i));
  1017. }
  1018. }
  1019. }
  1020. }
  1021. return 1;
  1022. }
  1023. forward EndProcessing(playerid);
  1024. public EndProcessing(playerid)
  1025. {
  1026. new Float:x, Float:y, Float:z, reason[18] = "s0beit client", stringz[112];
  1027. GetPlayerCameraFrontVector(playerid, x, y, z);
  1028. #pragma unused x
  1029. #pragma unused y
  1030. if(z < -0.8)
  1031. {
  1032.  
  1033. SendClientMessage(playerid, COLOR_NOTES, "Processed successfully.");
  1034.  
  1035. ACDetected{ playerid } = true;
  1036. FirstSpawn{ playerid } = true;
  1037.  
  1038. ACTimesDetected[playerid]++;
  1039. if(ACTimesDetected[playerid] == 1)
  1040. {
  1041. printf("« ANTI-CHEAT has detected %s using Hacked Client - s0beit! »", GetName(playerid));
  1042. }
  1043. else if(ACTimesDetected[playerid] == 2)
  1044. {
  1045. SpawnPlayer(playerid);
  1046. printf("« ANTI-CHEAT has detected %s using Hacked Client - s0beit! »", GetName(playerid));
  1047. }
  1048. else if(ACTimesDetected[playerid] >= 3)
  1049. {
  1050. SetTimerEx("KickTimer", 100, false, "i", playerid);
  1051.  
  1052. SendClientMessage(playerid, -1, "{F81414}zBlock {FFFFFF}- {F81414}You've been banned for using {FFFFFF}s0beit {F81414}client!");
  1053. format(stringz, sizeof(stringz), "* {F81414}zBlock has banned {FFFFFF}%s(%d){F81414} for using {FFFFFF}s0beit {F81414}client!", GetName(playerid), playerid);
  1054. SendClientMessageToAll(-1, stringz);
  1055.  
  1056. printf("« ANTI-CHEAT has banned %s for Hacked Client - s0beit! »", GetName(playerid));
  1057. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
  1058.  
  1059. new Query[240], DBResult:result, day, month, year, second, minute, hour;
  1060. getdate(day, month, year);
  1061. gettime(hour, minute, second);
  1062.  
  1063. format(datestring, sizeof(datestring), "%i-%i-%i", day, month, year);
  1064. format(timestring, sizeof(timestring), "%i:%i:%i", hour, minute, second);
  1065.  
  1066. format(Query, sizeof(Query), "INSERT INTO `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", DB_Escape(GetName(playerid)), DB_Escape(PlayerIP(playerid)), reason, BOT_NAME, datestring, timestring);
  1067. result = db_query(zBlock, Query);
  1068. if(result) printf(">> SQLITE: successfully added %s's ban info", GetName(playerid));
  1069. else printf(">> SQLITE: could not add %s's ban info", GetName(playerid));
  1070. }
  1071. }
  1072. else
  1073. {
  1074. SendClientMessage(playerid, -1, "Processed successfully.");
  1075. FirstSpawn{ playerid } = false;
  1076. TogglePlayerControllable(playerid, 1);
  1077. }
  1078. return 1;
  1079. }
  1080. forward CheckForFile();
  1081. public CheckForFile()
  1082. {
  1083. new slhour, slminute, slsecond, slyear, slmonth, slday;
  1084. if(fexist("/zblock/password.txt"))
  1085. {
  1086. print("NOTIFICATION: 'password.txt' has been successfully created'");
  1087. print("INFO: File location: /scriptfiles/zBlock/\nINFO: Automatically set the default password.");
  1088. gettime(slhour, slminute, slsecond);
  1089. getdate(slyear, slmonth, slday);
  1090.  
  1091. new File:zBlockstuff = fopen("/zblock/password.txt", io_write);
  1092. if(zBlockstuff)
  1093. {
  1094. fwrite(zBlockstuff, "defaultpassword5791");
  1095. fclose(zBlockstuff);
  1096. }
  1097. }
  1098. else print("WARNING: could NOT create 'password.txt' at 'scriptfiles/zblock'");
  1099. return 1;
  1100. }
  1101. forward fcreate(filename[]);
  1102. public fcreate(filename[])
  1103. {
  1104. if (fexist(filename)){return false;}
  1105. new File:fhandle = fopen(filename,io_write);
  1106. fclose(fhandle);
  1107. return true;
  1108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement