Advertisement
Guest User

Untitled

a guest
Nov 4th, 2016
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.22 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. OnBanCheck(playerid);
  502. return 1;
  503. }
  504. KickEx(playerid)
  505. {
  506. SetTimerEx("DelayedKick", 1000, false, "i", playerid);
  507. }
  508. forward DelayedKick(playerid);
  509. public DelayedKick(playerid)
  510. {
  511. Kick(playerid);
  512. return 1;
  513. }
  514. forward OnBanCheck(playerid);
  515. public OnBanCheck(playerid)
  516. {
  517. new rows,fields;
  518. new adm[24],res[50],time[50],origin[24];
  519. cache_get_data(rows, fields, mysql);
  520. if(rows)
  521. {
  522. cache_get_field_content(0, "b_admin", adm, mysql, 24);
  523. cache_get_field_content(0, "b_reason", res, mysql,50);
  524. cache_get_field_content(0, "b_time", time, mysql, 50);
  525. cache_get_field_content(0, "b_name", origin, mysql, 24);
  526.  
  527. TogglePlayerSpectating(playerid,true);
  528. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  529. SendClientMessage(playerid,0xFF0080FF,"* You are banned from this server.");
  530. format(global,128,"* Account: %s",origin);
  531. format(global,128,"* Admin: %s",adm);
  532. format(global,128,"* Reason: %s / Time: %s",res,time);
  533. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  534. KickEx(playerid);
  535.  
  536. }
  537. else
  538. {
  539. new query[128];
  540. format(global,sizeof global,"%s has joined the server.",GetName(playerid));
  541. SendClientMessageToAll(0xFFFFFFAA,global);
  542. mysql_format(mysql, query, sizeof(query),"SELECT `pass` FROM `players` WHERE `name` = '%e'", GetName(playerid));
  543. mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
  544. }
  545. }
  546. forward OnAccountCheck(playerid);
  547. public OnAccountCheck(playerid)
  548. {
  549. new rows, fields,string[400];
  550. cache_get_data(rows, fields, mysql);
  551. if(rows)
  552. {
  553. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  554. cache_get_field_content(0, "pass", PlayerInfo[playerid][Pass], mysql, 129);
  555. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",string,"Login","");
  556.  
  557. }
  558. else
  559. {
  560. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account", GetName(playerid));
  561. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register",string,"Register","");
  562.  
  563. }
  564. }
  565. GetTeamCount(teamid)
  566. {
  567. new teamcount = 0;
  568. for(new i = 0; i < MAX_PLAYERS; i++)
  569. {
  570. if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
  571. if(GetPlayerTeam(i) != teamid) continue;
  572. teamcount++;
  573. }
  574. return teamcount;
  575. }
  576. public OnPlayerDisconnect(playerid, reason)
  577. {
  578. new reasons[14];
  579. switch(reason)
  580. {
  581. case 0: reasons = "Timeout/Crash";
  582. case 1: reasons = "Quit";
  583. case 2: reasons = "Kick/Ban";
  584. }
  585. format(global, sizeof global, "%s has left the server (%s).", GetName(playerid), reasons);
  586. SendClientMessageToAll(0xC4C4C4FF, global);
  587. SavePlayer(playerid);
  588. PlayerInfo[playerid][Kills] = 0;
  589. PlayerInfo[playerid][Deaths] = 0;
  590. PlayerInfo[playerid][Cash] = 0;
  591. PlayerInfo[playerid][Level] = 0;
  592. if(GetTeamCount(HUMAN) == 0)
  593. {
  594. ZombiesWin();
  595. }
  596. UpdateTeams();
  597. return 1;
  598. }
  599.  
  600. public OnPlayerSpawn(playerid)
  601. {
  602. if(Duration <= 200) //if Duration is 200 or below, next players to spawn will automatically be zombies
  603. {
  604. SetPlayerZombie(playerid); //Player is set to zombie team
  605. }
  606. else //if Duration is above 200, any player to spawn becomes human
  607. {
  608. SetPlayerHuman(playerid); //Player is set to human team
  609. }
  610. if(GetPlayerTeam(playerid) == ZOMBIE)
  611. {
  612. SetPlayerInterior(playerid,Interior);
  613. SetPlayerPos(playerid,floatstr(ZombieX),floatstr(ZombieY),floatstr(ZombieZ));
  614. }
  615. else
  616. {
  617. SetPlayerPos(playerid,floatstr(HumanX),floatstr(HumanY),floatstr(HumanZ));
  618. SetPlayerInterior(playerid,Interior);
  619. }
  620. UpdateTeams();
  621. return 1;
  622. }
  623.  
  624. public OnPlayerDeath(playerid, killerid, reason)
  625. {
  626. if(GetTeamCount(HUMAN) == 0)
  627. {
  628. ZombiesWin();
  629. }
  630. SendDeathMessage(killerid,playerid,reason);
  631. PlayerInfo[playerid][Deaths]++;
  632. if(killerid != INVALID_PLAYER_ID)
  633. {
  634. GiveCash(killerid,2455);
  635. PlayerInfo[killerid][Kills]++;
  636. SendClientMessage(killerid,-1,"{FFFF00}[KILL]: {FFFFFF}You received $2455 for killing somebody.");
  637. format(global,128,"{FFFF00}[DEATH]: {FFFFFF}You have been killed by %s.",GetName(killerid));
  638. SendClientMessage(playerid,-1,global);
  639. }
  640. return 1;
  641. }
  642.  
  643. public OnVehicleSpawn(vehicleid)
  644. {
  645. return 1;
  646. }
  647.  
  648. public OnVehicleDeath(vehicleid, killerid)
  649. {
  650. return 1;
  651. }
  652.  
  653. public OnPlayerText(playerid, text[])
  654. {
  655. return 1;
  656. }
  657.  
  658. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  659. {
  660. return 1;
  661. }
  662.  
  663. public OnPlayerExitVehicle(playerid, vehicleid)
  664. {
  665. return 1;
  666. }
  667.  
  668. public OnPlayerStateChange(playerid, newstate, oldstate)
  669. {
  670. return 1;
  671. }
  672.  
  673. public OnPlayerEnterCheckpoint(playerid)
  674. {
  675. return 1;
  676. }
  677.  
  678. public OnPlayerLeaveCheckpoint(playerid)
  679. {
  680. return 1;
  681. }
  682.  
  683. public OnPlayerEnterRaceCheckpoint(playerid)
  684. {
  685. return 1;
  686. }
  687.  
  688. public OnPlayerLeaveRaceCheckpoint(playerid)
  689. {
  690. return 1;
  691. }
  692.  
  693. public OnRconCommand(cmd[])
  694. {
  695. return 1;
  696. }
  697.  
  698. public OnPlayerRequestSpawn(playerid)
  699. {
  700. return 1;
  701. }
  702.  
  703. public OnObjectMoved(objectid)
  704. {
  705. return 1;
  706. }
  707.  
  708. public OnPlayerObjectMoved(playerid, objectid)
  709. {
  710. return 1;
  711. }
  712.  
  713. public OnPlayerPickUpPickup(playerid, pickupid)
  714. {
  715. return 1;
  716. }
  717.  
  718. public OnVehicleMod(playerid, vehicleid, componentid)
  719. {
  720. return 1;
  721. }
  722.  
  723. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  724. {
  725. return 1;
  726. }
  727.  
  728. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  729. {
  730. return 1;
  731. }
  732.  
  733. public OnPlayerSelectedMenuRow(playerid, row)
  734. {
  735. return 1;
  736. }
  737.  
  738. public OnPlayerExitedMenu(playerid)
  739. {
  740. return 1;
  741. }
  742.  
  743. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  744. {
  745. return 1;
  746. }
  747.  
  748. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  749. {
  750. if(newkeys & KEY_FIRE)
  751. {
  752. if(GetPlayerTeam(playerid) == ZOMBIE)
  753. {
  754. if(Duration <= 0) return ERROR(playerid,"Map is over, wait for the next one.");
  755. new humanvictim = GetClosestPlayer(playerid);
  756. if(IsPlayerConnected(humanvictim))
  757. {
  758. if(GetDistanceBetweenPlayers(playerid,humanvictim) < 3)
  759. {
  760. SetPlayerZombie(humanvictim);
  761. PlayerInfo[playerid][Kills]++;
  762. GiveCash(playerid,3200);
  763. SendClientMessage(playerid,-1,"{FFFF00}[INFECT]: {FFFFFF}You received $3200 for infecting somebody.");
  764. SendDeathMessage(playerid, humanvictim, 255);
  765. format(global,128,"{FFFF00}[INFECT]: {FFFFFF}You have been infected by %s.",GetName(playerid));
  766. SendClientMessage(humanvictim,-1,global);
  767. UpdateTeams();
  768. if(GetTeamCount(HUMAN) == 0)
  769. {
  770. ZombiesWin();
  771. }
  772. }
  773. }
  774. }
  775. }
  776. return 1;
  777. }
  778. public OnPlayerCommandReceived(playerid,cmdtext[])
  779. {
  780. if(PlayerInfo[playerid][Logged] == 0)
  781. {
  782. ERROR(playerid,"You must be logged in to use any command.");
  783. return 0;
  784. }
  785. return 1;
  786. }
  787. public OnRconLoginAttempt(ip[], password[], success)
  788. {
  789. return 1;
  790. }
  791.  
  792. public OnPlayerUpdate(playerid)
  793. {
  794. return 1;
  795. }
  796.  
  797. public OnPlayerStreamIn(playerid, forplayerid)
  798. {
  799. return 1;
  800. }
  801.  
  802. public OnPlayerStreamOut(playerid, forplayerid)
  803. {
  804. return 1;
  805. }
  806.  
  807. public OnVehicleStreamIn(vehicleid, forplayerid)
  808. {
  809. return 1;
  810. }
  811.  
  812. public OnVehicleStreamOut(vehicleid, forplayerid)
  813. {
  814. return 1;
  815. }
  816. SavePlayer(playerid)
  817. {
  818. if(PlayerInfo[playerid][Logged] == 1)
  819. {
  820. new query[256];
  821. 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));
  822. mysql_tquery(mysql, query, "", "");
  823. }
  824. }
  825. ResetCash(playerid)
  826. {
  827. PlayerInfo[playerid][Cash] = 0;
  828. ResetPlayerMoney(playerid);
  829. }
  830. GetCash(playerid)
  831. {
  832. return PlayerInfo[playerid][Cash];
  833. }
  834. GiveCash(playerid,cash)
  835. {
  836. PlayerInfo[playerid][Cash] += cash;
  837. GivePlayerMoney(playerid,cash);
  838. }
  839. forward GetLastBans(playerid);
  840. public GetLastBans(playerid)
  841. {
  842. new count,raw = cache_get_row_count(),lastbans[1000],Gn[MAX_PLAYER_NAME],AdminB[MAX_PLAYER_NAME],bTime[30],bReason[50];
  843. format(lastbans, sizeof(lastbans),"{FFFFFF}Name\t{FFFFFF}Admin\t{FFFFFF}Date\t{FFFFFF}Reason\n");
  844. for(new i=0; i < raw; i ++ )
  845. {
  846. LBAN[playerid][count] = cache_get_field_content_int(i,"bid");
  847. cache_get_field_content(i,"b_name",Gn,mysql,MAX_PLAYER_NAME);
  848. format(LBAN2[playerid][count],24,"%s",Gn);
  849. cache_get_field_content(i,"b_admin",AdminB,mysql,MAX_PLAYER_NAME);
  850. cache_get_field_content(i,"b_time",bTime,mysql,30);
  851. cache_get_field_content(i,"b_reason",bReason,mysql,50);
  852. format(lastbans, sizeof(lastbans), "%s\n%s\t%s\t%s\t%s", lastbans, Gn, AdminB, bTime, bReason);
  853. count++;
  854. }
  855. ShowPlayerDialog(playerid, DIALOG_BANLIST3, DIALOG_STYLE_TABLIST_HEADERS, "Ban List", lastbans, "Select", "Cancel");
  856. }
  857. forward MapEditor(playerid,mapidz);
  858. public MapEditor(playerid,mapidz)
  859. {
  860. new zcount = 0,raw = cache_get_row_count(),LittleString[90];
  861. for(new i=0; i < raw; i ++ )
  862. {
  863. zcount++;
  864. }
  865. if(zcount == 0) return ERROR(playerid,"There is no such map!");
  866. format(LittleString,sizeof(LittleString),"You are editing mapid %i",mapidz);
  867. ShowPlayerDialog(playerid, DIALOG_MAPLIST2, DIALOG_STYLE_LIST, LittleString,"Set Interior\nSet Time\nSet Weather\nSet Duration\nDelete Map", "Continue","Close");
  868. return 1;
  869. }
  870. forward EditBans(playerid,editname);
  871. public EditBans(playerid,editname)
  872. {
  873. new zcount = 0,raw = cache_get_row_count(),LittleString[90],Gn[24];
  874. format(LittleString,sizeof(LittleString),"You are editing %s's ban",editname);
  875. for(new i=0; i < raw; i ++ )
  876. {
  877. zcount++;
  878. cache_get_field_content(i,"b_admin",Gn,mysql,MAX_PLAYER_NAME);
  879. banrowid[playerid] = cache_get_field_content_int(i,"bid");
  880. format(banrowname2[playerid],24,"%s",Gn);
  881. }
  882. if(zcount == 0) return SendClientMessage(playerid,-1,"Error: there is no such ban!");
  883. ShowPlayerDialog(playerid, DIALOG_BANLIST8, DIALOG_STYLE_LIST, LittleString,"Player's Name\nAdmin's Name\nReason", "Continue","Close");
  884. return 1;
  885. }
  886. forward OnAccountRegister(playerid);
  887. public OnAccountRegister(playerid)
  888. {
  889. SendClientMessage(playerid, -1, "{FF0000}[ACCOUNT]: {FFFFFF}Successfully registered.");
  890. }
  891. forward OnAccountLoad(playerid);
  892. public OnAccountLoad(playerid)
  893. {
  894. PlayerInfo[playerid][ID] = cache_get_field_content_int(0, "id");
  895. PlayerInfo[playerid][Level] = cache_get_field_content_int(0, "Level");
  896. PlayerInfo[playerid][Cash] = cache_get_field_content_int(0, "cash");
  897. PlayerInfo[playerid][Kills] = cache_get_field_content_int(0, "kills");
  898. PlayerInfo[playerid][Deaths] = cache_get_field_content_int(0, "deaths");
  899. PlayerInfo[playerid][Logged] = 1;
  900.  
  901. ResetPlayerMoney(playerid);
  902. GivePlayerMoney(playerid,PlayerInfo[playerid][Cash]);
  903. SendClientMessage(playerid, -1, "{FF0000}[ACCOUNT]: {FFFFFF}Successfully logged in.");
  904. return 1;
  905. }
  906. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  907. {
  908. if(dialogid == DIALOG_REGISTER)
  909. {
  910. new string[200];
  911. if(!response)
  912. {
  913. 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));
  914. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  915. }
  916. if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
  917. {
  918. 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));
  919. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  920. }
  921. new query[600];
  922. WP_Hash(PlayerInfo[playerid][Pass], 129, inputtext);
  923. 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));
  924. mysql_tquery(mysql, query, "OnAccountRegister", "d", playerid);
  925. PlayerInfo[playerid][Logged] = 1;
  926. SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
  927. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  928. }
  929. if(dialogid == DIALOG_LOGIN)
  930. {
  931. if(response)
  932. {
  933. new hpass[129],query[128];
  934. WP_Hash(hpass, 129, inputtext);
  935. if(!strcmp(hpass, PlayerInfo[playerid][Pass]))
  936. {
  937. mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1", GetName(playerid));
  938. mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
  939. }
  940. else
  941. {
  942. format(query, sizeof(query),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  943. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",query,"Login","");
  944. }
  945. }
  946. else
  947. {
  948. KickEx(playerid);
  949. }
  950. }
  951. if(dialogid == DIALOG_BANLIST11)
  952. {
  953. if(response)
  954. {
  955. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_name`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  956. mysql_tquery(mysql, global,"","");
  957. format(banrowname[playerid],24,"%s",inputtext);
  958. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Name successfuly changed.");
  959. }
  960. }
  961. if(dialogid == DIALOG_BANLIST10)
  962. {
  963. if(response)
  964. {
  965. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_admin`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  966. mysql_tquery(mysql, global,"","");
  967. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Admin's name successfuly changed.");
  968.  
  969. }
  970. }
  971. if(dialogid == DIALOG_BANLIST9)
  972. {
  973. if(response)
  974. {
  975. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_reason`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  976. mysql_tquery(mysql, global,"","");
  977. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Reason successfuly changed.");
  978. }
  979. }
  980. if(dialogid == DIALOG_BANLIST8)
  981. {
  982. if(response)
  983. {
  984. switch(listitem)
  985. {
  986. case 0: ShowPlayerDialog(playerid,DIALOG_BANLIST11, DIALOG_STYLE_INPUT, "Player's Name", "Enter a new name", "Change", "Cancel");
  987. case 1:
  988. {
  989. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"Only level 3 admins can use that feature");
  990. ShowPlayerDialog(playerid,DIALOG_BANLIST10, DIALOG_STYLE_INPUT, "Admin's Name", "Enter a new admin name", "Change", "Cancel");
  991. }
  992. case 2: ShowPlayerDialog(playerid,DIALOG_BANLIST9, DIALOG_STYLE_INPUT, "Reason", "Enter a new reason", "Change", "Cancel");
  993. }
  994. }
  995. }
  996. if(dialogid == DIALOG_BANLIST5)
  997. {
  998. if(response)
  999. {
  1000. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `bans` WHERE `b_name` = '%e' LIMIT 1",inputtext);
  1001. mysql_tquery(mysql,global, "EditBans", "ds",playerid,inputtext);
  1002. format(banrowname[playerid],24,"%s",inputtext);
  1003. }
  1004. }
  1005. if(dialogid == DIALOG_BANLIST7)
  1006. {
  1007. if(response)
  1008. {
  1009. format(global,sizeof(global),"%s %s",addbaname[playerid], inputtext);
  1010. cmd_offban(playerid,global);
  1011. }
  1012. }
  1013. if(dialogid == DIALOG_BANLIST6)
  1014. {
  1015. if(response)
  1016. {
  1017. format(addbaname[playerid],24,"%s",inputtext);
  1018. ShowPlayerDialog(playerid,DIALOG_BANLIST7, DIALOG_STYLE_INPUT, "Add Ban", "Enter a reason", "Confirm", "Cancel");
  1019. }
  1020. }
  1021. if(dialogid == DIALOG_BANLIST4)
  1022. {
  1023. if(response)
  1024. {
  1025. 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);
  1026. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1027. }
  1028. }
  1029. if(dialogid == DIALOG_BANLIST3)
  1030. {
  1031. if(response)
  1032. {
  1033. if(PlayerInfo[playerid][Level] >= 2)
  1034. {
  1035. banrowid[playerid] = LBAN[playerid][listitem];
  1036. format(banrowname2[playerid],24,"%s",LBAN2[playerid][listitem]);
  1037. ShowPlayerDialog(playerid, DIALOG_BANLIST2, DIALOG_STYLE_MSGBOX, "Ban Info", "Would you like to unban that player?", "Unban", "Cancel");
  1038. }
  1039. }
  1040. }
  1041. if(dialogid == DIALOG_BANLIST2)
  1042. {
  1043. if(response)
  1044. {
  1045. mysql_format(mysql, global, sizeof(global),"DELETE FROM `bans` WHERE `bid` = '%d' LIMIT 1",banrowid[playerid]);
  1046. mysql_tquery(mysql, global,"","");
  1047. mysql_format(mysql, global, sizeof(global), "UPDATE `players` SET `Banned`= %d WHERE `b_name`='%e'",0,banrowname2[playerid]);
  1048. mysql_tquery(mysql, global, "QueryComplete", "");
  1049. format(global, sizeof(global),"{FF0000}[BANLIST]: {FFFFFF}You have successfully removed ban id %d",banrowid[playerid]);
  1050. SendClientMessage(playerid,-1,global);
  1051. }
  1052. }
  1053. if(dialogid == DIALOG_BANLIST)
  1054. {
  1055. if(response)
  1056. {
  1057. switch(listitem)
  1058. {
  1059. case 0:
  1060. {
  1061. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `bans` ORDER BY `bid` DESC LIMIT 30");
  1062. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1063. }
  1064. case 1:
  1065. {
  1066. ShowPlayerDialog(playerid,DIALOG_BANLIST4, DIALOG_STYLE_INPUT, "Search Bans", "Enter a name and results will show up", "Search", "Cancel");
  1067. }
  1068. case 2:
  1069. {
  1070. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1071. ShowPlayerDialog(playerid,DIALOG_BANLIST5, DIALOG_STYLE_INPUT, "Edit Bans", "Enter a ban name to edit it", "Confirm", "Cancel");
  1072. }
  1073. case 3:
  1074. {
  1075. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1076. ShowPlayerDialog(playerid,DIALOG_BANLIST6, DIALOG_STYLE_INPUT, "Add Ban", "Enter a Player's name", "Confirm", "Cancel");
  1077. }
  1078. }
  1079. }
  1080. }
  1081. if(dialogid == DIALOG_MAPLIST)
  1082. {
  1083. if(response)
  1084. {
  1085. banrowid[playerid] = strval(inputtext);
  1086. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `maps` WHERE `mapid` = '%d' LIMIT 1",banrowid[playerid]);
  1087. mysql_tquery(mysql,global, "MapEditor", "dd",playerid,banrowid[playerid]);
  1088. }
  1089. }
  1090. if(dialogid == DIALOG_MAPLIST2)
  1091. {
  1092. if(response)
  1093. {
  1094. switch(listitem)
  1095. {
  1096. case 0: ShowPlayerDialog(playerid,DIALOG_MAPLIST3, DIALOG_STYLE_INPUT, "Interior", "Enter a new interior ID below", "Confirm", "Cancel");
  1097. case 1: ShowPlayerDialog(playerid,DIALOG_MAPLIST4, DIALOG_STYLE_INPUT, "Time", "Below goes the new map time", "Confirm", "Cancel");
  1098. case 2: ShowPlayerDialog(playerid,DIALOG_MAPLIST5, DIALOG_STYLE_INPUT, "Weather", "Below goes the weather ID", "Confirm", "Cancel");
  1099. case 3: ShowPlayerDialog(playerid,DIALOG_MAPLIST6, DIALOG_STYLE_INPUT, "Map Duration", "Minimum = 255","Confirm", "Cancel");
  1100. case 4:
  1101. {
  1102. mysql_format(mysql, global, sizeof(global),"DELETE FROM `maps` WHERE `mapid` = '%d' LIMIT 1",banrowid[playerid]);
  1103. mysql_tquery(mysql, global,"","");
  1104. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You removed map id %i",banrowid[playerid]);
  1105. SendClientMessage(playerid,-1,global);
  1106. }
  1107. }
  1108. }
  1109. }
  1110. if(dialogid == DIALOG_MAPLIST3)
  1111. {
  1112. if(response)
  1113. {
  1114. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Interior`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1115. mysql_tquery(mysql, global, "QueryComplete", "");
  1116. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's interior to %i",banrowid[playerid],strval(inputtext));
  1117. SendClientMessage(playerid,-1,global);
  1118. }
  1119. }
  1120. if(dialogid == DIALOG_MAPLIST4)
  1121. {
  1122. if(response)
  1123. {
  1124. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Time`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1125. mysql_tquery(mysql, global, "QueryComplete", "");
  1126. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's world time to %i",banrowid[playerid],strval(inputtext));
  1127. SendClientMessage(playerid,-1,global);
  1128. }
  1129. }
  1130. if(dialogid == DIALOG_MAPLIST5)
  1131. {
  1132. if(response)
  1133. {
  1134. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Weather`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1135. mysql_tquery(mysql, global, "QueryComplete", "");
  1136. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's weather to %i",banrowid[playerid],strval(inputtext));
  1137. SendClientMessage(playerid,-1,global);
  1138. }
  1139. }
  1140. if(dialogid == DIALOG_MAPLIST6)
  1141. {
  1142. if(response)
  1143. {
  1144. mysql_format(mysql, global, sizeof(global), "UPDATE `maps` SET `Duration`= %d WHERE `mapid`='%d'",strval(inputtext),banrowid[playerid]);
  1145. mysql_tquery(mysql, global, "QueryComplete", "");
  1146. format(global,sizeof(global),"{FF0000}[MAP]: {FFFFFF}You have set map id %i's duration to %i",banrowid[playerid],strval(inputtext));
  1147. SendClientMessage(playerid,-1,global);
  1148. }
  1149. }
  1150. return 1;
  1151. }
  1152.  
  1153. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  1154. {
  1155. return 1;
  1156. }
  1157. public OnTextMenuResponse(playerid,menuid,listitem)
  1158. {
  1159. if(menuid == MENU_SHOP)
  1160. {
  1161. if(GetPlayerTeam(playerid) == ZOMBIE) return ERROR(playerid,"Nice try.");
  1162. switch(listitem)
  1163. {
  1164. case 1:
  1165. {
  1166. if(GetCash(playerid) < 2500) return ERROR(playerid,"You need $2500 in order to buy this weapon.");
  1167. GiveCash(playerid,-2500);
  1168. GivePlayerWeapon(playerid,25,100);
  1169. }
  1170. case 2:
  1171. {
  1172. if(GetCash(playerid) < 4300) return ERROR(playerid,"You need $4300 in order to buy this weapon.");
  1173. GiveCash(playerid,-4300);
  1174. GivePlayerWeapon(playerid,30,100);
  1175. }
  1176. case 3:
  1177. {
  1178. if(GetCash(playerid) < 5000) return ERROR(playerid,"You need $5000 in order to buy this weapon.");
  1179. GiveCash(playerid,-5000);
  1180. GivePlayerWeapon(playerid,31,100);
  1181. }
  1182. case 4:
  1183. {
  1184. if(GetCash(playerid) < 3400) return ERROR(playerid,"You need $3400 in order to buy this weapon.");
  1185. GiveCash(playerid,-3400);
  1186. GivePlayerWeapon(playerid,29,100);
  1187. }
  1188. case 5:
  1189. {
  1190. if(GetCash(playerid) < 1500) return ERROR(playerid,"You need $1500 in order to buy this weapon.");
  1191. GiveCash(playerid,-1500);
  1192. GivePlayerWeapon(playerid,24,100);
  1193. }
  1194. case 6:
  1195. {
  1196. if(GetCash(playerid) < 6500) return ERROR(playerid,"You need $6500 in order to buy this weapon.");
  1197. GiveCash(playerid,-6500);
  1198. GivePlayerWeapon(playerid,27,150);
  1199. }
  1200. case 7:
  1201. {
  1202. if(GetCash(playerid) < 7500) return ERROR(playerid,"You need $7500 in order to buy this weapon.");
  1203. GiveCash(playerid,-7500);
  1204. GivePlayerWeapon(playerid,34,150);
  1205. }
  1206. case 8:
  1207. {
  1208. if(GetCash(playerid) < 3000) return ERROR(playerid,"You need $3000 in order to buy an armor.");
  1209. GiveCash(playerid,-3000);
  1210. SetPlayerArmour(playerid,100);
  1211. }
  1212. }
  1213. }
  1214. return 1;
  1215. }
  1216. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  1217. {
  1218. if(!success)
  1219. {
  1220. ERROR(playerid,"Invalid command! please take a look into /cmds");
  1221. }
  1222. return 1;
  1223. }
  1224. GetTeamName(playerid)
  1225. {
  1226. new tname[10];
  1227. if(GetPlayerTeam(playerid) == HUMAN)
  1228. {
  1229. tname = "~b~Human";
  1230. }
  1231. else
  1232. {
  1233. tname = "~r~Zombie";
  1234. }
  1235. return tname;
  1236. }
  1237. GetPlayerAdmin(playerid)
  1238. {
  1239. new rankname[25];
  1240. switch(PlayerInfo[playerid][Level])
  1241. {
  1242. case 1: rankname = "~b~Moderator";
  1243. case 2: rankname = "~g~Administrator";
  1244. case 3: rankname = "~p~Manager";
  1245. case 4: rankname = "~r~Owner";
  1246. }
  1247. return rankname;
  1248. }
  1249. GetIp(playerid)
  1250. {
  1251. new ip[16];
  1252. GetPlayerIp(playerid, ip, 16);
  1253. return ip;
  1254. }
  1255. BanPlayer(admin[],id,resa[])
  1256. {
  1257. SetPlayerPos(id,197.6661,173.8179,1003.0234);
  1258. SetPlayerInterior(id,3);
  1259. SetCameraBehindPlayer(id);
  1260. new Year, Month, Day,tima[80],Query[600],Hour, Minute, Second;
  1261. getdate(Year, Month, Day);
  1262. gettime(Hour, Minute, Second);
  1263. format(tima,sizeof(tima),"%d/%d/%d | %02d:%02d",Day,Month,Year,Hour,Minute);
  1264. 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);
  1265. mysql_tquery(mysql, Query,"","");
  1266. KickEx(id);
  1267. return 1;
  1268. }
  1269. /*Commands*/
  1270. CMD:commands(playerid) return cmd_cmds(playerid);
  1271. CMD:cmds(playerid)
  1272. {
  1273. new Cmds[350];
  1274. strcat(Cmds," ~y~/stats~n~");
  1275. strcat(Cmds," ~y~/credits~n~");
  1276. strcat(Cmds," ~y~/savestats~n~");
  1277. strcat(Cmds," ~y~/kill~n~");
  1278. strcat(Cmds," ~y~/shop~n~");
  1279. strcat(Cmds," ~y~/admins~n~");
  1280. strcat(Cmds," ~y~/rules~n~");
  1281. strcat(Cmds," ~y~/report");
  1282. TextMenuShowForPlayer(playerid,MENU_OTHER,"Commands",Cmds);
  1283. return 1;
  1284. }
  1285. CMD:rules(playerid)
  1286. {
  1287. new Rules[350];
  1288. strcat(Rules," ~y~1-~w~ Respect admins/players~n~");
  1289. strcat(Rules," ~y~2-~w~ Cheating/Hacking will lead to a ban~n~");
  1290. strcat(Rules," ~y~3-~w~ You may not ask for score/cash/level~n~");
  1291. strcat(Rules," ~y~4-~w~ You may not abuse bugs, report them~n~");
  1292. strcat(Rules," ~y~5-~w~ C-Bug isn't allowed here~n~");
  1293. strcat(Rules," ~y~6-~w~ You may not disturb admins~n~");
  1294. strcat(Rules," ~y~7-~w~ Banned? Do not evade, appeal at forums~n~");
  1295. strcat(Rules," ~y~8-~w~ Racism isn't tolerated in here");
  1296. TextMenuShowForPlayer(playerid,MENU_OTHER,"Rules",Rules);
  1297. return 1;
  1298. }
  1299. CMD:credits(playerid)
  1300. {
  1301. new Credits[29];
  1302. strcat(Credits,"~y~ Developer: ~w~Jelly23");
  1303. TextMenuShowForPlayer(playerid,MENU_OTHER,"Credits",Credits);
  1304. return 1;
  1305. }
  1306. CMD:stats(playerid)
  1307. {
  1308. new Stats[210];
  1309. 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",
  1310. GetName(playerid),PlayerInfo[playerid][Level],GetCash(playerid),PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths],GetTeamName(playerid));
  1311. TextMenuShowForPlayer(playerid,MENU_OTHER,"Statistics",Stats);
  1312. return 1;
  1313. }
  1314. CMD:savestats(playerid)
  1315. {
  1316. SavePlayer(playerid);
  1317. SendClientMessage(playerid,-1,"{FFFF00}[STATS]: {FFFFFF}Stats saved!");
  1318. return 1;
  1319. }
  1320. CMD:kill(playerid) return SetPlayerHealth(playerid,0),SendClientMessage(playerid,-1,"{FF0000}[SUICIDE]: {FFFFFF}You killed yourself");
  1321. CMD:shop(playerid)
  1322. {
  1323. if(GetPlayerTeam(playerid) != HUMAN) return ERROR(playerid,"You must be a human to use this command.");
  1324. if(Duration < 200) return ERROR(playerid,"You can't buy anymore weapons once the first zombie appears. Wait for the next round.");
  1325. new Shop[350];
  1326. strcat(Shop," ~r~1-~w~ Shotgun (~g~$2500~w~)~n~");
  1327. strcat(Shop," ~r~2-~w~ AK47 (~g~$4300~w~)~n~");
  1328. strcat(Shop," ~r~3-~w~ M4 (~g~$5000~w~)~n~");
  1329. strcat(Shop," ~r~4-~w~ MP5 (~g~$3400~w~)~n~");
  1330. strcat(Shop," ~r~5-~w~ Desert Eagle (~g~$1500~w~)~n~");
  1331. strcat(Shop," ~r~6-~w~ Combat Shotgun (~g~$6500~w~)~n~");
  1332. strcat(Shop," ~r~7-~w~ Sniper Rifle (~g~$7500~w~)~n~");
  1333. strcat(Shop," ~r~8-~w~ Armor (~g~$3000~w~)");
  1334. TextMenuShowForPlayer(playerid,MENU_SHOP,"Shop",Shop,8);
  1335. return 1;
  1336. }
  1337. CMD:admins(playerid)
  1338. {
  1339. new admins[1500],count;
  1340. foreach(new i: Player)
  1341. {
  1342. if(PlayerInfo[i][Level] >= 1)
  1343. {
  1344. count++;
  1345. format(admins,sizeof(admins)," ~y~%s-_%s(%d)_-_%s~n~",admins,GetName(i),i,GetPlayerAdmin(i));
  1346. }
  1347. }
  1348. if(count == 0)
  1349. {
  1350. admins = " No ~r~admins ~w~online right now";
  1351. }
  1352. TextMenuShowForPlayer(playerid,MENU_OTHER,"Admins",admins);
  1353. return 1;
  1354. }
  1355. CMD:acmds(playerid)
  1356. {
  1357. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1358. new ACMDS[350];
  1359. strcat(ACMDS," ~b~Level 1:~w~ /warn /kick /spec /specoff /spawn /slap~n~");
  1360. strcat(ACMDS," ~g~Level 2:~w~ /banlist /ban /unban /weaps /disarm /giveallcash~n~");
  1361. strcat(ACMDS," ~p~Level 3:~w~ /offban /setlevel /setkills /setdeaths /resetcash~n~");
  1362. strcat(ACMDS," ~r~Level 4:~w~ /setweather /settime /gmx /setcash~n~");
  1363. TextMenuShowForPlayer(playerid,MENU_OTHER,"Admin Commands",ACMDS);
  1364. return 1;
  1365. }
  1366. CMD:warn(playerid, params[])
  1367. {
  1368. new id, reason[24];
  1369. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1370. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /warn [playerid] [reason]");
  1371. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1372. format(global, sizeof(global), "{FF0000}[WARN]: %s has been warned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1373. SendClientMessageToAll(-1, global);
  1374. return 1;
  1375. }
  1376. CMD:kick(playerid, params[])
  1377. {
  1378. new id, reason[24];
  1379. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1380. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid] [reason]");
  1381. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1382. format(global, sizeof(global), "{FF0000}[KICK]: %s has been kicked by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1383. SendClientMessageToAll(-1, global);
  1384. KickEx(id);
  1385. return 1;
  1386. }
  1387. CMD:spec(playerid, params[])
  1388. {
  1389. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1390. new id;
  1391. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spec [playerid]");
  1392. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1393. if(IsPlayerInAnyVehicle(id))
  1394. {
  1395. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1396. TogglePlayerSpectating(playerid, 1);
  1397. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
  1398. }
  1399. else
  1400. {
  1401. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1402. TogglePlayerSpectating(playerid, 1);
  1403. PlayerSpectatePlayer(playerid, id);
  1404. }
  1405. return 1;
  1406. }
  1407.  
  1408. CMD:specoff(playerid)
  1409. {
  1410. if(PlayerInfo[playerid][Level] == 0) return 0;
  1411. TogglePlayerSpectating(playerid, 0);
  1412. SpawnPlayer(playerid);
  1413. return 1;
  1414. }
  1415. CMD:spawn(playerid, params[])
  1416. {
  1417. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1418. new id;
  1419. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spawn [playerid]");
  1420. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1421. SpawnPlayer(id);
  1422. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have spawned '%s'",GetName(id));
  1423. SendClientMessage(playerid,-1,global);
  1424. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have been spawned by '%s'",GetName(playerid));
  1425. SendClientMessage(id,-1,global);
  1426. return 1;
  1427. }
  1428. CMD:slap(playerid, params[])
  1429. {
  1430. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1431. new Float:xPos[3],id;
  1432. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /slap [playerid]");
  1433. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1434. GetPlayerPos(id,xPos[0],xPos[1],xPos[2]);
  1435. SetPlayerPos(id,xPos[0],xPos[1],xPos[2]+7);
  1436. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have slapped '%s'",GetName(id));
  1437. SendClientMessage(playerid,-1,global);
  1438. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have been slapped by '%s'",GetName(playerid));
  1439. SendClientMessage(id,-1,global);
  1440. return 1;
  1441. }
  1442. CMD:ban(playerid,params[])
  1443. {
  1444. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1445. new id, reason[50];
  1446. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid,-1,"USAGE: /ban [playerid] [reason]");
  1447. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1448. if(PlayerInfo[playerid][Level] <= PlayerInfo[id][Level]) return ERROR(playerid,"You can't ban that player.");
  1449. format(global, sizeof(global), "{FF0000}[BAN]: {FFFFFF}%s has been banned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1450. SendClientMessageToAll(-1, global);
  1451. BanPlayer(GetName(playerid),id,reason);
  1452. return 1;
  1453. }
  1454. CMD:unban(playerid, params[])
  1455. {
  1456. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1457. new target[50];
  1458. if(sscanf(params,"s[50]", target)) return SendClientMessage(playerid,-1,"USAGE: /unban [name]");
  1459. mysql_format(mysql, global, sizeof(global),"SELECT * FROM `bans` WHERE `b_name` ='%e' OR `b_ip` ='%e' LIMIT 1",target,target);
  1460. mysql_tquery(mysql, global,"OnAccountUnban","ds",playerid,target);
  1461. return 1;
  1462. }
  1463. forward OnAccountUnban(playerid,tar[]);
  1464. public OnAccountUnban(playerid,tar[])
  1465. {
  1466. new rows, fields;
  1467. cache_get_data(rows, fields, mysql);
  1468. if(rows)
  1469. {
  1470. new Query[200];
  1471. mysql_format(mysql, Query, sizeof(Query),"DELETE FROM `bans` WHERE `b_name` = '%e' or `b_ip` ='%e' LIMIT 1",tar,tar);
  1472. mysql_tquery(mysql, Query,"","");
  1473. format(global, sizeof(global),"{00FF00}[UNBAN]: {FFFFFF}You have successfully unbanned account/ip %s",tar);
  1474. SendClientMessage(playerid,-1,global);
  1475. }
  1476. else
  1477. {
  1478. ERROR(playerid,"No such ban found.");
  1479. }
  1480. return 1;
  1481. }
  1482. CMD:weaps(playerid, params[])
  1483. {
  1484. if(PlayerInfo[playerid][Level] >= 2)
  1485. {
  1486. new count = 0;
  1487. new ammo, weaponid, weapon[30], string26[150], id;
  1488. if(!sscanf(params, "u", id))
  1489. {
  1490. for (new c = 0; c < 13; c++)
  1491. {
  1492. GetPlayerWeaponData(id, c, weaponid, ammo);
  1493. if (weaponid != 0 && ammo != 0)
  1494. {
  1495. count++;
  1496. }
  1497. }
  1498. SendClientMessage(playerid, -1, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
  1499. if(count > 0)
  1500. {
  1501. for (new c = 0; c < 13; c++)
  1502. {
  1503. GetPlayerWeaponData(id, c, weaponid, ammo);
  1504. if (weaponid != 0 && ammo != 0)
  1505. {
  1506. GetWeaponName(weaponid, weapon, 24);
  1507. format(string26, sizeof(string26), "{00FF00}Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
  1508. SendClientMessage(playerid, -1, string26);
  1509. }
  1510. }
  1511. }
  1512. else
  1513. {
  1514. ERROR(playerid,"This player has no weapons.");
  1515. }
  1516. return 1;
  1517. }
  1518. else return SendClientMessage(playerid, -1, "USAGE: /weaps [id]");
  1519. }
  1520. else return ERROR(playerid,"You must be an administrator to use this command.");
  1521. }
  1522. CMD:disarm(playerid, params[])
  1523. {
  1524. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1525. new id;
  1526. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /disarm [playerid]");
  1527. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1528. ResetPlayerWeapons(id);
  1529. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have disarmed '%s'",GetName(id));
  1530. SendClientMessage(playerid,-1,global);
  1531. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have been disarmed by '%s'",GetName(playerid));
  1532. SendClientMessage(id,-1,global);
  1533. return 1;
  1534. }
  1535. CMD:giveallcash(playerid, params[])
  1536. {
  1537. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1538. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /giveallcash [cash]");
  1539. new strt[200];
  1540. foreach(new i: Player)
  1541. {
  1542. GiveCash(i,strval(params));
  1543. }
  1544. format(strt,127," %s ~w~%s has given everyone ~g~$%i",GetPlayerAdmin(playerid),GetName(playerid),strval(params));
  1545. TextMenuShowForPlayer(playerid,MENU_OTHER,"Cash",strt);
  1546. return 1;
  1547. }
  1548. CMD:offban(playerid, params[])
  1549. {
  1550. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1551. new target[24],reason[50];
  1552. if(sscanf(params, "s[24]s[50]", target, reason)) return SendClientMessage(playerid,-1,"USAGE: /offban [account] [reason]");
  1553. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1",target);
  1554. mysql_tquery(mysql,global,"OnAccountBan","dss",playerid,target,reason);
  1555. return 1;
  1556. }
  1557. forward OnAccountBan(playerid,target[],offreason[]);
  1558. public OnAccountBan(playerid,target[],offreason[])
  1559. {
  1560. new zcount=0,raw = cache_get_row_count(),ggwzd[20],Query[200];
  1561. for(new i=0; i < raw; i ++ )
  1562. {
  1563. zcount++;
  1564. cache_get_field_content(i,"IP",ggwzd,mysql,20);
  1565. }
  1566. if(zcount == 0) return ERROR(playerid,"No such account found.");
  1567. new tima[80];
  1568. new Year, Month, Day;
  1569. getdate(Year, Month, Day);
  1570. new Hour, Minute, Second;
  1571. gettime(Hour, Minute, Second);
  1572. format(tima,sizeof(tima),"%d/%d/%d | %d:%d",Day,Month,Year,Hour,Minute);
  1573. 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);
  1574. mysql_tquery(mysql, Query,"","");
  1575. format(global,sizeof(global),"{FFFF00}[OFF-BAN]: {FFFFFF}You have offline-banned %s [Reason: %s]", target, offreason );
  1576. SendClientMessage(playerid,-1,global);
  1577. return 1;
  1578. }
  1579. CMD:setlevel(playerid, params[])
  1580. {
  1581. new id,level;
  1582. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1583. if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "USAGE: /setlevel [playerid] [level]");
  1584. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1585. if(level < 0) return ERROR(playerid,"Levels are between 0-4 only");
  1586. if(level > 4) return ERROR(playerid,"Levels are between 0-4 only");
  1587. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}Your level was set to '%i' by %s.", level,GetName(playerid));
  1588. SendClientMessage(id,-1, global);
  1589. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}You have given level '%i' to %s.", level,GetName(id));
  1590. SendClientMessage(playerid,-1, global);
  1591. PlayerInfo[id][Level] = level;
  1592. return 1;
  1593. }
  1594. CMD:setkills(playerid, params[])
  1595. {
  1596. new id,kill;
  1597. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1598. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setkills [playerid] [kills]");
  1599. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1600. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}Your kills were set to '%i' by %s.", kill,GetName(playerid));
  1601. SendClientMessage(id,-1, global);
  1602. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}You have set %s's kills to %i.",GetName(id),kill);
  1603. SendClientMessage(playerid,-1, global);
  1604. PlayerInfo[id][Kills] = kill;
  1605. return 1;
  1606. }
  1607. CMD:setdeaths(playerid, params[])
  1608. {
  1609. new id,kill;
  1610. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1611. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setdeaths [playerid] [deaths]");
  1612. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1613. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your deaths were set to '%i' by %s.", kill,GetName(playerid));
  1614. SendClientMessage(id,-1, global);
  1615. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's deaths to %i.",GetName(id),kill);
  1616. SendClientMessage(playerid,-1, global);
  1617. PlayerInfo[id][Deaths] = kill;
  1618. return 1;
  1619. }
  1620. CMD:resetcash(playerid, params[])
  1621. {
  1622. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1623. new id;
  1624. if(sscanf(params, "ud", id)) return SendClientMessage(playerid, -1, "USAGE: /resetcash [playerid]");
  1625. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1626. ResetCash(id);
  1627. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}You have reset %s's cash",GetName(id));
  1628. SendClientMessage(playerid,-1,global);
  1629. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}Your cash was reset by '%s'",GetName(playerid));
  1630. SendClientMessage(id,-1,global);
  1631. return 1;
  1632. }
  1633. CMD:settime(playerid,params[])
  1634. {
  1635. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1636. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /settime [time]");
  1637. SetWorldTime(strval(params));
  1638. return 1;
  1639. }
  1640. CMD:setweather(playerid,params[])
  1641. {
  1642. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1643. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /setweather [time]");
  1644. SetWeather(strval(params));
  1645. return 1;
  1646. }
  1647. CMD:setcash(playerid, params[])
  1648. {
  1649. new id,kill;
  1650. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  1651. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setcash [playerid] [cash]");
  1652. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1653. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your cash was set to $%i by %s.", kill,GetName(playerid));
  1654. SendClientMessage(id,-1, global);
  1655. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's cash to $%i.",GetName(id),kill);
  1656. SendClientMessage(playerid,-1, global);
  1657. ResetCash(id);
  1658. GiveCash(id,kill);
  1659. return 1;
  1660. }
  1661. CMD:report(playerid, params[])
  1662. {
  1663. new id,reason[50];
  1664. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /report [playerid] [reason]");
  1665. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1666. format(global, sizeof(global), "{FF0000}[REPORT]: {FFFFFF}%s has reported %s(%i). [Reason: %s]", GetName(playerid),GetName(id),id,reason);
  1667. foreach(new I: Player)
  1668. {
  1669. if(PlayerInfo[I][Level] >= 1) SendClientMessage(I,-1, global);
  1670. }
  1671. SendClientMessage(playerid,-1,"{FFFF00}[REPORT]: {FFFFFF}Your report was sent to the staff, wait for a response!");
  1672. return 1;
  1673. }
  1674. CMD:banlist(playerid)
  1675. {
  1676. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be a moderator to use this command.");
  1677. ShowPlayerDialog(playerid, DIALOG_BANLIST, DIALOG_STYLE_LIST, "{FFFF00}Ban List","Last Bans\nFind Bans\nEdit Bans\nAdd Ban", "Close","");
  1678. return 1;
  1679. }
  1680. CMD:mapeditor(playerid)
  1681. {
  1682. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  1683. ShowPlayerDialog(playerid,DIALOG_MAPLIST, DIALOG_STYLE_INPUT, "Map Editor", "Enter a mapid below:", "Edit", "Cancel");
  1684. return 1;
  1685. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement