Advertisement
Guest User

1

a guest
Nov 17th, 2016
1,508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.41 KB | None | 0 0
  1. /*
  2. Zombie Survival v2.0
  3. Made by Jelly23
  4. */
  5.  
  6. /*Includes*/
  7. #include <a_samp>
  8. #include <sscanf2>
  9. #include <izcmd>
  10. #include <a_mysql>
  11. #include <TextMenu>
  12. #include <foreach>
  13.  
  14. /*Variables*/
  15. new global[128];
  16. new banrowid[MAX_PLAYERS];
  17. new banrowname[MAX_PLAYERS][24];
  18. new banrowname2[MAX_PLAYERS][24];
  19. new addbaname[MAX_PLAYERS][24];
  20. new LBAN2[MAX_PLAYERS][31][24];
  21. new LBAN[MAX_PLAYERS][31];
  22.  
  23. /*Whirlpool*/
  24. native WP_Hash(buffer[], len, const str[]);
  25.  
  26. /*Enumerator - PlayerInfo*/
  27. enum playerinfo
  28. {
  29. ID,
  30. Pass[129],
  31. Logged,
  32. Level,
  33. Cash,
  34. Kills,
  35. Deaths
  36. };
  37. new PlayerInfo[MAX_PLAYERS][playerinfo];
  38.  
  39. /*Map System*/
  40. new mapid,
  41. Mapname[50],
  42. HumanX[30],
  43. HumanY[30],
  44. HumanZ[30],
  45. ZombieX[30],
  46. ZombieY[30],
  47. ZombieZ[30],
  48. Duration,
  49. Time,
  50. Weather,
  51. Interior,
  52. Filterscript[30];
  53.  
  54. /*Colors*/
  55. #define HUMAN_COLOR (0x0000BBAA)
  56. #define ZOMBIE_COLOR (0xAA3333AA)
  57.  
  58. /*Teams*/
  59. #define HUMAN (0)
  60. #define ZOMBIE (1)
  61.  
  62. /*Timers*/
  63. new mTimer;
  64.  
  65. /*Dialogs*/
  66. #define DIALOG_REGISTER (0)
  67. #define DIALOG_LOGIN (1)
  68. #define DIALOG_BANLIST (3)
  69. #define DIALOG_BANLIST2 (4)
  70. #define DIALOG_BANLIST3 (5)
  71. #define DIALOG_BANLIST4 (6)
  72. #define DIALOG_BANLIST5 (7)
  73. #define DIALOG_BANLIST6 (8)
  74. #define DIALOG_BANLIST7 (9)
  75. #define DIALOG_BANLIST8 (10)
  76. #define DIALOG_BANLIST9 (11)
  77. #define DIALOG_BANLIST10 (12)
  78. #define DIALOG_BANLIST11 (13)
  79. #define DIALOG_MAPLIST (14)
  80. #define DIALOG_MAPLIST2 (15)
  81. #define DIALOG_MAPLIST3 (16)
  82. #define DIALOG_MAPLIST4 (17)
  83. #define DIALOG_MAPLIST5 (18)
  84. #define DIALOG_MAPLIST6 (19)
  85.  
  86. /*TextDraw Menus*/
  87. #define MENU_OTHER (0)
  88. #define MENU_SHOP (1)
  89.  
  90. /*MySQL*/
  91. #define host "localhost"
  92. #define user "root"
  93. #define db "zombie"
  94. #define pass ""
  95.  
  96. /*Textdraws*/
  97. new Text:Zombie_Draws[11]; //Time and team info.
  98.  
  99. new mysql;
  100.  
  101. #if defined FILTERSCRIPT
  102.  
  103. public OnFilterScriptInit()
  104. {
  105. print("\n--------------------------------------");
  106. print(" Blank Filterscript by your name here");
  107. print("--------------------------------------\n");
  108. return 1;
  109. }
  110.  
  111. public OnFilterScriptExit()
  112. {
  113. return 1;
  114. }
  115.  
  116. #else
  117.  
  118. main()
  119. {
  120. print("\n----------------------------------");
  121. print(" Zombie Survival - v1.0");
  122. print("----------------------------------\n");
  123. }
  124.  
  125. #endif
  126.  
  127. public OnGameModeInit()
  128. {
  129. DisableInteriorEnterExits(); //Disables interior entrances/exit
  130. UsePlayerPedAnims(); // Uses standard player walking animation (animation of the CJ skin) instead of custom animations for every skin
  131. mysql_format(mysql, global, sizeof(global), "SELECT * FROM `maps` ORDER BY RAND() LIMIT 1");
  132. mysql_tquery(mysql, global, "LoadMaps", "");
  133. mTimer = SetTimer("MapTimer", 1000, true); //Map timer
  134. SetGameModeText("Zombie Survival v1.0"); //Mode Text
  135. AddPlayerClass(162,2296.5662,2451.6270,10.8203,87.8270,0,0,0,0,0,0);
  136. mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
  137. mysql = mysql_connect(host, user, db, pass);
  138. if(mysql_errno(mysql) != 0)
  139. {
  140. print("Could not connect to database!"); SendRconCommand("hostname MYSQL ERROR");
  141. }
  142. else
  143. {
  144. printf("MYSQL: Connected Successfully To Database (%s)",db);
  145. }
  146. Zombie_Draws[0] = TextDrawCreate(28.000000, 303.000000, "box");
  147. TextDrawLetterSize(Zombie_Draws[0], 0.000000, 3.500000);
  148. TextDrawTextSize(Zombie_Draws[0], 146.875000, 0.000000);
  149. TextDrawAlignment(Zombie_Draws[0], 1);
  150. TextDrawColor(Zombie_Draws[0], -1);
  151. TextDrawUseBox(Zombie_Draws[0], 1);
  152. TextDrawBoxColor(Zombie_Draws[0], 125);
  153. TextDrawSetShadow(Zombie_Draws[0], 0);
  154. TextDrawSetOutline(Zombie_Draws[0], 0);
  155. TextDrawBackgroundColor(Zombie_Draws[0], 120);
  156. TextDrawFont(Zombie_Draws[0], 1);
  157. TextDrawSetProportional(Zombie_Draws[0], 1);
  158. TextDrawSetShadow(Zombie_Draws[0], 0);
  159.  
  160. Zombie_Draws[1] = TextDrawCreate(43.799865, 303.000000, "Humans:_20~n~Zombies:_10");
  161. TextDrawLetterSize(Zombie_Draws[1], 0.400000, 1.600000);
  162. TextDrawAlignment(Zombie_Draws[1], 1);
  163. TextDrawColor(Zombie_Draws[1], -1);
  164. TextDrawSetShadow(Zombie_Draws[1], 0);
  165. TextDrawSetOutline(Zombie_Draws[1], 1);
  166. TextDrawBackgroundColor(Zombie_Draws[1], 255);
  167. TextDrawFont(Zombie_Draws[1], 1);
  168. TextDrawSetProportional(Zombie_Draws[1], 1);
  169. TextDrawSetShadow(Zombie_Draws[1], 0);
  170.  
  171. Zombie_Draws[2] = TextDrawCreate(28.000045, 339.299774, "box");
  172. TextDrawLetterSize(Zombie_Draws[2], 0.000000, -0.437500);
  173. TextDrawTextSize(Zombie_Draws[2], 146.688766, 0.000000);
  174. TextDrawAlignment(Zombie_Draws[2], 1);
  175. TextDrawColor(Zombie_Draws[2], -5963521);
  176. TextDrawUseBox(Zombie_Draws[2], 1);
  177. TextDrawBoxColor(Zombie_Draws[2], -5963521);
  178. TextDrawSetShadow(Zombie_Draws[2], 0);
  179. TextDrawSetOutline(Zombie_Draws[2], 0);
  180. TextDrawBackgroundColor(Zombie_Draws[2], 255);
  181. TextDrawFont(Zombie_Draws[2], 1);
  182. TextDrawSetProportional(Zombie_Draws[2], 1);
  183. TextDrawSetShadow(Zombie_Draws[2], 0);
  184.  
  185. Zombie_Draws[3] = TextDrawCreate(28.000045, 302.197509, "box");
  186. TextDrawLetterSize(Zombie_Draws[3], 0.000000, -0.437500);
  187. TextDrawTextSize(Zombie_Draws[3], 146.688766, 0.000000);
  188. TextDrawAlignment(Zombie_Draws[3], 1);
  189. TextDrawColor(Zombie_Draws[3], -5963521);
  190. TextDrawUseBox(Zombie_Draws[3], 1);
  191. TextDrawBoxColor(Zombie_Draws[3], -5963521);
  192. TextDrawSetShadow(Zombie_Draws[3], 0);
  193. TextDrawSetOutline(Zombie_Draws[3], 0);
  194. TextDrawBackgroundColor(Zombie_Draws[3], 255);
  195. TextDrawFont(Zombie_Draws[3], 1);
  196. TextDrawSetProportional(Zombie_Draws[3], 1);
  197. TextDrawSetShadow(Zombie_Draws[3], 0);
  198.  
  199. Zombie_Draws[4] = TextDrawCreate(151.999389, 339.900177, "box");
  200. TextDrawLetterSize(Zombie_Draws[4], 0.000000, -4.682541);
  201. TextDrawTextSize(Zombie_Draws[4], 146.688171, 0.000000);
  202. TextDrawAlignment(Zombie_Draws[4], 1);
  203. TextDrawColor(Zombie_Draws[4], -5963521);
  204. TextDrawUseBox(Zombie_Draws[4], 1);
  205. TextDrawBoxColor(Zombie_Draws[4], -5963521);
  206. TextDrawSetShadow(Zombie_Draws[4], 0);
  207. TextDrawSetOutline(Zombie_Draws[4], 0);
  208. TextDrawBackgroundColor(Zombie_Draws[4], 255);
  209. TextDrawFont(Zombie_Draws[4], 1);
  210. TextDrawSetProportional(Zombie_Draws[4], 1);
  211. TextDrawSetShadow(Zombie_Draws[4], 0);
  212.  
  213. Zombie_Draws[5] = TextDrawCreate(28.198883, 339.900177, "box");
  214. TextDrawLetterSize(Zombie_Draws[5], 0.000000, -4.682541);
  215. TextDrawTextSize(Zombie_Draws[5], 22.887638, 0.000000);
  216. TextDrawAlignment(Zombie_Draws[5], 1);
  217. TextDrawColor(Zombie_Draws[5], -5963521);
  218. TextDrawUseBox(Zombie_Draws[5], 1);
  219. TextDrawBoxColor(Zombie_Draws[5], -5963521);
  220. TextDrawSetShadow(Zombie_Draws[5], 0);
  221. TextDrawSetOutline(Zombie_Draws[5], 0);
  222. TextDrawBackgroundColor(Zombie_Draws[5], 255);
  223. TextDrawFont(Zombie_Draws[5], 1);
  224. TextDrawSetProportional(Zombie_Draws[5], 1);
  225. TextDrawSetShadow(Zombie_Draws[5], 0);
  226.  
  227. Zombie_Draws[6] = TextDrawCreate(49.899772, 284.698883, "Team_Info");
  228. TextDrawLetterSize(Zombie_Draws[6], 0.400000, 1.600000);
  229. TextDrawAlignment(Zombie_Draws[6], 1);
  230. TextDrawColor(Zombie_Draws[6], -1);
  231. TextDrawSetShadow(Zombie_Draws[6], 0);
  232. TextDrawSetOutline(Zombie_Draws[6], 1);
  233. TextDrawBackgroundColor(Zombie_Draws[6], 255);
  234. TextDrawFont(Zombie_Draws[6], 1);
  235. TextDrawSetProportional(Zombie_Draws[6], 1);
  236. TextDrawSetShadow(Zombie_Draws[6], 0);
  237.  
  238. Zombie_Draws[7] = TextDrawCreate(558.996826, 28.000167, "250");
  239. TextDrawLetterSize(Zombie_Draws[7], 0.400000, 1.600000);
  240. TextDrawAlignment(Zombie_Draws[7], 1);
  241. TextDrawColor(Zombie_Draws[7], -1);
  242. TextDrawSetShadow(Zombie_Draws[7], 0);
  243. TextDrawSetOutline(Zombie_Draws[7], 1);
  244. TextDrawBackgroundColor(Zombie_Draws[7], 255);
  245. TextDrawFont(Zombie_Draws[7], 2);
  246. TextDrawSetProportional(Zombie_Draws[7], 1);
  247. TextDrawSetShadow(Zombie_Draws[7], 0);
  248.  
  249. Zombie_Draws[8] = TextDrawCreate(548.000000, 32.200271, "box");
  250. TextDrawLetterSize(Zombie_Draws[8], 0.000000, 0.881999);
  251. TextDrawTextSize(Zombie_Draws[8], 603.750000, 0.000000);
  252. TextDrawAlignment(Zombie_Draws[8], 1);
  253. TextDrawColor(Zombie_Draws[8], -1);
  254. TextDrawUseBox(Zombie_Draws[8], 1);
  255. TextDrawBoxColor(Zombie_Draws[8], 125);
  256. TextDrawSetShadow(Zombie_Draws[8], 0);
  257. TextDrawSetOutline(Zombie_Draws[8], 0);
  258. TextDrawBackgroundColor(Zombie_Draws[8], 120);
  259. TextDrawFont(Zombie_Draws[8], 1);
  260. TextDrawSetProportional(Zombie_Draws[8], 1);
  261. TextDrawSetShadow(Zombie_Draws[8], 0);
  262.  
  263. Zombie_Draws[9] = TextDrawCreate(558.996337, 14.999958, "Time");
  264. TextDrawLetterSize(Zombie_Draws[9], 0.400000, 1.600000);
  265. TextDrawAlignment(Zombie_Draws[9], 1);
  266. TextDrawColor(Zombie_Draws[9], -1);
  267. TextDrawSetShadow(Zombie_Draws[9], 0);
  268. TextDrawSetOutline(Zombie_Draws[9], 1);
  269. TextDrawBackgroundColor(Zombie_Draws[9], 255);
  270. TextDrawFont(Zombie_Draws[9], 1);
  271. TextDrawSetProportional(Zombie_Draws[9], 1);
  272. TextDrawSetShadow(Zombie_Draws[9], 0);
  273.  
  274. Zombie_Draws[10] = TextDrawCreate(49.899772, 426.500671, "Map:");
  275. TextDrawLetterSize(Zombie_Draws[10], 0.400000, 1.600000);
  276. TextDrawAlignment(Zombie_Draws[10], 1);
  277. TextDrawColor(Zombie_Draws[10], -1);
  278. TextDrawSetShadow(Zombie_Draws[10], 0);
  279. TextDrawSetOutline(Zombie_Draws[10], 1);
  280. TextDrawBackgroundColor(Zombie_Draws[10], 255);
  281. TextDrawFont(Zombie_Draws[10], 1);
  282. TextDrawSetProportional(Zombie_Draws[10], 1);
  283. TextDrawSetShadow(Zombie_Draws[10], 0);
  284. return 1;
  285. }
  286. ERROR(playerid,msg[]) //Sends an error message
  287. {
  288. format(global,128,"{FF0000}[ERROR]:{FFFFFF} %s",msg);
  289. return SendClientMessage(playerid,-1,global);
  290. }
  291. forward MapTimer();
  292. public MapTimer()
  293. {
  294. Duration -= 1; //Map time decreasing
  295. new count[4];
  296. format(count,sizeof(count),"%i",Duration);
  297. TextDrawSetString(Zombie_Draws[7],count);
  298. TextDrawShowForAll(Zombie_Draws[7]);
  299. if(Duration <= 0) //Map Over, switching maps...
  300. {
  301. HumansWin();
  302. }
  303. if(Duration == 200) //Random zombie, and the next players to spawn wont be in human team.
  304. {
  305. new randomid = Iter_Random(Player); //A random player id will be stored in "randomid" var
  306. format(global,sizeof(global),"{FFFF00}[INFECTION]: {FFFFFF}%s has become a zombie.",GetName(randomid));
  307. SendClientMessageToAll(-1,global); //Sends the message letting everybody know who is the infected
  308. SetPlayerZombie(randomid); //Sets the random player's team to zombie
  309. UpdateTeams();
  310. }
  311. foreach(new i: Player)
  312. {
  313. SetPlayerScore(i,PlayerInfo[i][Kills]);
  314. if(GetCash(i) < GetPlayerMoney(i))
  315. {
  316. ResetPlayerMoney(i);
  317. GivePlayerMoney(i,PlayerInfo[i][Cash]);
  318. }
  319. }
  320. }
  321. UpdateTeams()//Updates the team info textdraw
  322. {
  323. new infodraw[36];
  324. format(infodraw,sizeof(infodraw),"~b~Humans:_%i~n~~r~Zombies:_%i",GetTeamCount(HUMAN),GetTeamCount(ZOMBIE));
  325. TextDrawSetString(Zombie_Draws[1],infodraw);
  326. TextDrawShowForAll(Zombie_Draws[1]);
  327. }
  328. HumansWin() //Humans Survived
  329. {
  330. KillTimer(mTimer); //Kills the timer
  331. foreach(new i: Player) //Loops through all players
  332. {
  333. if(GetPlayerTeam(i) == HUMAN)
  334. {
  335. GiveCash(i,10000); //Gives them all 10k
  336. }
  337. TextMenuShowForPlayer(i,MENU_OTHER,"Humans Survived","~w~ Every ~b~human~w~ has received ~g~$10,000"); //Shows the menu to everybody
  338. }
  339. SetTimer("Reset", 5000, false); //Will restart the map system
  340. }
  341. ZombiesWin() //Zombies win
  342. {
  343. KillTimer(mTimer); //Kills the timer
  344. foreach(new i: Player) //Loops through all players
  345. {
  346. GiveCash(i,5000); //Gives them all 50k
  347. TextMenuShowForPlayer(i,MENU_OTHER,"Zombies Win","~w~ Every ~r~zombie~w~ has received ~g~$5,000"); //Shows the menu to everybody
  348. }
  349. SetTimer("Reset", 5000, false); //Will restart the map system
  350. }
  351. forward Reset();//New dynamic map system
  352. public Reset()
  353. {
  354. new query[128];
  355. if(strcmp(Filterscript, "None"))
  356. {
  357. format(query,90,"unloadfs %s",Filterscript);
  358. SendRconCommand(query);
  359. }
  360. mysql_format(mysql, query, sizeof(query), "SELECT * FROM `maps` ORDER BY RAND() LIMIT 1");
  361. mysql_tquery(mysql, query, "LoadMaps", "");
  362. }
  363. forward LoadMaps(); //Loads the maps
  364. public LoadMaps()
  365. {
  366. new TurfS = cache_get_row_count();
  367. for(new i = 0; i < TurfS; i++)
  368. {
  369. mapid = cache_get_field_content_int(i,"mapid");
  370. cache_get_field_content(i, "Mapname", Mapname, mysql, 50);
  371.  
  372. cache_get_field_content(i, "HumanX", HumanX, mysql, 30);
  373. cache_get_field_content(i, "HumanY", HumanY, mysql, 30);
  374. cache_get_field_content(i, "HumanZ", HumanZ, mysql, 30);
  375.  
  376. cache_get_field_content(i, "ZombieX", ZombieX, mysql, 30);
  377. cache_get_field_content(i, "ZombieY", ZombieY, mysql, 30);
  378. cache_get_field_content(i, "ZombieZ", ZombieZ, mysql, 30);
  379.  
  380. Duration = cache_get_field_content_int(i,"Duration");
  381. Time = cache_get_field_content_int(i,"Time");
  382. Weather = cache_get_field_content_int(i,"Weather");
  383. Interior = cache_get_field_content_int(i,"Interior");
  384.  
  385. cache_get_field_content(i, "Filterscript", Filterscript, mysql, 30);
  386. }
  387. new str[90];
  388. format(str,90,"Map: %s (%d)",Mapname,mapid);
  389. TextDrawSetString(Zombie_Draws[10],str);
  390. TextDrawShowForAll(Zombie_Draws[10]);
  391. if(strcmp(Filterscript, "None"))
  392. {
  393. format(str,90,"loadfs %s",Filterscript);
  394. SendRconCommand(str);
  395. }
  396. SetWorldTime(Time);
  397. SetWeather(Weather);
  398. foreach(new p: Player) TextMenuHideForPlayer(p),SpawnPlayer(p); //Players are spawned
  399. mTimer = SetTimer("MapTimer", 1000, true); //MapTimer starts again
  400. }
  401. GetName(playerid) //Gets somebody's name
  402. {
  403. new name[MAX_PLAYER_NAME];
  404. GetPlayerName(playerid,name,sizeof(name));
  405. return name;
  406. }
  407. stock Float:GetDistanceBetweenPlayers(playerid,targetplayerid)
  408. {
  409. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  410. if(!IsPlayerConnected(playerid) || !IsPlayerConnected(targetplayerid))
  411. {
  412. return -1.00;
  413. }
  414. GetPlayerPos(playerid,x1,y1,z1);
  415. GetPlayerPos(targetplayerid,x2,y2,z2);
  416. return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  417. }
  418. SetPlayerZombie(playerid) //Sets a specific player to zombie
  419. {
  420. SetPlayerColor(playerid,ZOMBIE_COLOR); //Sets the player's color to zombie team's
  421. SetPlayerTeam(playerid,ZOMBIE); //Player is officialy in zombie team
  422. SetPlayerHealth(playerid,100); //Sets the health to 100
  423. switch(random(4)) //Sets the specific player's skin to four random skins
  424. {
  425. case 0: SetPlayerSkin(playerid,162);
  426. case 1: SetPlayerSkin(playerid,135);
  427. case 2: SetPlayerSkin(playerid,137);
  428. case 3: SetPlayerSkin(playerid,196);
  429. }
  430. ResetPlayerWeapons(playerid);
  431. ClearAnimations(playerid); //Clears the animations, so you don't get stuck after being set
  432. }
  433. forward GetClosestPlayer(p1);
  434. public GetClosestPlayer(p1)
  435. {
  436. new Float:dis,Float:dis2,player;
  437. player = -1;
  438. dis = 99999.99;
  439. foreach(Player,x)
  440. {
  441. if(x != p1)
  442. {
  443. dis2 = GetDistanceBetweenPlayers(x,p1);
  444. if(dis2 < dis && dis2 != -1.00)
  445. {
  446. dis = dis2;
  447. player = x;
  448. }
  449. }
  450. }
  451. return player;
  452. }
  453. SetPlayerHuman(playerid) //Sets a specific player to human
  454. {
  455. switch(random(8)) //Sets the specific player's skin to eight random skins
  456. {
  457. case 0: SetPlayerSkin(playerid,165);
  458. case 1: SetPlayerSkin(playerid,166);
  459. case 2: SetPlayerSkin(playerid,154);
  460. case 3: SetPlayerSkin(playerid,0);
  461. case 4: SetPlayerSkin(playerid,150);
  462. case 5: SetPlayerSkin(playerid,147);
  463. case 6: SetPlayerSkin(playerid,143);
  464. case 7: SetPlayerSkin(playerid,126);
  465. }
  466. SetPlayerColor(playerid,HUMAN_COLOR); //The specific player gets human color
  467. SetPlayerTeam(playerid,HUMAN); //You are officialy added in human team
  468. SetPlayerHealth(playerid,100); //Health set back to 100
  469. GivePlayerWeapon(playerid,24,400); //Desert eagle (24) is given to humans by default
  470. ClearAnimations(playerid); //Clears the animations, so you don't get stuck after being set
  471. }
  472. public OnGameModeExit()
  473. {
  474. return 1;
  475. }
  476.  
  477. public OnPlayerRequestClass(playerid, classid)
  478. {
  479. SetPlayerPos(playerid, 2296.5662,2451.6270, 10.8203);
  480. SetPlayerFacingAngle(playerid, 87.8270);
  481. SetPlayerCameraPos(playerid, 2293.3640,2451.7341,12.8203);
  482. SetPlayerCameraLookAt(playerid, 2296.5662,2451.6270, 10.8203);
  483. return 1;
  484. }
  485.  
  486. public OnPlayerConnect(playerid)
  487. {
  488. UpdateTeams();
  489. TextDrawShowForPlayer(playerid,Zombie_Draws[10]);
  490. TextDrawShowForPlayer(playerid,Zombie_Draws[9]);
  491. TextDrawShowForPlayer(playerid,Zombie_Draws[8]);
  492. TextDrawShowForPlayer(playerid,Zombie_Draws[7]);
  493. TextDrawShowForPlayer(playerid,Zombie_Draws[6]);
  494. TextDrawShowForPlayer(playerid,Zombie_Draws[5]);
  495. TextDrawShowForPlayer(playerid,Zombie_Draws[4]);
  496. TextDrawShowForPlayer(playerid,Zombie_Draws[3]);
  497. TextDrawShowForPlayer(playerid,Zombie_Draws[2]);
  498. TextDrawShowForPlayer(playerid,Zombie_Draws[1]);
  499. TextDrawShowForPlayer(playerid,Zombie_Draws[0]);
  500. PlayerInfo[playerid][Logged] = 0;
  501. mysql_format(mysql, global, sizeof(global),"SELECT * FROM `bans` WHERE `b_name` = '%e' or `b_ip` ='%s' LIMIT 1", GetName(playerid),GetIp(playerid));
  502. mysql_tquery(mysql, global, "OnBanCheck", "i", playerid);
  503. return 1;
  504. }
  505. KickEx(playerid)
  506. {
  507. SetTimerEx("DelayedKick", 1000, false, "i", playerid);
  508. }
  509. forward DelayedKick(playerid);
  510. public DelayedKick(playerid)
  511. {
  512. Kick(playerid);
  513. return 1;
  514. }
  515. forward OnBanCheck(playerid);
  516. public OnBanCheck(playerid)
  517. {
  518. new rows,fields;
  519. new adm[24],res[50],time[50],origin[24];
  520. cache_get_data(rows, fields, mysql);
  521. if(rows)
  522. {
  523. cache_get_field_content(0, "b_admin", adm, mysql, 24);
  524. cache_get_field_content(0, "b_reason", res, mysql,50);
  525. cache_get_field_content(0, "b_time", time, mysql, 50);
  526. cache_get_field_content(0, "b_name", origin, mysql, 24);
  527.  
  528. TogglePlayerSpectating(playerid,true);
  529. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  530. SendClientMessage(playerid,0xFF0080FF,"* You are banned from this server.");
  531. format(global,128,"* Account: %s",origin);
  532. format(global,128,"* Admin: %s",adm);
  533. format(global,128,"* Reason: %s / Time: %s",res,time);
  534. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  535. KickEx(playerid);
  536.  
  537. }
  538. else
  539. {
  540. new query[128];
  541. format(global,sizeof global,"%s has joined the server.",GetName(playerid));
  542. SendClientMessageToAll(0xFFFFFFAA,global);
  543. mysql_format(mysql, query, sizeof(query),"SELECT `pass` FROM `players` WHERE `name` = '%e'", GetName(playerid));
  544. mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
  545. }
  546. }
  547. forward OnAccountCheck(playerid);
  548. public OnAccountCheck(playerid)
  549. {
  550. new rows, fields,string[400];
  551. cache_get_data(rows, fields, mysql);
  552. if(rows)
  553. {
  554. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  555. cache_get_field_content(0, "pass", PlayerInfo[playerid][Pass], mysql, 129);
  556. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",string,"Login","");
  557.  
  558. }
  559. else
  560. {
  561. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account", GetName(playerid));
  562. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register",string,"Register","");
  563.  
  564. }
  565. }
  566. GetTeamCount(teamid)
  567. {
  568. new teamcount = 0;
  569. for(new i = 0; i < MAX_PLAYERS; i++)
  570. {
  571. if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
  572. if(GetPlayerTeam(i) != teamid) continue;
  573. teamcount++;
  574. }
  575. return teamcount;
  576. }
  577. public OnPlayerDisconnect(playerid, reason)
  578. {
  579. new reasons[14];
  580. switch(reason)
  581. {
  582. case 0: reasons = "Timeout/Crash";
  583. case 1: reasons = "Quit";
  584. case 2: reasons = "Kick/Ban";
  585. }
  586. format(global, sizeof global, "%s has left the server (%s).", GetName(playerid), reasons);
  587. SendClientMessageToAll(0xC4C4C4FF, global);
  588. SavePlayer(playerid);
  589. PlayerInfo[playerid][Kills] = 0;
  590. PlayerInfo[playerid][Deaths] = 0;
  591. PlayerInfo[playerid][Cash] = 0;
  592. PlayerInfo[playerid][Level] = 0;
  593. if(GetTeamCount(HUMAN) == 0)
  594. {
  595. ZombiesWin();
  596. }
  597. UpdateTeams();
  598. return 1;
  599. }
  600.  
  601. public OnPlayerSpawn(playerid)
  602. {
  603. if(Duration <= 200) //if Duration is 200 or below, next players to spawn will automatically be zombies
  604. {
  605. SetPlayerZombie(playerid); //Player is set to zombie team
  606. }
  607. else //if Duration is above 200, any player to spawn becomes human
  608. {
  609. SetPlayerHuman(playerid); //Player is set to human team
  610. }
  611. if(GetPlayerTeam(playerid) == ZOMBIE)
  612. {
  613. SetPlayerInterior(playerid,Interior);
  614. SetPlayerPos(playerid,floatstr(ZombieX),floatstr(ZombieY),floatstr(ZombieZ));
  615. }
  616. else
  617. {
  618. SetPlayerPos(playerid,floatstr(HumanX),floatstr(HumanY),floatstr(HumanZ));
  619. SetPlayerInterior(playerid,Interior);
  620. }
  621. UpdateTeams();
  622. return 1;
  623. }
  624.  
  625. public OnPlayerDeath(playerid, killerid, reason)
  626. {
  627. if(GetTeamCount(HUMAN) == 0)
  628. {
  629. ZombiesWin();
  630. }
  631. SendDeathMessage(killerid,playerid,reason);
  632. PlayerInfo[playerid][Deaths]++;
  633. if(killerid != INVALID_PLAYER_ID)
  634. {
  635. GiveCash(killerid,2455);
  636. PlayerInfo[killerid][Kills]++;
  637. SendClientMessage(killerid,-1,"{FFFF00}[KILL]: {FFFFFF}You received $2455 for killing somebody.");
  638. format(global,128,"{FFFF00}[DEATH]: {FFFFFF}You have been killed by %s.",GetName(killerid));
  639. SendClientMessage(playerid,-1,global);
  640. }
  641. return 1;
  642. }
  643.  
  644. public OnVehicleSpawn(vehicleid)
  645. {
  646. return 1;
  647. }
  648.  
  649. public OnVehicleDeath(vehicleid, killerid)
  650. {
  651. return 1;
  652. }
  653.  
  654. public OnPlayerText(playerid, text[])
  655. {
  656. return 1;
  657. }
  658.  
  659. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  660. {
  661. return 1;
  662. }
  663.  
  664. public OnPlayerExitVehicle(playerid, vehicleid)
  665. {
  666. return 1;
  667. }
  668.  
  669. public OnPlayerStateChange(playerid, newstate, oldstate)
  670. {
  671. return 1;
  672. }
  673.  
  674. public OnPlayerEnterCheckpoint(playerid)
  675. {
  676. return 1;
  677. }
  678.  
  679. public OnPlayerLeaveCheckpoint(playerid)
  680. {
  681. return 1;
  682. }
  683.  
  684. public OnPlayerEnterRaceCheckpoint(playerid)
  685. {
  686. return 1;
  687. }
  688.  
  689. public OnPlayerLeaveRaceCheckpoint(playerid)
  690. {
  691. return 1;
  692. }
  693.  
  694. public OnRconCommand(cmd[])
  695. {
  696. return 1;
  697. }
  698.  
  699. public OnPlayerRequestSpawn(playerid)
  700. {
  701. return 1;
  702. }
  703.  
  704. public OnObjectMoved(objectid)
  705. {
  706. return 1;
  707. }
  708.  
  709. public OnPlayerObjectMoved(playerid, objectid)
  710. {
  711. return 1;
  712. }
  713.  
  714. public OnPlayerPickUpPickup(playerid, pickupid)
  715. {
  716. return 1;
  717. }
  718.  
  719. public OnVehicleMod(playerid, vehicleid, componentid)
  720. {
  721. return 1;
  722. }
  723.  
  724. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  725. {
  726. return 1;
  727. }
  728.  
  729. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  730. {
  731. return 1;
  732. }
  733.  
  734. public OnPlayerSelectedMenuRow(playerid, row)
  735. {
  736. return 1;
  737. }
  738.  
  739. public OnPlayerExitedMenu(playerid)
  740. {
  741. return 1;
  742. }
  743.  
  744. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  745. {
  746. return 1;
  747. }
  748.  
  749. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  750. {
  751. if(newkeys & KEY_FIRE)
  752. {
  753. if(GetPlayerTeam(playerid) == ZOMBIE)
  754. {
  755. if(Duration <= 0) return ERROR(playerid,"Map is over, wait for the next one.");
  756. new humanvictim = GetClosestPlayer(playerid);
  757. if(IsPlayerConnected(humanvictim))
  758. {
  759. if(GetDistanceBetweenPlayers(playerid,humanvictim) < 3)
  760. {
  761. SetPlayerZombie(humanvictim);
  762. PlayerInfo[playerid][Kills]++;
  763. GiveCash(playerid,3200);
  764. SendClientMessage(playerid,-1,"{FFFF00}[INFECT]: {FFFFFF}You received $3200 for infecting somebody.");
  765. SendDeathMessage(playerid, humanvictim, 255);
  766. format(global,128,"{FFFF00}[INFECT]: {FFFFFF}You have been infected by %s.",GetName(playerid));
  767. SendClientMessage(humanvictim,-1,global);
  768. UpdateTeams();
  769. if(GetTeamCount(HUMAN) == 0)
  770. {
  771. ZombiesWin();
  772. }
  773. }
  774. }
  775. }
  776. }
  777. return 1;
  778. }
  779. public OnPlayerCommandReceived(playerid,cmdtext[])
  780. {
  781. if(PlayerInfo[playerid][Logged] == 0)
  782. {
  783. ERROR(playerid,"You must be logged in to use any command.");
  784. return 0;
  785. }
  786. return 1;
  787. }
  788. public OnRconLoginAttempt(ip[], password[], success)
  789. {
  790. return 1;
  791. }
  792.  
  793. public OnPlayerUpdate(playerid)
  794. {
  795. return 1;
  796. }
  797.  
  798. public OnPlayerStreamIn(playerid, forplayerid)
  799. {
  800. return 1;
  801. }
  802.  
  803. public OnPlayerStreamOut(playerid, forplayerid)
  804. {
  805. return 1;
  806. }
  807.  
  808. public OnVehicleStreamIn(vehicleid, forplayerid)
  809. {
  810. return 1;
  811. }
  812.  
  813. public OnVehicleStreamOut(vehicleid, forplayerid)
  814. {
  815. return 1;
  816. }
  817. SavePlayer(playerid)
  818. {
  819. if(PlayerInfo[playerid][Logged] == 1)
  820. {
  821. new query[256];
  822. mysql_format(mysql, query, sizeof(query),"UPDATE `players` SET `kills`='%d', `deaths`='%d', `cash`='%d', `Level`='%d' WHERE `name` = '%e'",PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths],PlayerInfo[playerid][Cash],PlayerInfo[playerid][Level],GetName(playerid));
  823. mysql_tquery(mysql, query, "", "");
  824. }
  825. }
  826. ResetCash(playerid)
  827. {
  828. PlayerInfo[playerid][Cash] = 0;
  829. ResetPlayerMoney(playerid);
  830. }
  831. GetCash(playerid)
  832. {
  833. return PlayerInfo[playerid][Cash];
  834. }
  835. GiveCash(playerid,cash)
  836. {
  837. PlayerInfo[playerid][Cash] += cash;
  838. GivePlayerMoney(playerid,cash);
  839. }
  840. forward GetLastBans(playerid);
  841. public GetLastBans(playerid)
  842. {
  843. new count,raw = cache_get_row_count(),lastbans[1000],Gn[MAX_PLAYER_NAME],AdminB[MAX_PLAYER_NAME],bTime[30],bReason[50];
  844. format(lastbans, sizeof(lastbans),"{FFFFFF}Name\t{FFFFFF}Admin\t{FFFFFF}Date\t{FFFFFF}Reason\n");
  845. for(new i=0; i < raw; i ++ )
  846. {
  847. LBAN[playerid][count] = cache_get_field_content_int(i,"bid");
  848. cache_get_field_content(i,"b_name",Gn,mysql,MAX_PLAYER_NAME);
  849. format(LBAN2[playerid][count],24,"%s",Gn);
  850. cache_get_field_content(i,"b_admin",AdminB,mysql,MAX_PLAYER_NAME);
  851. cache_get_field_content(i,"b_time",bTime,mysql,30);
  852. cache_get_field_content(i,"b_reason",bReason,mysql,50);
  853. format(lastbans, sizeof(lastbans), "%s\n%s\t%s\t%s\t%s", lastbans, Gn, AdminB, bTime, bReason);
  854. count++;
  855. }
  856. ShowPlayerDialog(playerid, DIALOG_BANLIST3, DIALOG_STYLE_TABLIST_HEADERS, "Ban List", lastbans, "Select", "Cancel");
  857. }
  858. forward MapEditor(playerid,mapidz);
  859. public MapEditor(playerid,mapidz)
  860. {
  861. new zcount = 0,raw = cache_get_row_count(),LittleString[90];
  862. for(new i=0; i < raw; i ++ )
  863. {
  864. zcount++;
  865. }
  866. if(zcount == 0) return ERROR(playerid,"There is no such map!");
  867. format(LittleString,sizeof(LittleString),"You are editing mapid %i",mapidz);
  868. ShowPlayerDialog(playerid, DIALOG_MAPLIST2, DIALOG_STYLE_LIST, LittleString,"Set Interior\nSet Time\nSet Weather\nSet Duration\nDelete Map", "Continue","Close");
  869. return 1;
  870. }
  871. forward EditBans(playerid,editname);
  872. public EditBans(playerid,editname)
  873. {
  874. new zcount = 0,raw = cache_get_row_count(),LittleString[90],Gn[24];
  875. format(LittleString,sizeof(LittleString),"You are editing %s's ban",editname);
  876. for(new i=0; i < raw; i ++ )
  877. {
  878. zcount++;
  879. cache_get_field_content(i,"b_admin",Gn,mysql,MAX_PLAYER_NAME);
  880. banrowid[playerid] = cache_get_field_content_int(i,"bid");
  881. format(banrowname2[playerid],24,"%s",Gn);
  882. }
  883. if(zcount == 0) return SendClientMessage(playerid,-1,"Error: there is no such ban!");
  884. ShowPlayerDialog(playerid, DIALOG_BANLIST8, DIALOG_STYLE_LIST, LittleString,"Player's Name\nAdmin's Name\nReason", "Continue","Close");
  885. return 1;
  886. }
  887. forward OnAccountRegister(playerid);
  888. public OnAccountRegister(playerid)
  889. {
  890. SendClientMessage(playerid, -1, "{FF0000}[ACCOUNT]: {FFFFFF}Successfully registered.");
  891. }
  892. forward OnAccountLoad(playerid);
  893. public OnAccountLoad(playerid)
  894. {
  895. PlayerInfo[playerid][ID] = cache_get_field_content_int(0, "id");
  896. PlayerInfo[playerid][Level] = cache_get_field_content_int(0, "Level");
  897. PlayerInfo[playerid][Cash] = cache_get_field_content_int(0, "cash");
  898. PlayerInfo[playerid][Kills] = cache_get_field_content_int(0, "kills");
  899. PlayerInfo[playerid][Deaths] = cache_get_field_content_int(0, "deaths");
  900. PlayerInfo[playerid][Logged] = 1;
  901.  
  902. ResetPlayerMoney(playerid);
  903. GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
  904. SendClientMessage(playerid, -1, "{FF0000}[ACCOUNT]: {FFFFFF}Successfully logged in.");
  905. return 1;
  906. }
  907. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  908. {
  909. if(dialogid == DIALOG_REGISTER)
  910. {
  911. new string[200];
  912. if(!response)
  913. {
  914. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account\n{FF0000}Please Register", GetName(playerid));
  915. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  916. }
  917. if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
  918. {
  919. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account\n{FF0000}Password too short or either long", GetName(playerid));
  920. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  921. }
  922. new query[600];
  923. WP_Hash(PlayerInfo[playerid][Pass], 129, inputtext);
  924. mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`name`,`Level`, `pass`, `kills`, `deaths`, `cash`, `IP`) VALUES ('%e','0','%e', 0, 0, 0, '%e')", GetName(playerid),PlayerInfo[playerid][Pass],GetIp(playerid));
  925. mysql_tquery(mysql, query, "OnAccountRegister", "d", playerid);
  926. PlayerInfo[playerid][Logged] = 1;
  927. SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
  928. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  929. }
  930. if(dialogid == DIALOG_LOGIN)
  931. {
  932. if(response)
  933. {
  934. new hpass[129],query[128];
  935. WP_Hash(hpass, 129, inputtext);
  936. if(!strcmp(hpass, PlayerInfo[playerid][Pass]))
  937. {
  938. mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1", GetName(playerid));
  939. mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
  940. }
  941. else
  942. {
  943. format(query, sizeof(query),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  944. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",query,"Login","");
  945. }
  946. }
  947. else
  948. {
  949. KickEx(playerid);
  950. }
  951. }
  952. if(dialogid == DIALOG_BANLIST11)
  953. {
  954. if(response)
  955. {
  956. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_name`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  957. mysql_tquery(mysql, global,"","");
  958. format(banrowname[playerid],24,"%s",inputtext);
  959. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Name successfuly changed.");
  960. }
  961. }
  962. if(dialogid == DIALOG_BANLIST10)
  963. {
  964. if(response)
  965. {
  966. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_admin`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  967. mysql_tquery(mysql, global,"","");
  968. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Admin's name successfuly changed.");
  969.  
  970. }
  971. }
  972. if(dialogid == DIALOG_BANLIST9)
  973. {
  974. if(response)
  975. {
  976. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_reason`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  977. mysql_tquery(mysql, global,"","");
  978. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Reason successfuly changed.");
  979. }
  980. }
  981. if(dialogid == DIALOG_BANLIST8)
  982. {
  983. if(response)
  984. {
  985. switch(listitem)
  986. {
  987. case 0: ShowPlayerDialog(playerid,DIALOG_BANLIST11, DIALOG_STYLE_INPUT, "Player's Name", "Enter a new name", "Change", "Cancel");
  988. case 1:
  989. {
  990. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"Only level 3 admins can use that feature");
  991. ShowPlayerDialog(playerid,DIALOG_BANLIST10, DIALOG_STYLE_INPUT, "Admin's Name", "Enter a new admin name", "Change", "Cancel");
  992. }
  993. case 2: ShowPlayerDialog(playerid,DIALOG_BANLIST9, DIALOG_STYLE_INPUT, "Reason", "Enter a new reason", "Change", "Cancel");
  994. }
  995. }
  996. }
  997. if(dialogid == DIALOG_BANLIST5)
  998. {
  999. if(response)
  1000. {
  1001. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `bans` WHERE `b_name` = '%e' LIMIT 1",inputtext);
  1002. mysql_tquery(mysql,global, "EditBans", "ds",playerid,inputtext);
  1003. format(banrowname[playerid],24,"%s",inputtext);
  1004. }
  1005. }
  1006. if(dialogid == DIALOG_BANLIST7)
  1007. {
  1008. if(response)
  1009. {
  1010. format(global,sizeof(global),"%s %s",addbaname[playerid], inputtext);
  1011. cmd_offban(playerid,global);
  1012. }
  1013. }
  1014. if(dialogid == DIALOG_BANLIST6)
  1015. {
  1016. if(response)
  1017. {
  1018. format(addbaname[playerid],24,"%s",inputtext);
  1019. ShowPlayerDialog(playerid,DIALOG_BANLIST7, DIALOG_STYLE_INPUT, "Add Ban", "Enter a reason", "Confirm", "Cancel");
  1020. }
  1021. }
  1022. if(dialogid == DIALOG_BANLIST4)
  1023. {
  1024. if(response)
  1025. {
  1026. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `bans` WHERE `b_name` LIKE '%%%s%%' OR `b_ip` LIKE '%%%s%%' ORDER BY `bid` DESC LIMIT 10",inputtext,inputtext);
  1027. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1028. }
  1029. }
  1030. if(dialogid == DIALOG_BANLIST3)
  1031. {
  1032. if(response)
  1033. {
  1034. if(PlayerInfo[playerid][Level] >= 2)
  1035. {
  1036. banrowid[playerid] = LBAN[playerid][listitem];
  1037. format(banrowname2[playerid],24,"%s",LBAN2[playerid][listitem]);
  1038. ShowPlayerDialog(playerid, DIALOG_BANLIST2, DIALOG_STYLE_MSGBOX, "Ban Info", "Would you like to unban that player?", "Unban", "Cancel");
  1039. }
  1040. }
  1041. }
  1042. if(dialogid == DIALOG_BANLIST2)
  1043. {
  1044. if(response)
  1045. {
  1046. mysql_format(mysql, global, sizeof(global),"DELETE FROM `bans` WHERE `bid` = '%d' LIMIT 1",banrowid[playerid]);
  1047. mysql_tquery(mysql, global,"","");
  1048. mysql_format(mysql, global, sizeof(global), "UPDATE `players` SET `Banned`= %d WHERE `b_name`='%e'",0,banrowname2[playerid]);
  1049. mysql_tquery(mysql, global, "QueryComplete", "");
  1050. format(global, sizeof(global),"{FF0000}[BANLIST]: {FFFFFF}You have successfully removed ban id %d",banrowid[playerid]);
  1051. SendClientMessage(playerid,-1,global);
  1052. }
  1053. }
  1054. if(dialogid == DIALOG_BANLIST)
  1055. {
  1056. if(response)
  1057. {
  1058. switch(listitem)
  1059. {
  1060. case 0:
  1061. {
  1062. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `bans` ORDER BY `bid` DESC LIMIT 30");
  1063. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1064. }
  1065. case 1:
  1066. {
  1067. ShowPlayerDialog(playerid,DIALOG_BANLIST4, DIALOG_STYLE_INPUT, "Search Bans", "Enter a name and results will show up", "Search", "Cancel");
  1068. }
  1069. case 2:
  1070. {
  1071. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1072. ShowPlayerDialog(playerid,DIALOG_BANLIST5, DIALOG_STYLE_INPUT, "Edit Bans", "Enter a ban name to edit it", "Confirm", "Cancel");
  1073. }
  1074. case 3:
  1075. {
  1076. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1077. ShowPlayerDialog(playerid,DIALOG_BANLIST6, DIALOG_STYLE_INPUT, "Add Ban", "Enter a Player's name", "Confirm", "Cancel");
  1078. }
  1079. }
  1080. }
  1081. }
  1082. if(dialogid == DIALOG_MAPLIST)
  1083. {
  1084. if(response)
  1085. {
  1086. banrowid[playerid] = strval(inputtext);
  1087. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `maps` WHERE `mapid` = '%d' LIMIT 1",banrowid[playerid]);
  1088. mysql_tquery(mysql,global, "MapEditor", "dd",playerid,banrowid[playerid]);
  1089. }
  1090. }
  1091. if(dialogid == DIALOG_MAPLIST2)
  1092. {
  1093. if(response)
  1094. {
  1095. switch(listitem)
  1096. {
  1097. case 0: ShowPlayerDialog(playerid,DIALOG_MAPLIST3, DIALOG_STYLE_INPUT, "Interior", "Enter a new interior ID below", "Confirm", "Cancel");
  1098. case 1: ShowPlayerDialog(playerid,DIALOG_MAPLIST4, DIALOG_STYLE_INPUT, "Time", "Below goes the new map time", "Confirm", "Cancel");
  1099. case 2: ShowPlayerDialog(playerid,DIALOG_MAPLIST5, DIALOG_STYLE_INPUT, "Weather", "Below goes the weather ID", "Confirm", "Cancel");
  1100. case 3: ShowPlayerDialog(playerid,DIALOG_MAPLIST6, DIALOG_STYLE_INPUT, "Map Duration", "Minimum = 255","Confirm", "Cancel");
  1101. case 4:
  1102. {
  1103. mysql_format(mysql, global, sizeof(global),"DELETE FROM `maps` WHERE `mapid` = '%d' LIMIT 1",banrowid[playerid]);
  1104. mysql_tquery(mysql, global,"","");
  1105. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You removed map id %i",banrowid[playerid]);
  1106. SendClientMessage(playerid,-1,global);
  1107. }
  1108. }
  1109. }
  1110. }
  1111. if(dialogid == DIALOG_MAPLIST3)
  1112. {
  1113. if(response)
  1114. {
  1115. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Interior`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1116. mysql_tquery(mysql, global, "QueryComplete", "");
  1117. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's interior to %i",banrowid[playerid],strval(inputtext));
  1118. SendClientMessage(playerid,-1,global);
  1119. }
  1120. }
  1121. if(dialogid == DIALOG_MAPLIST4)
  1122. {
  1123. if(response)
  1124. {
  1125. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Time`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1126. mysql_tquery(mysql, global, "QueryComplete", "");
  1127. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's world time to %i",banrowid[playerid],strval(inputtext));
  1128. SendClientMessage(playerid,-1,global);
  1129. }
  1130. }
  1131. if(dialogid == DIALOG_MAPLIST5)
  1132. {
  1133. if(response)
  1134. {
  1135. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Weather`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1136. mysql_tquery(mysql, global, "QueryComplete", "");
  1137. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's weather to %i",banrowid[playerid],strval(inputtext));
  1138. SendClientMessage(playerid,-1,global);
  1139. }
  1140. }
  1141. if(dialogid == DIALOG_MAPLIST6)
  1142. {
  1143. if(response)
  1144. {
  1145. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Duration`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1146. mysql_tquery(mysql, global, "QueryComplete", "");
  1147. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's duration to %i",banrowid[playerid],strval(inputtext));
  1148. SendClientMessage(playerid,-1,global);
  1149. }
  1150. }
  1151. return 1;
  1152. }
  1153.  
  1154. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  1155. {
  1156. return 1;
  1157. }
  1158. public OnTextMenuResponse(playerid,menuid,listitem)
  1159. {
  1160. if(menuid == MENU_SHOP)
  1161. {
  1162. if(GetPlayerTeam(playerid) == ZOMBIE) return ERROR(playerid,"Nice try.");
  1163. switch(listitem)
  1164. {
  1165. case 1:
  1166. {
  1167. if(GetCash(playerid) < 2500) return ERROR(playerid,"You need $2500 in order to buy this weapon.");
  1168. GiveCash(playerid,-2500);
  1169. GivePlayerWeapon(playerid,25,100);
  1170. }
  1171. case 2:
  1172. {
  1173. if(GetCash(playerid) < 4300) return ERROR(playerid,"You need $4300 in order to buy this weapon.");
  1174. GiveCash(playerid,-4300);
  1175. GivePlayerWeapon(playerid,30,100);
  1176. }
  1177. case 3:
  1178. {
  1179. if(GetCash(playerid) < 5000) return ERROR(playerid,"You need $5000 in order to buy this weapon.");
  1180. GiveCash(playerid,-5000);
  1181. GivePlayerWeapon(playerid,31,100);
  1182. }
  1183. case 4:
  1184. {
  1185. if(GetCash(playerid) < 3400) return ERROR(playerid,"You need $3400 in order to buy this weapon.");
  1186. GiveCash(playerid,-3400);
  1187. GivePlayerWeapon(playerid,29,100);
  1188. }
  1189. case 5:
  1190. {
  1191. if(GetCash(playerid) < 1500) return ERROR(playerid,"You need $1500 in order to buy this weapon.");
  1192. GiveCash(playerid,-1500);
  1193. GivePlayerWeapon(playerid,24,100);
  1194. }
  1195. case 6:
  1196. {
  1197. if(GetCash(playerid) < 6500) return ERROR(playerid,"You need $6500 in order to buy this weapon.");
  1198. GiveCash(playerid,-6500);
  1199. GivePlayerWeapon(playerid,27,150);
  1200. }
  1201. case 7:
  1202. {
  1203. if(GetCash(playerid) < 7500) return ERROR(playerid,"You need $7500 in order to buy this weapon.");
  1204. GiveCash(playerid,-7500);
  1205. GivePlayerWeapon(playerid,34,150);
  1206. }
  1207. case 8:
  1208. {
  1209. if(GetCash(playerid) < 3000) return ERROR(playerid,"You need $3000 in order to buy an armor.");
  1210. GiveCash(playerid,-3000);
  1211. SetPlayerArmour(playerid,100);
  1212. }
  1213. }
  1214. }
  1215. return 1;
  1216. }
  1217. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  1218. {
  1219. if(!success)
  1220. {
  1221. ERROR(playerid,"Invalid command! please take a look into /cmds");
  1222. }
  1223. return 1;
  1224. }
  1225. GetTeamName(playerid)
  1226. {
  1227. new tname[10];
  1228. if(GetPlayerTeam(playerid) == HUMAN)
  1229. {
  1230. tname = "~b~Human";
  1231. }
  1232. else
  1233. {
  1234. tname = "~r~Zombie";
  1235. }
  1236. return tname;
  1237. }
  1238. GetPlayerAdmin(playerid)
  1239. {
  1240. new rankname[25];
  1241. switch(PlayerInfo[playerid][Level])
  1242. {
  1243. case 1: rankname = "~b~Moderator";
  1244. case 2: rankname = "~g~Administrator";
  1245. case 3: rankname = "~p~Manager";
  1246. case 4: rankname = "~r~Owner";
  1247. }
  1248. return rankname;
  1249. }
  1250. GetIp(playerid)
  1251. {
  1252. new ip[16];
  1253. GetPlayerIp(playerid, ip, 16);
  1254. return ip;
  1255. }
  1256. BanPlayer(admin[],id,resa[])
  1257. {
  1258. SetPlayerPos(id,197.6661,173.8179,1003.0234);
  1259. SetPlayerInterior(id,3);
  1260. SetCameraBehindPlayer(id);
  1261. new Year, Month, Day,tima[80],Query[600],Hour, Minute, Second;
  1262. getdate(Year, Month, Day);
  1263. gettime(Hour, Minute, Second);
  1264. format(tima,sizeof(tima),"%d/%d/%d | %02d:%02d",Day,Month,Year,Hour,Minute);
  1265. mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `bans` (`b_name`,`b_ip`,`b_admin`,`b_reason`,`b_time`) VALUES ('%s','%s','%s','%s','%s')",GetName(id),GetIp(id),admin,resa,tima);
  1266. mysql_tquery(mysql, Query,"","");
  1267. KickEx(id);
  1268. return 1;
  1269. }
  1270. /*Commands*/
  1271. CMD:commands(playerid) return cmd_cmds(playerid);
  1272. CMD:cmds(playerid)
  1273. {
  1274. new Cmds[350];
  1275. strcat(Cmds," ~y~/stats~n~");
  1276. strcat(Cmds," ~y~/credits~n~");
  1277. strcat(Cmds," ~y~/savestats~n~");
  1278. strcat(Cmds," ~y~/kill~n~");
  1279. strcat(Cmds," ~y~/shop~n~");
  1280. strcat(Cmds," ~y~/admins~n~");
  1281. strcat(Cmds," ~y~/rules~n~");
  1282. strcat(Cmds," ~y~/report");
  1283. TextMenuShowForPlayer(playerid,MENU_OTHER,"Commands",Cmds);
  1284. return 1;
  1285. }
  1286. CMD:rules(playerid)
  1287. {
  1288. new Rules[350];
  1289. strcat(Rules," ~y~1-~w~ Respect admins/players~n~");
  1290. strcat(Rules," ~y~2-~w~ Cheating/Hacking will lead to a ban~n~");
  1291. strcat(Rules," ~y~3-~w~ You may not ask for score/cash/level~n~");
  1292. strcat(Rules," ~y~4-~w~ You may not abuse bugs, report them~n~");
  1293. strcat(Rules," ~y~5-~w~ C-Bug isn't allowed here~n~");
  1294. strcat(Rules," ~y~6-~w~ You may not disturb admins~n~");
  1295. strcat(Rules," ~y~7-~w~ Banned? Do not evade, appeal at forums~n~");
  1296. strcat(Rules," ~y~8-~w~ Racism isn't tolerated in here");
  1297. TextMenuShowForPlayer(playerid,MENU_OTHER,"Rules",Rules);
  1298. return 1;
  1299. }
  1300. CMD:credits(playerid)
  1301. {
  1302. new Credits[29];
  1303. strcat(Credits,"~y~ Developer: ~w~Jelly23");
  1304. TextMenuShowForPlayer(playerid,MENU_OTHER,"Credits",Credits);
  1305. return 1;
  1306. }
  1307. CMD:stats(playerid)
  1308. {
  1309. new Stats[210];
  1310. format(Stats,204," ~y~Name: ~w~%s~n~ ~y~Admin Level: ~w~%i~n~ ~y~Cash: ~g~$%i~n~ ~y~Kills: ~w~%i~n~ ~y~Deaths: ~w~%i~n~ ~y~Team: ~w~%s",
  1311. GetName(playerid),PlayerInfo[playerid][Level],GetCash(playerid),PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths],GetTeamName(playerid));
  1312. TextMenuShowForPlayer(playerid,MENU_OTHER,"Statistics",Stats);
  1313. return 1;
  1314. }
  1315. CMD:savestats(playerid)
  1316. {
  1317. SavePlayer(playerid);
  1318. SendClientMessage(playerid,-1,"{FFFF00}[STATS]: {FFFFFF}Stats saved!");
  1319. return 1;
  1320. }
  1321. CMD:kill(playerid) return SetPlayerHealth(playerid,0),SendClientMessage(playerid,-1,"{FF0000}[SUICIDE]: {FFFFFF}You killed yourself");
  1322. CMD:shop(playerid)
  1323. {
  1324. if(GetPlayerTeam(playerid) != HUMAN) return ERROR(playerid,"You must be a human to use this command.");
  1325. if(Duration < 200) return ERROR(playerid,"You can't buy anymore weapons once the first zombie appears. Wait for the next round.");
  1326. new Shop[350];
  1327. strcat(Shop," ~r~1-~w~ Shotgun (~g~$2500~w~)~n~");
  1328. strcat(Shop," ~r~2-~w~ AK47 (~g~$4300~w~)~n~");
  1329. strcat(Shop," ~r~3-~w~ M4 (~g~$5000~w~)~n~");
  1330. strcat(Shop," ~r~4-~w~ MP5 (~g~$3400~w~)~n~");
  1331. strcat(Shop," ~r~5-~w~ Desert Eagle (~g~$1500~w~)~n~");
  1332. strcat(Shop," ~r~6-~w~ Combat Shotgun (~g~$6500~w~)~n~");
  1333. strcat(Shop," ~r~7-~w~ Sniper Rifle (~g~$7500~w~)~n~");
  1334. strcat(Shop," ~r~8-~w~ Armor (~g~$3000~w~)");
  1335. TextMenuShowForPlayer(playerid,MENU_SHOP,"Shop",Shop,8);
  1336. return 1;
  1337. }
  1338. CMD:admins(playerid)
  1339. {
  1340. new admins[1500],count;
  1341. foreach(new i: Player)
  1342. {
  1343. if(PlayerInfo[i][Level] >= 1)
  1344. {
  1345. count++;
  1346. format(admins,sizeof(admins)," ~y~%s-_%s(%d)_-_%s~n~",admins,GetName(i),i,GetPlayerAdmin(i));
  1347. }
  1348. }
  1349. if(count == 0)
  1350. {
  1351. admins = " No ~r~admins ~w~online right now";
  1352. }
  1353. TextMenuShowForPlayer(playerid,MENU_OTHER,"Admins",admins);
  1354. return 1;
  1355. }
  1356. CMD:acmds(playerid)
  1357. {
  1358. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1359. new ACMDS[350];
  1360. strcat(ACMDS," ~b~Level 1:~w~ /warn /kick /spec /specoff /spawn /slap~n~");
  1361. strcat(ACMDS," ~g~Level 2:~w~ /banlist /ban /unban /weaps /disarm /giveallcash~n~");
  1362. strcat(ACMDS," ~p~Level 3:~w~ /offban /setlevel /setkills /setdeaths /resetcash~n~");
  1363. strcat(ACMDS," ~r~Level 4:~w~ /setweather /settime /gmx /setcash~n~");
  1364. TextMenuShowForPlayer(playerid,MENU_OTHER,"Admin Commands",ACMDS);
  1365. return 1;
  1366. }
  1367. CMD:warn(playerid, params[])
  1368. {
  1369. new id, reason[24];
  1370. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1371. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /warn [playerid] [reason]");
  1372. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1373. format(global, sizeof(global), "{FF0000}[WARN]: %s has been warned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1374. SendClientMessageToAll(-1, global);
  1375. return 1;
  1376. }
  1377. CMD:kick(playerid, params[])
  1378. {
  1379. new id, reason[24];
  1380. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1381. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid] [reason]");
  1382. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1383. format(global, sizeof(global), "{FF0000}[KICK]: %s has been kicked by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1384. SendClientMessageToAll(-1, global);
  1385. KickEx(id);
  1386. return 1;
  1387. }
  1388. CMD:spec(playerid, params[])
  1389. {
  1390. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1391. new id;
  1392. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spec [playerid]");
  1393. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1394. if(IsPlayerInAnyVehicle(id))
  1395. {
  1396. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1397. TogglePlayerSpectating(playerid, 1);
  1398. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
  1399. }
  1400. else
  1401. {
  1402. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1403. TogglePlayerSpectating(playerid, 1);
  1404. PlayerSpectatePlayer(playerid, id);
  1405. }
  1406. return 1;
  1407. }
  1408.  
  1409. CMD:specoff(playerid)
  1410. {
  1411. if(PlayerInfo[playerid][Level] == 0) return 0;
  1412. TogglePlayerSpectating(playerid, 0);
  1413. SpawnPlayer(playerid);
  1414. return 1;
  1415. }
  1416. CMD:spawn(playerid, params[])
  1417. {
  1418. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1419. new id;
  1420. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spawn [playerid]");
  1421. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1422. SpawnPlayer(id);
  1423. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have spawned '%s'",GetName(id));
  1424. SendClientMessage(playerid,-1,global);
  1425. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have been spawned by '%s'",GetName(playerid));
  1426. SendClientMessage(id,-1,global);
  1427. return 1;
  1428. }
  1429. CMD:slap(playerid, params[])
  1430. {
  1431. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1432. new Float:xPos[3],id;
  1433. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /slap [playerid]");
  1434. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1435. GetPlayerPos(id,xPos[0],xPos[1],xPos[2]);
  1436. SetPlayerPos(id,xPos[0],xPos[1],xPos[2]+7);
  1437. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have slapped '%s'",GetName(id));
  1438. SendClientMessage(playerid,-1,global);
  1439. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have been slapped by '%s'",GetName(playerid));
  1440. SendClientMessage(id,-1,global);
  1441. return 1;
  1442. }
  1443. CMD:ban(playerid,params[])
  1444. {
  1445. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1446. new id, reason[50];
  1447. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid,-1,"USAGE: /ban [playerid] [reason]");
  1448. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1449. if(PlayerInfo[playerid][Level] <= PlayerInfo[id][Level]) return ERROR(playerid,"You can't ban that player.");
  1450. format(global, sizeof(global), "{FF0000}[BAN]: {FFFFFF}%s has been banned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1451. SendClientMessageToAll(-1, global);
  1452. BanPlayer(GetName(playerid),id,reason);
  1453. return 1;
  1454. }
  1455. CMD:unban(playerid, params[])
  1456. {
  1457. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1458. new target[50];
  1459. if(sscanf(params,"s[50]", target)) return SendClientMessage(playerid,-1,"USAGE: /unban [name]");
  1460. mysql_format(mysql, global, sizeof(global),"SELECT * FROM `bans` WHERE `b_name` ='%e' OR `b_ip` ='%e' LIMIT 1",target,target);
  1461. mysql_tquery(mysql, global,"OnAccountUnban","ds",playerid,target);
  1462. return 1;
  1463. }
  1464. forward OnAccountUnban(playerid,tar[]);
  1465. public OnAccountUnban(playerid,tar[])
  1466. {
  1467. new rows, fields;
  1468. cache_get_data(rows, fields, mysql);
  1469. if(rows)
  1470. {
  1471. new Query[200];
  1472. mysql_format(mysql, Query, sizeof(Query),"DELETE FROM `bans` WHERE `b_name` = '%e' or `b_ip` ='%e' LIMIT 1",tar,tar);
  1473. mysql_tquery(mysql, Query,"","");
  1474. format(global, sizeof(global),"{00FF00}[UNBAN]: {FFFFFF}You have successfully unbanned account/ip %s",tar);
  1475. SendClientMessage(playerid,-1,global);
  1476. }
  1477. else
  1478. {
  1479. ERROR(playerid,"No such ban found.");
  1480. }
  1481. return 1;
  1482. }
  1483. CMD:weaps(playerid, params[])
  1484. {
  1485. if(PlayerInfo[playerid][Level] >= 2)
  1486. {
  1487. new count = 0;
  1488. new ammo, weaponid, weapon[30], string26[150], id;
  1489. if(!sscanf(params, "u", id))
  1490. {
  1491. for (new c = 0; c < 13; c++)
  1492. {
  1493. GetPlayerWeaponData(id, c, weaponid, ammo);
  1494. if (weaponid != 0 && ammo != 0)
  1495. {
  1496. count++;
  1497. }
  1498. }
  1499. SendClientMessage(playerid, -1, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
  1500. if(count > 0)
  1501. {
  1502. for (new c = 0; c < 13; c++)
  1503. {
  1504. GetPlayerWeaponData(id, c, weaponid, ammo);
  1505. if (weaponid != 0 && ammo != 0)
  1506. {
  1507. GetWeaponName(weaponid, weapon, 24);
  1508. format(string26, sizeof(string26), "{00FF00}Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
  1509. SendClientMessage(playerid, -1, string26);
  1510. }
  1511. }
  1512. }
  1513. else
  1514. {
  1515. ERROR(playerid,"This player has no weapons.");
  1516. }
  1517. return 1;
  1518. }
  1519. else return SendClientMessage(playerid, -1, "USAGE: /weaps [id]");
  1520. }
  1521. else return ERROR(playerid,"You must be an administrator to use this command.");
  1522. }
  1523. CMD:disarm(playerid, params[])
  1524. {
  1525. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1526. new id;
  1527. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /disarm [playerid]");
  1528. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1529. ResetPlayerWeapons(id);
  1530. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have disarmed '%s'",GetName(id));
  1531. SendClientMessage(playerid,-1,global);
  1532. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have been disarmed by '%s'",GetName(playerid));
  1533. SendClientMessage(id,-1,global);
  1534. return 1;
  1535. }
  1536. CMD:giveallcash(playerid, params[])
  1537. {
  1538. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1539. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /giveallcash [cash]");
  1540. new strt[200];
  1541. foreach(new i: Player)
  1542. {
  1543. GiveCash(i,strval(params));
  1544. }
  1545. format(strt,127," %s ~w~%s has given everyone ~g~$%i",GetPlayerAdmin(playerid),GetName(playerid),strval(params));
  1546. TextMenuShowForPlayer(playerid,MENU_OTHER,"Cash",strt);
  1547. return 1;
  1548. }
  1549. CMD:offban(playerid, params[])
  1550. {
  1551. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1552. new target[24],reason[50];
  1553. if(sscanf(params, "s[24]s[50]", target, reason)) return SendClientMessage(playerid,-1,"USAGE: /offban [account] [reason]");
  1554. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1",target);
  1555. mysql_tquery(mysql,global,"OnAccountBan","dss",playerid,target,reason);
  1556. return 1;
  1557. }
  1558. forward OnAccountBan(playerid,target[],offreason[]);
  1559. public OnAccountBan(playerid,target[],offreason[])
  1560. {
  1561. new zcount=0,raw = cache_get_row_count(),ggwzd[20],Query[200];
  1562. for(new i=0; i < raw; i ++ )
  1563. {
  1564. zcount++;
  1565. cache_get_field_content(i,"IP",ggwzd,mysql,20);
  1566. }
  1567. if(zcount == 0) return ERROR(playerid,"No such account found.");
  1568. new tima[80];
  1569. new Year, Month, Day;
  1570. getdate(Year, Month, Day);
  1571. new Hour, Minute, Second;
  1572. gettime(Hour, Minute, Second);
  1573. format(tima,sizeof(tima),"%d/%d/%d | %d:%d",Day,Month,Year,Hour,Minute);
  1574. mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `bans` (`b_name`,`b_ip`,`b_admin`,`b_reason`,`b_time`) VALUES ('%s','%s','%s','%s','%s')",target,ggwzd,GetName(playerid),offreason,tima);
  1575. mysql_tquery(mysql, Query,"","");
  1576. format(global,sizeof(global),"{FFFF00}[OFF-BAN]: {FFFFFF}You have offline-banned %s [Reason: %s]", target, offreason );
  1577. SendClientMessage(playerid,-1,global);
  1578. return 1;
  1579. }
  1580. CMD:setlevel(playerid, params[])
  1581. {
  1582. new id,level;
  1583. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1584. if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "USAGE: /setlevel [playerid] [level]");
  1585. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1586. if(level < 0) return ERROR(playerid,"Levels are between 0-4 only");
  1587. if(level > 4) return ERROR(playerid,"Levels are between 0-4 only");
  1588. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}Your level was set to '%i' by %s.", level,GetName(playerid));
  1589. SendClientMessage(id,-1, global);
  1590. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}You have given level '%i' to %s.", level,GetName(id));
  1591. SendClientMessage(playerid,-1, global);
  1592. PlayerInfo[id][Level] = level;
  1593. return 1;
  1594. }
  1595. CMD:setkills(playerid, params[])
  1596. {
  1597. new id,kill;
  1598. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1599. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setkills [playerid] [kills]");
  1600. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1601. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}Your kills were set to '%i' by %s.", kill,GetName(playerid));
  1602. SendClientMessage(id,-1, global);
  1603. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}You have set %s's kills to %i.",GetName(id),kill);
  1604. SendClientMessage(playerid,-1, global);
  1605. PlayerInfo[id][Kills] = kill;
  1606. return 1;
  1607. }
  1608. CMD:setdeaths(playerid, params[])
  1609. {
  1610. new id,kill;
  1611. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1612. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setdeaths [playerid] [deaths]");
  1613. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1614. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your deaths were set to '%i' by %s.", kill,GetName(playerid));
  1615. SendClientMessage(id,-1, global);
  1616. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's deaths to %i.",GetName(id),kill);
  1617. SendClientMessage(playerid,-1, global);
  1618. PlayerInfo[id][Deaths] = kill;
  1619. return 1;
  1620. }
  1621. CMD:resetcash(playerid, params[])
  1622. {
  1623. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1624. new id;
  1625. if(sscanf(params, "ud", id)) return SendClientMessage(playerid, -1, "USAGE: /resetcash [playerid]");
  1626. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1627. ResetCash(id);
  1628. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}You have reset %s's cash",GetName(id));
  1629. SendClientMessage(playerid,-1,global);
  1630. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}Your cash was reset by '%s'",GetName(playerid));
  1631. SendClientMessage(id,-1,global);
  1632. return 1;
  1633. }
  1634. CMD:settime(playerid,params[])
  1635. {
  1636. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1637. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /settime [time]");
  1638. SetWorldTime(strval(params));
  1639. return 1;
  1640. }
  1641. CMD:setweather(playerid,params[])
  1642. {
  1643. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1644. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /setweather [time]");
  1645. SetWeather(strval(params));
  1646. return 1;
  1647. }
  1648. CMD:setcash(playerid, params[])
  1649. {
  1650. new id,kill;
  1651. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1652. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setcash [playerid] [cash]");
  1653. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1654. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your cash was set to $%i by %s.", kill,GetName(playerid));
  1655. SendClientMessage(id,-1, global);
  1656. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's cash to $%i.",GetName(id),kill);
  1657. SendClientMessage(playerid,-1, global);
  1658. ResetCash(id);
  1659. GiveCash(id,kill);
  1660. return 1;
  1661. }
  1662. CMD:report(playerid, params[])
  1663. {
  1664. new id,reason[50];
  1665. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /report [playerid] [reason]");
  1666. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1667. format(global, sizeof(global), "{FF0000}[REPORT]: {FFFFFF}%s has reported %s(%i). [Reason: %s]", GetName(playerid),GetName(id),id,reason);
  1668. foreach(new I: Player)
  1669. {
  1670. if(PlayerInfo[I][Level] >= 1) SendClientMessage(I,-1, global);
  1671. }
  1672. SendClientMessage(playerid,-1,"{FFFF00}[REPORT]: {FFFFFF}Your report was sent to the staff, wait for a response!");
  1673. return 1;
  1674. }
  1675. CMD:banlist(playerid)
  1676. {
  1677. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be a moderator to use this command.");
  1678. ShowPlayerDialog(playerid, DIALOG_BANLIST, DIALOG_STYLE_LIST, "{FFFF00}Ban List","Last Bans\nFind Bans\nEdit Bans\nAdd Ban", "Close","");
  1679. return 1;
  1680. }
  1681. CMD:mapeditor(playerid)
  1682. {
  1683. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1684. ShowPlayerDialog(playerid,DIALOG_MAPLIST, DIALOG_STYLE_INPUT, "Map Editor", "Enter a mapid below:", "Edit", "Cancel");
  1685. return 1;
  1686. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement