Advertisement
Guest User

Untitled

a guest
Feb 10th, 2011
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.34 KB | None | 0 0
  1. /*
  2. Jack's Admin script
  3. */
  4.  
  5. //Includes
  6. #include <a_samp>
  7. #include <dini>
  8. #include <dudb>
  9. #include <streamer>
  10.  
  11. //Forwards
  12. forward SaveIn(filename[],text[]);
  13. forward ServerBot();
  14. forward God(playerid);
  15. forward SetPlayerPosTravelTimer(playerid, Float:x, Float:y, Float:z);
  16. forward unfreezetimer(playerid);
  17.  
  18. //Defines
  19. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  20. #undef MAX_PLAYERS
  21. #define MAX_PLAYERS 50
  22. #define Loop(%1,%2) \
  23. for(new %1=0; %1<%2; %1++)
  24. #define GREY 0xAFAFAFAA
  25. #define GREEN 0x33AA33AA
  26. #define YELLOW 0xFFFF00AA
  27. #define LIGHTBLUE 0x33CCFFAA
  28. #define ORANGE 0xFF9900AA
  29. #define WHITE 0xFFFFFFAA
  30. native WP_Hash(buffer[], len, const str[]);
  31.  
  32.  
  33. #define TRAVEL_TIME 20 // seconds
  34.  
  35. public unfreezetimer(playerid)
  36. {
  37. TogglePlayerControllable(playerid, 1);
  38. GameTextForPlayer(playerid, "Objects loaded", 1000, 6);
  39. return true;
  40. }
  41.  
  42. public SetPlayerPosTravelTimer(playerid, Float:x, Float:y, Float:z)
  43. {
  44. TogglePlayerControllable(playerid, false);
  45. GameTextForPlayer(playerid, "Loading ~r~objects", 3000, 6);
  46. SetTimerEx("unfreezetimer",3000,0,"d",playerid);
  47. SetPlayerInterior(playerid, 0);
  48. SetPlayerPos(playerid, x, y, z);
  49. GameTextForPlayer(playerid, "Traveling over", 3000, 1);
  50. return true;
  51. }
  52.  
  53. stock SetPlayerPosTravel(playerid, Float:x, Float:y, Float:z)
  54. {
  55. TogglePlayerControllable(playerid, false);
  56. GameTextForPlayer(playerid, "Traveling", 3000, 1);
  57. SetPlayerInterior(playerid, 1);
  58. SetPlayerPos(playerid, 1.7313,27.1232,1199.5938);
  59. SetTimerEx("SetPlayerPosTravelTimer", TRAVEL_TIME*1000, 0, "ifff", playerid, x, y, z);
  60. return 1;
  61. }
  62.  
  63. public OnFilterScriptInit()
  64. {
  65. SetTimer("ServerBot", 15*1000, 1);
  66. CreateDynamicObject(9931, 369.681640625, 2339.9267578125, 1904.9915771484, 0, 0, 0);
  67. CreateDynamicObject(9931, 369.7060546875, 2308.431640625, 1904.9920654297, 0, 0, 0);
  68. CreateDynamicObject(6959, 380.3193359375, 2327.4951171875, 1888.5981445313, 0, 0, 0);
  69. CreateDynamicObject(6959, 378.1806640625, 2333.775390625, 1897.5466308594, 296.47705078125, 0, 0);
  70. CreateDynamicObject(6959, 378.0703125, 2314.8393554688, 1897.5084228516, 63.740020751953, 0, 0);
  71. CreateDynamicObject(6959, 363.0498046875, 2326.4736328125, 1902.5007324219, 0, 270.18676757813, 0);
  72. CreateDynamicObject(9931, 409.28952026367, 2325.361328125, 1903.9514160156, 0, 0, 182.88500976563);
  73. CreateDynamicObject(6959, 349.35693359375, 2328.1083984375, 1889.6359863281, 0, 0, 0);
  74. CreateDynamicObject(14394, 370.83624267578, 2320.2700195313, 1888.7946777344, 0, 0, 179.43994140625);
  75. CreateDynamicObject(14394, 370.92697143555, 2328.2631835938, 1888.7946777344, 0, 0, 179.43969726563);
  76. CreateDynamicObject(3657, 373.32641601563, 2328.6003417969, 1889.0850830078, 0, 0, 269.96997070313);
  77. CreateDynamicObject(3657, 375.27359008789, 2328.5871582031, 1889.0850830078, 0, 0, 269.96704101563);
  78. CreateDynamicObject(3657, 377.10638427734, 2328.55078125, 1889.0850830078, 0, 0, 269.96704101563);
  79. CreateDynamicObject(3657, 379.10192871094, 2328.5529785156, 1889.0850830078, 0, 0, 269.96704101563);
  80. CreateDynamicObject(3657, 381.24136352539, 2328.552734375, 1889.0850830078, 0, 0, 269.96704101563);
  81. CreateDynamicObject(3657, 383.30206298828, 2328.5458984375, 1889.0850830078, 0, 0, 269.96704101563);
  82. CreateDynamicObject(3657, 373.34204101563, 2320.0771484375, 1889.0850830078, 0, 0, 269.96154785156);
  83. CreateDynamicObject(3657, 375.22265625, 2320.0434570313, 1889.0850830078, 0, 0, 269.96154785156);
  84. CreateDynamicObject(3657, 377.12313842773, 2320.0419921875, 1889.0850830078, 0, 0, 269.96154785156);
  85. CreateDynamicObject(3657, 379.14074707031, 2320.0615234375, 1889.0850830078, 0, 0, 269.96154785156);
  86. CreateDynamicObject(3657, 381.31060791016, 2320.05859375, 1889.0850830078, 0, 0, 269.96154785156);
  87. CreateDynamicObject(3657, 383.32202148438, 2320.029296875, 1889.0850830078, 0, 0, 269.96154785156);
  88. CreateDynamicObject(8131, 359.04635620117, 2324.1560058594, 1890.9467773438, 334.75, 0, 270.44000244141);
  89. CreateDynamicObject(14705, 367.74389648438, 2322.6496582031, 1890.7045898438, 0, 0, 0);
  90. CreateDynamicObject(2208, 367.70974731445, 2325.3110351563, 1889.6047363281, 0, 0, 269.95498657227);
  91. CreateDynamicObject(2868, 367.74664306641, 2325.3173828125, 1890.4699707031, 0, 0, 0);
  92. CreateDynamicObject(2894, 367.60568237305, 2324.0219726563, 1890.4699707031, 0, 0, 269.39514160156);
  93. CreateDynamicObject(2869, 368.66561889648, 2331.6791992188, 1889.6047363281, 0, 0, 320.9599609375);
  94. CreateDynamicObject(2869, 365.07345581055, 2331.7023925781, 1889.6047363281, 0, 0, 322.20654296875);
  95. CreateDynamicObject(2869, 365.21087646484, 2316.7504882813, 1889.6047363281, 0, 0, 320.95458984375);
  96. CreateDynamicObject(2869, 368.77743530273, 2316.8020019531, 1889.6047363281, 0, 0, 320.95458984375);
  97. CreateDynamicObject(2896, 367.05938720703, 2318.2067871094, 1890.2440185547, 0, 0, 0);
  98. CreateDynamicObject(1664, 367.76473999023, 2323.0808105469, 1890.63671875, 0, 0, 0);
  99. CreateDynamicObject(1667, 367.53042602539, 2323.2294921875, 1890.55859375, 0, 0, 0);
  100. CreateDynamicObject(2869, 375.79760742188, 2316.7111816406, 1888.5668945313, 0, 0, 320.95458984375);
  101. CreateDynamicObject(2869, 382.89117431641, 2316.5712890625, 1888.5668945313, 0, 0, 320.95458984375);
  102. CreateDynamicObject(2869, 375.69821166992, 2331.720703125, 1888.5668945313, 0, 0, 320.95458984375);
  103. CreateDynamicObject(2869, 382.8698425293, 2331.7434082031, 1888.5668945313, 0, 0, 320.95458984375);
  104. CreateDynamicObject(6959, 375.40222167969, 2326.0595703125, 1915.3721923828, 0, 0, 0);
  105. CreateDynamicObject(6959, 387.21533203125, 2323.322265625, 1924.6811523438, 0, 269.68676757813, 2.75);
  106. CreateDynamicObject(3462, 364.39996337891, 2328.1259765625, 1890.3927001953, 0, 0, 179.65002441406);
  107. CreateDynamicObject(3462, 364.37484741211, 2320.1662597656, 1890.3676757813, 0, 0, 180.3984375);
  108. return 1;
  109. }
  110.  
  111. new MAX_PING = 1000;
  112.  
  113. enum gPInfo
  114. {
  115. Logged,
  116. Regged,
  117. Level,
  118. Muted,
  119. Kills,
  120. Deaths,
  121. AdminDuty,
  122. Spectate,
  123. Jail
  124. };
  125. new PInfo[MAX_PLAYERS][gPInfo];
  126.  
  127. new Text3D:label[MAX_PLAYERS];
  128.  
  129. new Godtimer;
  130.  
  131. stock IsValidSkin(SkinID)
  132. {
  133. if((SkinID == 0)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299)) return true;
  134. else return false;
  135. }
  136.  
  137. public SaveIn(filename[],text[])
  138. {
  139. new File:Lfile;
  140. new filepath[256];
  141. new string[256];
  142. new year,month,day;
  143. new hour,minute,second;
  144.  
  145. getdate(year,month,day);
  146. gettime(hour,minute,second);
  147. format(filepath,sizeof(filepath),"Jadmin/logs/%s.txt",filename);
  148. Lfile = fopen(filepath,io_append);
  149. format(string,sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n",day,month,year,hour,minute,second,text);
  150. fwrite(Lfile,string);
  151. fclose(Lfile);
  152. return 1;
  153. }
  154.  
  155. stock IsNumeric(string[])
  156. {
  157. for (new i = 0, j = strlen(string);
  158. i < j; i++)
  159. {
  160. if (string[i] > '9' || string[i] < '0')
  161. return 0;
  162. }
  163. return 1;
  164. }
  165.  
  166. stock SetAllHealth(Float:health)
  167. {
  168. Loop(i, MAX_PLAYERS)
  169. {
  170. if(IsPlayerConnected(i))
  171. {
  172. SetPlayerHealth(i, health);
  173. }
  174. }
  175. return 1;
  176. }
  177.  
  178. stock SetAllArmor(Float:armor)
  179. {
  180. Loop(i, MAX_PLAYERS)
  181. {
  182. if(IsPlayerConnected(i))
  183. {
  184. SetPlayerArmour(i, armor);
  185. }
  186. }
  187. return 1;
  188. }
  189.  
  190. stock GivePlayerScore(playerid, score)
  191. {
  192. SetPlayerScore(playerid, GetPlayerScore(playerid) + (score) );
  193. return 1;
  194. }
  195.  
  196.  
  197. stock AdminCommand(playerid,command[])
  198. {
  199.  
  200. new string[128];
  201. GetPlayerName(playerid,string,128);
  202. format(string,sizeof(string),"[ADMIN] %s || Level: %d || Command used: %s", string, PInfo[playerid][Level], command);
  203. Loop(i, MAX_PLAYERS)
  204. {
  205. if(PInfo[i][Level] >= 1)
  206. {
  207. SendClientMessage(i, YELLOW, string);
  208. }
  209. }
  210. }
  211.  
  212. stock PlayerName(playerid)
  213. {
  214. new name[MAX_PLAYER_NAME];
  215. GetPlayerName(playerid, name, sizeof(name));
  216. return name;
  217. }
  218.  
  219. //Other
  220. #pragma unused ret_memcpy
  221.  
  222.  
  223. new VehicleName[][] =
  224. {
  225. "Landstalker",
  226. "Bravura",
  227. "Buffalo",
  228. "Linerunner",
  229. "Pereniel",
  230. "Sentinel",
  231. "Dumper",
  232. "Firetruck",
  233. "Trashmaster",
  234. "Stretch",
  235. "Manana",
  236. "Infernus",
  237. "Voodoo",
  238. "Pony",
  239. "Mule",
  240. "Cheetah",
  241. "Ambulance",
  242. "Leviathan",
  243. "Moonbeam",
  244. "Esperanto",
  245. "Taxi",
  246. "Washington",
  247. "Bobcat",
  248. "Mr Whoopee",
  249. "BF Injection",
  250. "Hunter",
  251. "Premier",
  252. "Enforcer",
  253. "Securicar",
  254. "Banshee",
  255. "Predator",
  256. "Bus",
  257. "Rhino",
  258. "Barracks",
  259. "Hotknife",
  260. "Trailer",
  261. "Previon",
  262. "Coach",
  263. "Cabbie",
  264. "Stallion",
  265. "Rumpo",
  266. "RC Bandit",
  267. "Romero",
  268. "Packer",
  269. "Monster Truck",
  270. "Admiral",
  271. "Squalo",
  272. "Seasparrow",
  273. "Pizzaboy",
  274. "Tram",
  275. "Trailer",
  276. "Turismo",
  277. "Speeder",
  278. "Reefer",
  279. "Tropic",
  280. "Flatbed",
  281. "Yankee",
  282. "Caddy",
  283. "Solair",
  284. "Berkley's RC Van",
  285. "Skimmer",
  286. "PCJ-600",
  287. "Faggio",
  288. "Freeway",
  289. "RC Baron",
  290. "RC Raider",
  291. "Glendale",
  292. "Oceanic",
  293. "Sanchez",
  294. "Sparrow",
  295. "Patriot",
  296. "Quad",
  297. "Coastguard",
  298. "Dinghy",
  299. "Hermes",
  300. "Sabre",
  301. "Rustler",
  302. "ZR-350",
  303. "Walton",
  304. "Regina",
  305. "Comet",
  306. "BMX",
  307. "Burrito",
  308. "Camper",
  309. "Marquis",
  310. "Baggage",
  311. "Dozer",
  312. "Maverick",
  313. "News Chopper",
  314. "Rancher",
  315. "FBI Rancher",
  316. "Virgo",
  317. "Greenwood",
  318. "Jetmax",
  319. "Hotring",
  320. "Sandking",
  321. "Blista Compact",
  322. "Police Maverick",
  323. "Boxville",
  324. "Benson",
  325. "Mesa",
  326. "RC Goblin",
  327. "Hotring Racer",
  328. "Hotring Racer",
  329. "Bloodring Banger",
  330. "Rancher",
  331. "Super GT",
  332. "Elegant",
  333. "Journey",
  334. "Bike",
  335. "Mountain Bike",
  336. "Beagle",
  337. "Cropdust",
  338. "Stunt",
  339. "Tanker",
  340. "RoadTrain",
  341. "Nebula",
  342. "Majestic",
  343. "Buccaneer",
  344. "Shamal",
  345. "Hydra",
  346. "FCR-900",
  347. "NRG-500",
  348. "HPV1000",
  349. "Cement Truck",
  350. "Tow Truck",
  351. "Fortune",
  352. "Cadrona",
  353. "FBI Truck",
  354. "Willard",
  355. "Forklift",
  356. "Tractor",
  357. "Combine",
  358. "Feltzer",
  359. "Remington",
  360. "Slamvan",
  361. "Blade",
  362. "Freight",
  363. "Streak",
  364. "Vortex",
  365. "Vincent",
  366. "Bullet",
  367. "Clover",
  368. "Sadler",
  369. "Firetruck",
  370. "Hustler",
  371. "Intruder",
  372. "Primo",
  373. "Cargobob",
  374. "Tampa",
  375. "Sunrise",
  376. "Merit",
  377. "Utility",
  378. "Nevada",
  379. "Yosemite",
  380. "Windsor",
  381. "Monster Truck",
  382. "Monster Truck",
  383. "Uranus",
  384. "Jester",
  385. "Sultan",
  386. "Stratum",
  387. "Elegy",
  388. "Raindance",
  389. "RC Tiger",
  390. "Flash",
  391. "Tahoma",
  392. "Savanna",
  393. "Bandito",
  394. "Freight",
  395. "Trailer",
  396. "Kart",
  397. "Mower",
  398. "Duneride",
  399. "Sweeper",
  400. "Broadway",
  401. "Tornado",
  402. "AT-400",
  403. "DFT-30",
  404. "Huntley",
  405. "Stafford",
  406. "BF-400",
  407. "Newsvan",
  408. "Tug",
  409. "Trailer",
  410. "Emperor",
  411. "Wayfarer",
  412. "Euros",
  413. "Hotdog",
  414. "Club",
  415. "Trailer",
  416. "Trailer",
  417. "Andromada",
  418. "Dodo",
  419. "RC Cam",
  420. "Launch",
  421. "Police Car (LSPD)",
  422. "Police Car (SFPD)",
  423. "Police Car (LVPD)",
  424. "Police Ranger",
  425. "Picador",
  426. "S.W.A.T. Van",
  427. "Alpha",
  428. "Phoenix",
  429. "Glendale",
  430. "Sadler",
  431. "Luggage Trailer",
  432. "Luggage Trailer",
  433. "Stair Trailer",
  434. "Boxville",
  435. "Farm Plow",
  436. "Utility Trailer"
  437. };
  438.  
  439. #pragma unused VehicleName
  440.  
  441. public OnPlayerConnect(playerid)
  442. {
  443. PInfo[playerid][Logged] = 0;
  444. PInfo[playerid][Regged] = 0;
  445. PInfo[playerid][Level] = 0;
  446. PInfo[playerid][Jail] = 0;
  447. PInfo[playerid][Kills] = 0;
  448. PInfo[playerid][Deaths] = 0;
  449. PInfo[playerid][AdminDuty] = 0;
  450. PInfo[playerid][Muted] = 0;
  451. new n[MAX_PLAYER_NAME], file[256];
  452. GetPlayerName(playerid,n,sizeof(n));
  453. format(file,sizeof(file),"Jadmin/Users/%s.txt",n);
  454. if(dini_Exists(file))
  455. {
  456.  
  457. SendClientMessage(playerid,LIGHTBLUE,"You are registered, Please /login!");
  458. PInfo[playerid][Regged] = 1;
  459. PInfo[playerid][Logged] = 0;
  460. return 1;
  461. }
  462. if(!dini_Exists(file))
  463. {
  464. SendClientMessage(playerid,LIGHTBLUE,"You are not registered, Please /register!");
  465. PInfo[playerid][Regged] = 0;
  466. PInfo[playerid][Logged] = 0;
  467. return 1;
  468. }
  469. return 1;
  470. }
  471.  
  472. public OnPlayerDisconnect(playerid, reason)
  473. {
  474. new n[MAX_PLAYER_NAME], file[256];
  475. GetPlayerName(playerid,n,sizeof(n));
  476. format(file,sizeof(file),"Jadmin/Users/%s.txt",n);
  477. PInfo[playerid][Logged] = 0;
  478. switch(reason)
  479. {
  480. case 0:
  481. {
  482. if(dini_Exists(file))
  483. {
  484. dini_IntSet(file,"Score",GetPlayerScore(playerid));
  485. dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
  486. dini_IntSet(file,"Logged",0);
  487. dini_IntSet(file,"Deaths",PInfo[playerid][Deaths]);
  488. dini_IntSet(file,"Kills",PInfo[playerid][Kills]);
  489. return 1;
  490. }
  491. }
  492. case 1:
  493. {
  494. if(dini_Exists(file))
  495. {
  496. dini_IntSet(file,"Score",GetPlayerScore(playerid));
  497. dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
  498. dini_IntSet(file,"Logged",0);
  499. dini_IntSet(file,"Deaths",PInfo[playerid][Deaths]);
  500. dini_IntSet(file,"Kills",PInfo[playerid][Kills]);
  501. return 1;
  502. }
  503. }
  504. case 2:
  505. {
  506. if(dini_Exists(file))
  507. {
  508. dini_IntSet(file,"Score",GetPlayerScore(playerid));
  509. dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
  510. dini_IntSet(file,"Logged",0);
  511. dini_IntSet(file,"Deaths",PInfo[playerid][Deaths]);
  512. dini_IntSet(file,"Kills",PInfo[playerid][Kills]);
  513. return 1;
  514. }
  515. }
  516. }
  517. Delete3DTextLabel(label[playerid]);
  518. return 1;
  519. }
  520.  
  521. public OnPlayerCommandText(playerid, cmdtext[])
  522. {
  523. /*new cmd[256], idx;
  524. cmd = strtok(cmdtext, idx);*/
  525. dcmd(register,8,cmdtext);
  526. dcmd(login,5,cmdtext);
  527. dcmd(setlevel,8,cmdtext);
  528. dcmd(kick,4,cmdtext);
  529. dcmd(ban,3,cmdtext);
  530. dcmd(mute,4,cmdtext);
  531. dcmd(looptest,8,cmdtext);
  532. dcmd(healall,7,cmdtext);
  533. dcmd(armorall,8,cmdtext);
  534. dcmd(setscore,8,cmdtext);
  535. dcmd(setmoney,8,cmdtext);
  536. dcmd(richestplayers,14,cmdtext);
  537. dcmd(stats,5,cmdtext);
  538. dcmd(admins,6,cmdtext);
  539. dcmd(get,3,cmdtext);
  540. dcmd(goto,4,cmdtext);
  541. dcmd(explode,7,cmdtext);
  542. dcmd(slap,4,cmdtext);
  543. dcmd(givescore,9,cmdtext);
  544. dcmd(setskin,7,cmdtext);
  545. dcmd(report,6,cmdtext);
  546. dcmd(adminduty,9,cmdtext);
  547. dcmd(kill,4,cmdtext);
  548. dcmd(asay,4,cmdtext);
  549. dcmd(spec,4,cmdtext);
  550. dcmd(endspec,7,cmdtext);
  551. dcmd(adminarea,9,cmdtext);
  552. dcmd(jail,4,cmdtext);
  553. dcmd(unjail,6,cmdtext);
  554. dcmd(spawn,5,cmdtext);
  555. dcmd(gmx,3,cmdtext);
  556. dcmd(ahelp,5,cmdtext);
  557. return 0;
  558. }
  559.  
  560. dcmd_register(playerid,params[])
  561. {
  562. new file[256],n[MAX_PLAYER_NAME];
  563. GetPlayerName(playerid,n,MAX_PLAYER_NAME);
  564. format(file,sizeof(file),"Jadmin/Users/%s.txt",n);
  565. if(dini_Exists(file))
  566. return SendClientMessage(playerid,YELLOW,"You are already registered!");
  567. if(PInfo[playerid][Regged] == 1)
  568. return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
  569. if(PInfo[playerid][Logged] == 1)
  570. return SendClientMessage(playerid,ORANGE,"You are already registered, and logged in!");
  571. if(strlen(params))
  572. {
  573. if(!dini_Exists(file))
  574. {
  575. dini_Create(file);
  576. dini_Set(file,"Password",params);
  577. dini_IntSet(file,"Regged",1);
  578. dini_IntSet(file,"Logged",0);
  579. dini_IntSet(file,"Level",0);
  580. dini_IntSet(file,"Score",GetPlayerScore(playerid));
  581. dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
  582. dini_IntSet(file,"Deaths",0);
  583. dini_IntSet(file,"Kills",0);
  584. SendClientMessage(playerid,ORANGE,"You have just registered, Please use /login [password] to login!");
  585. PInfo[playerid][Regged] = 1;
  586. return 1;
  587. }
  588. }
  589. else
  590. {
  591. SendClientMessage(playerid,GREY,"USAGE: /register <Password>");
  592. return 1;
  593. }
  594. return 1;
  595. }
  596.  
  597. dcmd_login(playerid,params[])
  598. {
  599. new file[256],n[MAX_PLAYER_NAME];
  600. GetPlayerName(playerid,n,MAX_PLAYER_NAME);
  601. format(file,sizeof(file),"Jadmin/Users/%s.txt",n);
  602. if(!dini_Exists(file))
  603. return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
  604. if(PInfo[playerid][Logged] == 1)
  605. return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
  606. if(PInfo[playerid][Regged] == 0)
  607. return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
  608. if(strlen(params))
  609. {
  610. new pass[256];
  611. pass = dini_Get(file,"Password");
  612. if(dini_Exists(file))
  613. {
  614. if(strcmp(params,pass,false) != 0)
  615. {
  616. SendClientMessage(playerid,YELLOW,"Wrong Password!");
  617. }
  618. else
  619. {
  620. new buf[145];
  621. WP_Hash(buf, sizeof(buf), params);
  622. dini_IntSet(file,"Logged",1);
  623. PInfo[playerid][Logged] = 1;
  624. PInfo[playerid][Level] = dini_Int(file,"Level");
  625. SetPlayerScore(playerid, dini_Int(file,"Score"));
  626. SetPlayerMoney(playerid, dini_Int(file,"Cash"));
  627. PInfo[playerid][Deaths] = dini_Int(file,"Deaths");
  628. PInfo[playerid][Kills] = dini_Int(file,"Kills");
  629.  
  630. if(PInfo[playerid][Level] == 0)
  631. return SendClientMessage(playerid,YELLOW,"You have now logged in! Status: Normal player");
  632. if(PInfo[playerid][Level] == 1)
  633. return SendClientMessage(playerid,YELLOW,"Welcome Back Moderator");
  634. if(PInfo[playerid][Level] == 2)
  635. return SendClientMessage(playerid,YELLOW,"Welcome Back Moderator");
  636. if(PInfo[playerid][Level] == 3)
  637. return SendClientMessage(playerid,YELLOW,"Welcome Back Admin)");
  638. if(PInfo[playerid][Level] == 4)
  639. return SendClientMessage(playerid,YELLOW,"Welcome Back Admin");
  640. if(PInfo[playerid][Level] == 5)
  641. return SendClientMessage(playerid,YELLOW,"Welcome Back Head Admin");
  642. if(PInfo[playerid][Level] > 5)
  643. return SendClientMessage(playerid,YELLOW,"Welcome Back Owner)");
  644. return 1;
  645. }
  646. }
  647. }
  648. else
  649. {
  650. SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
  651. return 1;
  652. }
  653. return 1;
  654. }
  655.  
  656. dcmd_setlevel(playerid,params[])
  657. {
  658. new level,id,file[256],n[MAX_PLAYER_NAME];//creating the new variabls
  659. new tmp[256], tmp2[256], Index,str[51];// creating the new variables
  660. tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);// setting them to strtok so we can use them as parameters of our command
  661. GetPlayerName(id,n,MAX_PLAYER_NAME);//getting the players name
  662. format(file,sizeof(file),"Jadmin/Users/%s.txt",n);//formatting the file
  663. if(PInfo[playerid][Level] < 5)
  664. return SendClientMessage(playerid,GREY,"You need to be RCON admin or level 5+!");//if the player is not rcon admin
  665. if(!strlen(params))
  666. return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");// if the string is empty
  667. if(!IsPlayerConnected(id))
  668. return SendClientMessage(playerid,GREY,"You have entered an incorrect ID"); //if the id is not connected
  669. PInfo[id][Level] = level;//sets the level of the player
  670. dini_IntSet(file,"Level",level);//saves the new level to the file
  671. format(str,sizeof(str),"You have set %s's level to %d",n,level);//creates the string
  672. SendClientMessage(playerid,LIGHTBLUE,str);
  673. return 1;
  674. }
  675.  
  676. dcmd_kick(playerid,params[])
  677. {
  678. new id,n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
  679. new tmp[256], tmp2[256], Index, str[128];
  680. tmp = strtok(params,Index);
  681. tmp2 = strtok(params,Index);
  682. id = strval(tmp);
  683. GetPlayerName(id,on,sizeof(on));
  684. GetPlayerName(playerid,n,sizeof(n));
  685. if(PInfo[playerid][Level] < 1)
  686. return SendClientMessage(playerid,ORANGE,"You need to be level 1 to use this command!");
  687. if(!strlen(tmp))
  688. return SendClientMessage(playerid,GREY,"USAGE: /kick <ID> <Reason> ");
  689. if(!strlen(tmp2))
  690. {
  691. format(str,sizeof(str)," Staff Member %s has kicked %s Reason: Not given",n,on);
  692. return SendClientMessageToAll(YELLOW, str);
  693. }
  694. if(!IsPlayerConnected(id))
  695. return SendClientMessage(playerid,GREY,"Invalid ID");
  696. format(str,sizeof(str)," Staff Member %s has kicked %s Reason: %s",n,on,params[strlen(tmp)+1]);
  697. SendClientMessageToAll(YELLOW, str);
  698. Kick(id);
  699. return 1;
  700. }
  701. dcmd_ban(playerid,params[])
  702. {
  703. new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
  704. new tmp[256], tmp2[256], Index, str[128];
  705. tmp = strtok(params,Index), id = strval(tmp);
  706. tmp2 = strtok(params, Index);
  707. GetPlayerName(id,on,sizeof(on));
  708. GetPlayerName(playerid,n,sizeof(n));
  709. if(PInfo[playerid][Level] < 3)
  710. return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
  711. if(!strlen(params))
  712. return SendClientMessage(playerid,GREY,"USAGE: /ban <ID> <Reason> ");
  713. if(!IsPlayerConnected(id))
  714. return SendClientMessage(playerid,GREY,"Invalid ID");
  715. if(!strlen(tmp2))
  716. {
  717. format(str,sizeof(str)," Staff Member %s has banned %s || Reason: Not given",n,on);
  718. return SendClientMessageToAll(YELLOW, str);
  719. }
  720. format(str,sizeof(str)," Staff Member %s has banned %s || Reason: %s",n,on,params[strlen(tmp)+1]);
  721. SendClientMessageToAll(ORANGE,str);
  722. BanEx(id, params[strlen(tmp)+1]);
  723. return 1;
  724. }
  725.  
  726. dcmd_mute(playerid, params[])
  727. {
  728. if(PInfo[playerid][Level] < 2)
  729. return SendClientMessage(playerid, ORANGE, "You need to be level 2+ to use this command");
  730. new tmp[256], Index, id;
  731. tmp = strtok(params, Index);
  732. id = strval(tmp);
  733. if(!strlen(tmp))
  734. return SendClientMessage(playerid,GREY,"USAGE: /mute <ID>");
  735. if(!IsPlayerConnected(id))
  736. return SendClientMessage(playerid,GREY,"Invalid ID");
  737. new string[65];
  738. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  739. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  740. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  741. if(PInfo[id][Muted] == 1)
  742. {
  743. PInfo[id][Muted] = 0;
  744. format(string, 65, "You have unmuted %s", pName);
  745. SendClientMessage(playerid, YELLOW, string);
  746. format(string, 65, "You have been unmuted by administrator %s", aName);
  747. SendClientMessage(id, YELLOW, string);
  748. }
  749. else
  750. {
  751. PInfo[id][Muted] = 1;
  752. format(string, 65, "You have muted %s", pName);
  753. SendClientMessage(playerid, YELLOW, string);
  754. format(string, 65, "You have been muted by administrator %s", aName);
  755. SendClientMessage(id, YELLOW, string);
  756. }
  757. return 1;
  758. }
  759.  
  760. dcmd_looptest(playerid, params[])
  761. {
  762. #pragma unused params
  763. if(IsPlayerAdmin(playerid))
  764. {
  765. Loop(i, MAX_PLAYERS) // Loop through your defined MAX_PLAYERS ^^
  766. {
  767. if(IsPlayerConnected(i))
  768. {
  769. SendClientMessage(i, YELLOW, "Looping");
  770. return Kick(i);
  771. }
  772. }
  773. }
  774. else return 0;
  775. return 1;
  776. }
  777.  
  778. dcmd_healall(playerid, params[])
  779. {
  780. #pragma unused params
  781. if(PInfo[playerid][Level] < 4)
  782. return SendClientMessage(playerid, ORANGE, "You need to be level 4+ to use this command");
  783. new string[71];
  784. GetPlayerName(playerid, string, 128);
  785. format(string, 71, "%s has restored everyone's health!", string);
  786. SendClientMessageToAll(YELLOW, string);
  787. SetAllHealth(100.0);
  788. AdminCommand(playerid, "HEALALL");
  789. return 1;
  790. }
  791.  
  792. dcmd_armorall(playerid, params[])
  793. {
  794. #pragma unused params
  795. if(PInfo[playerid][Level] < 4)
  796. return SendClientMessage(playerid, ORANGE, "You need to be level 4+ to use this command");
  797. new string[71];
  798. GetPlayerName(playerid, string, 128);
  799. format(string, 71, "Administrator %s has restored everyone's armor!", string);
  800. SendClientMessageToAll(YELLOW, string);
  801. SetAllArmor(100.0);
  802. AdminCommand(playerid, "ARMORALL");
  803. return 1;
  804. }
  805.  
  806. dcmd_setscore(playerid, params[])
  807. {
  808. if(PInfo[playerid][Level] < 4)
  809. return SendClientMessage(playerid, ORANGE, "You need to be level 4+ to use this command");
  810. new tmp[256], tmp2[256];
  811. new Index;
  812. tmp = strtok(params, Index);
  813. tmp2 = strtok(params, Index);
  814. new id = strval(tmp);
  815. new score = strval(tmp2);
  816. if(!strlen(tmp))
  817. return SendClientMessage(playerid,GREY,"USAGE: /setscore <ID> <Score> ");
  818. if(!strlen(tmp2))
  819. return SendClientMessage(playerid,GREY,"USAGE: /setscore <ID> <Score> ");
  820. if(!IsPlayerConnected(id))
  821. return SendClientMessage(playerid,GREY,"Invalid ID");
  822. new string[72];
  823. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  824. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  825. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  826. format(string, 72, "Administrator %s has set your score to %d", aName, score);
  827. SendClientMessage(id, YELLOW, string);
  828. format(string, 72, "You have set %s's score to %d", pName, score);
  829. SendClientMessage(playerid, YELLOW, string);
  830. SetPlayerScore(id, score);
  831. AdminCommand(playerid, "SETSCORE");
  832. return 1;
  833. }
  834.  
  835. dcmd_setmoney(playerid, params[])
  836. {
  837. if(PInfo[playerid][Level] < 2)
  838. return SendClientMessage(playerid, ORANGE, "You need to be level 2+ to use this command");
  839. new tmp[256], tmp2[256];
  840. new Index;
  841. tmp = strtok(params, Index);
  842. tmp2 = strtok(params, Index);
  843. new id = strval(tmp);
  844. new money = strval(tmp2);
  845. if(!strlen(tmp))
  846. return SendClientMessage(playerid,GREY,"USAGE: /setmoney <ID> <Money> ");
  847. if(!strlen(tmp2))
  848. return SendClientMessage(playerid,GREY,"USAGE: /setmoney <ID> <Money> ");
  849. if(!IsPlayerConnected(id))
  850. return SendClientMessage(playerid,GREY,"Invalid ID");
  851. new string[72];
  852. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  853. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  854. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  855. format(string, 72, "Administrator %s has set your money to $%d", aName, money);
  856. SendClientMessage(id, YELLOW, string);
  857. format(string, 72, "You have set %s's money to $%d", pName, money);
  858. SendClientMessage(playerid, YELLOW, string);
  859. SetPlayerMoney(id, money);
  860. AdminCommand(playerid, "SETMONEY");
  861. return 1;
  862. }
  863.  
  864. dcmd_richestplayers(playerid, params[])
  865. {
  866. #pragma unused params
  867. new string[71], Slot1 = -1, Slot2 = -1, Slot3 = -1, Slot4 = -1;
  868. new HighestCash = -9999;
  869. SendClientMessage(playerid,GREEN,"Richest Players Online:");
  870.  
  871. for(new x=0; x<MAX_PLAYERS; x++)
  872. if(IsPlayerConnected(x))
  873. if(GetPlayerMoney(x) >= HighestCash)
  874. {
  875. HighestCash = GetPlayerMoney(x);
  876. Slot1 = x;
  877. }
  878. HighestCash = -9999;
  879. for(new x=0; x<MAX_PLAYERS; x++)
  880. if(IsPlayerConnected(x) && x != Slot1)
  881. if(GetPlayerMoney(x) >= HighestCash)
  882. {
  883. HighestCash = GetPlayerMoney(x);
  884. Slot2 = x;
  885. }
  886. HighestCash = -9999;
  887. for(new x=0; x<MAX_PLAYERS; x++)
  888. if(IsPlayerConnected(x) && x != Slot1 && x != Slot2)
  889. if(GetPlayerMoney(x) >= HighestCash)
  890. {
  891. HighestCash = GetPlayerMoney(x);
  892. Slot3 = x;
  893. }
  894. HighestCash = -9999;
  895. for(new x=0; x<MAX_PLAYERS; x++)
  896. if(IsPlayerConnected(x) && x != Slot1 && x != Slot2 && x != Slot3)
  897. if(GetPlayerMoney(x) >= HighestCash)
  898. {
  899. HighestCash = GetPlayerMoney(x);
  900. Slot4 = x;
  901. }
  902. format(string, sizeof(string), "(%d) Player %s - $%d", Slot1,PlayerName(Slot1),GetPlayerMoney(Slot1));
  903. SendClientMessage(playerid,YELLOW,string);
  904. if(Slot2 != -1){
  905. format(string, sizeof(string), "(%d) Player %s - $%d", Slot2,PlayerName(Slot2),GetPlayerMoney(Slot2));
  906. SendClientMessage(playerid,YELLOW,string);
  907. }
  908. if(Slot3 != -1){
  909. format(string, sizeof(string), "(%d) Player %s - $%d", Slot3,PlayerName(Slot3),GetPlayerMoney(Slot3));
  910. SendClientMessage(playerid,YELLOW,string);
  911. }
  912. if(Slot4 != -1){
  913. format(string, sizeof(string), "(%d) Player %s - $%d", Slot4,PlayerName(Slot4),GetPlayerMoney(Slot4));
  914. SendClientMessage(playerid,YELLOW,string);
  915. }
  916. return 1;
  917. }
  918.  
  919. dcmd_stats(playerid, params[])
  920. {
  921. #pragma unused params
  922. if(PInfo[playerid][Logged] == 0)
  923. return SendClientMessage(playerid, ORANGE, "You need to be logged in to use this command");
  924. new string[128];
  925. new pName[MAX_PLAYER_NAME];
  926. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  927. format(string, 128, "[STATS]: Name: %s, Score: %d, Money: $%d, Current level: %d, Kills: %d, Deaths: %d", pName, GetPlayerScore(playerid), GetPlayerMoney(playerid), PInfo[playerid][Level], PInfo[playerid][Kills], PInfo[playerid][Deaths]);
  928. SendClientMessage(playerid, GREEN, string);
  929. return 1;
  930. }
  931. dcmd_admins(playerid, params[])
  932. {
  933. new string[34];
  934. #pragma unused params
  935. SendClientMessage(playerid, GREEN, "Admins Online");
  936. Loop(i, MAX_PLAYERS)
  937. {
  938. new aName[MAX_PLAYER_NAME];
  939. if(PInfo[i][Level] >= 1)
  940. {
  941. GetPlayerName(i, aName, MAX_PLAYER_NAME);
  942. format(string, 128, "Level %d: %s", PInfo[i][Level], aName);
  943. }
  944. }
  945. SendClientMessage(playerid, YELLOW, string);
  946. return 1;
  947. }
  948.  
  949. dcmd_get(playerid, params[])
  950. {
  951. if(PInfo[playerid][Level] < 1)
  952. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  953. new tmp[256];
  954. new Index;
  955. tmp = strtok(params, Index);
  956. new id = strval(tmp);
  957. if(!strlen(tmp))
  958. return SendClientMessage(playerid,GREY,"USAGE: /get <ID>");
  959. if(!IsPlayerConnected(id))
  960. return SendClientMessage(playerid,GREY,"Invalid ID");
  961. new string[78];
  962. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  963. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  964. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  965. format(string, 78, "You have teleported %s to your position", pName);
  966. SendClientMessage(playerid, YELLOW, string);
  967. format(string, 78, "You have been teleported to administrator %s's position", aName);
  968. SendClientMessage(id, YELLOW, string);
  969. new Float:x, Float:y, Float:z;
  970. GetPlayerPos(playerid, x, y, z);
  971. SetPlayerPos(id, x, y, z);
  972. AdminCommand(playerid, "GET");
  973. return 1;
  974. }
  975.  
  976. dcmd_goto(playerid, params[])
  977. {
  978. if(PInfo[playerid][Level] < 1)
  979. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  980. new tmp[256];
  981. new Index;
  982. tmp = strtok(params, Index);
  983. new id = strval(tmp);
  984. if(!strlen(tmp))
  985. return SendClientMessage(playerid,GREY,"USAGE: /goto <ID>");
  986. if(!IsPlayerConnected(id))
  987. return SendClientMessage(playerid,GREY,"Invalid ID");
  988. new string[128];
  989. new pName[MAX_PLAYER_NAME];
  990. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  991. format(string, 128, "You have teleported to %s's position", pName);
  992. SendClientMessage(playerid, YELLOW, string);
  993. new Float:x, Float:y, Float:z;
  994. GetPlayerPos(id, x, y, z);
  995. SetPlayerPos(playerid, x, y, z);
  996. AdminCommand(playerid, "GOTO");
  997. return 1;
  998. }
  999.  
  1000. dcmd_explode(playerid, params[])
  1001. {
  1002. if(PInfo[playerid][Level] < 2)
  1003. return SendClientMessage(playerid, ORANGE, "You need to be level 2+ to use this command");
  1004. new tmp[256];
  1005. new Index;
  1006. tmp = strtok(params, Index);
  1007. new id = strval(tmp);
  1008. if(!strlen(tmp))
  1009. return SendClientMessage(playerid,GREY,"USAGE: /explode <ID>");
  1010. if(!IsPlayerConnected(id))
  1011. return SendClientMessage(playerid,GREY,"Invalid ID");
  1012. new string[128];
  1013. new pName[MAX_PLAYER_NAME];
  1014. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1015. format(string, 128, "You have exploded %s", pName);
  1016. SendClientMessage(playerid, YELLOW, string);
  1017. new Float:x, Float:y, Float:z;
  1018. GetPlayerPos(id, x, y, z);
  1019. CreateExplosion(x, y, z, 7, 10.0);
  1020. AdminCommand(playerid, "EXPLODE");
  1021. return 1;
  1022. }
  1023.  
  1024. dcmd_slap(playerid, params[])
  1025. {
  1026. if(PInfo[playerid][Level] < 1)
  1027. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this command");
  1028. new tmp[256];
  1029. new Index;
  1030. tmp = strtok(params, Index);
  1031. new id = strval(tmp);
  1032. if(!strlen(tmp))
  1033. return SendClientMessage(playerid,GREY,"USAGE: /slap <ID>");
  1034. if(!IsPlayerConnected(id))
  1035. return SendClientMessage(playerid,GREY,"Invalid ID");
  1036. new string[128];
  1037. new pName[MAX_PLAYER_NAME];
  1038. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1039. format(string, 128, "You have slapped %s", pName);
  1040. SendClientMessage(playerid, YELLOW, string);
  1041. new Float:x, Float:y, Float:z;
  1042. GetPlayerPos(id, x, y, z);
  1043. SetPlayerPos(id, x, y, z+5);
  1044. PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
  1045. PlayerPlaySound(id,1190,0.0,0.0,0.0);
  1046. new Float:health;
  1047. GetPlayerHealth(id, health);
  1048. SetPlayerHealth(id, health-15);
  1049. AdminCommand(playerid, "SLAP");
  1050. return 1;
  1051. }
  1052.  
  1053. dcmd_givescore(playerid, params[])
  1054. {
  1055.  
  1056. if(PInfo[playerid][Level] < 4)
  1057. return SendClientMessage(playerid, ORANGE, "You need to be level 4+ to use this command");
  1058. new tmp[256];
  1059. new tmp2[256];
  1060. new Index;
  1061. tmp = strtok(params, Index);
  1062. tmp2 = strtok(params, Index);
  1063. new id = strval(tmp);
  1064. new score = strval(tmp2);
  1065. if(!strlen(tmp))
  1066. return SendClientMessage(playerid,GREY,"USAGE: /givescore <ID> <Score>");
  1067. if(!strlen(tmp2))
  1068. return SendClientMessage(playerid,GREY,"USAGE: /givescore <ID> <Score>");
  1069. if(!IsPlayerConnected(id))
  1070. return SendClientMessage(playerid,GREY,"Invalid ID");
  1071. new string[128];
  1072. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  1073. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  1074. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1075. format(string, 128, "You gave %s score to %s", params[strlen(tmp)+1], pName);
  1076. SendClientMessage(playerid, YELLOW, string);
  1077. format(string, 128, "Administrator %s gave you %s score", aName, params[strlen(tmp)+1]);
  1078. SendClientMessage(id, YELLOW, string);
  1079. GivePlayerScore(id, score);
  1080. AdminCommand(playerid, "GIVESCORE");
  1081. return 1;
  1082. }
  1083.  
  1084. dcmd_setskin(playerid,params[])
  1085. {
  1086. if(PInfo[playerid][Level] < 4)
  1087. return SendClientMessage(playerid, ORANGE, "You need to be level 4+ to use this command");
  1088. new Index;
  1089. new tmp[256];
  1090. new tmp2[256];
  1091. tmp = strtok(params,Index);
  1092. tmp2 = strtok(params,Index);
  1093. if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2))
  1094. return SendClientMessage(playerid, GREY, "USAGE: /setskin <ID> <Skin>");
  1095. new id = strval(tmp);
  1096. new skin = strval(tmp2);
  1097. new string[128];
  1098. if(!IsValidSkin(skin))
  1099. return SendClientMessage(playerid, GREY, "ERROR: Invaild Skin ID!");
  1100. if(!IsPlayerConnected(id) && id == INVALID_PLAYER_ID)
  1101. return SendClientMessage(playerid,GREY,"Invalid ID");
  1102. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  1103. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1104. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  1105. format(string, 128, "You have set %s's skin to %d", pName, skin);
  1106. SendClientMessage(playerid, YELLOW, string);
  1107. format(string,sizeof(string),"Administrator %s has set your skin to %d", aName, skin);
  1108. SendClientMessage(id, YELLOW, string);
  1109. SetPlayerSkin(id, skin);
  1110. AdminCommand(playerid, "SETSKIN");
  1111. return 1;
  1112. }
  1113.  
  1114. dcmd_report(playerid, params[])
  1115. {
  1116. new tmp[256];
  1117. new tmp2[256];
  1118. new Index;
  1119. tmp = strtok(params, Index);
  1120. tmp2 = strtok(params, Index);
  1121. new id = strval(tmp);
  1122. if(!strlen(tmp) || !strlen(tmp2))
  1123. return SendClientMessage(playerid, GREY, "USAGE: /report <ID> <Reason>");
  1124. if(!IsPlayerConnected(id))
  1125. return SendClientMessage(playerid,GREY,"Invalid ID");
  1126. new string[128];
  1127. new pName[MAX_PLAYER_NAME];
  1128. new reported[MAX_PLAYER_NAME];
  1129. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  1130. GetPlayerName(id, reported, MAX_PLAYER_NAME);
  1131. SendClientMessage(playerid, YELLOW, "Your report has been sent to all online administrators");
  1132. Loop(i, MAX_PLAYERS)
  1133. {
  1134. if(PInfo[i][Level] >= 1)
  1135. {
  1136. format(string, 128, "[REPORT] %s reported %s || Reason: %s", pName, reported, params[strlen(tmp)+1]);
  1137. SendClientMessage(i, YELLOW, string);
  1138. }
  1139. }
  1140. return 1;
  1141. }
  1142.  
  1143. dcmd_adminduty(playerid, params[])
  1144. {
  1145. #pragma unused params
  1146. if(PInfo[playerid][Level] < 1)
  1147. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  1148. if(PInfo[playerid][AdminDuty] == 0)
  1149. {
  1150. PInfo[playerid][AdminDuty] = 1;
  1151. new string[128];
  1152. GetPlayerName(playerid, string, 128);
  1153. format(string, 128, "Administrator %s is now On-Duty!", string);
  1154. SendClientMessageToAll(LIGHTBLUE, string);
  1155. Godtimer = SetTimerEx("God", 5000, 1, "i", playerid);
  1156. SetPlayerHealth(playerid, 10000);
  1157. GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
  1158. label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
  1159. Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
  1160. SetPlayerSkin(playerid, 217);
  1161. SetPlayerColor(playerid, LIGHTBLUE);
  1162. }
  1163. else
  1164. {
  1165. PInfo[playerid][AdminDuty] = 0;
  1166. new string[128];
  1167. GetPlayerName(playerid, string, 128);
  1168. format(string, 128, "Administrator %s is now Off-Duty!", string);
  1169. SendClientMessageToAll(LIGHTBLUE, string);
  1170. KillTimer(Godtimer);
  1171. SetPlayerHealth(playerid, 100.0);
  1172. Delete3DTextLabel(label[playerid]);
  1173. SetPlayerHealth(playerid, 0.0);
  1174. }
  1175. return 1;
  1176. }
  1177.  
  1178. dcmd_kill(playerid, params[])
  1179. {
  1180. #pragma unused params
  1181. SetPlayerHealth(playerid, 0.0);
  1182. return 1;
  1183. }
  1184.  
  1185. dcmd_asay(playerid, params[])
  1186. {
  1187. if(PInfo[playerid][Level] < 1)
  1188. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  1189. new string[128];
  1190. GetPlayerName(playerid, string, 128);
  1191. format(string, 128, "Admin %s: %s", string, params);
  1192. SendClientMessageToAll(LIGHTBLUE, string);
  1193. return 1;
  1194. }
  1195.  
  1196. dcmd_spec(playerid, params[])
  1197. {
  1198. if(PInfo[playerid][Level] < 1)
  1199. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  1200. new tmp[256];
  1201. new Index;
  1202. tmp = strtok(params, Index);
  1203. new id = strval(tmp);
  1204. if(!strlen(tmp))
  1205. return SendClientMessage(playerid, GREY, "USAGE: /spec <ID>");
  1206. if(!IsPlayerConnected(id))
  1207. return SendClientMessage(playerid,GREY,"Invalid ID");
  1208. new string[128];
  1209. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  1210. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  1211. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1212. format(string, 128, "Now spectating %s", pName);
  1213. SendClientMessage(playerid, YELLOW, string);
  1214. format(string, 128, "Administrator %s is now spectating [%d]%s", aName, id, pName);
  1215. TogglePlayerSpectating(playerid, 1);
  1216. PlayerSpectatePlayer(playerid, id);
  1217. PInfo[playerid][Spectate] = 1;
  1218. Loop(i, MAX_PLAYERS)
  1219. {
  1220. if(PInfo[i][Level] >= 1)
  1221. {
  1222. SendClientMessage(i, YELLOW, string);
  1223. }
  1224. }
  1225. return 1;
  1226. }
  1227.  
  1228. dcmd_endspec(playerid, params[])
  1229. {
  1230. #pragma unused params
  1231. if(PInfo[playerid][Level] < 1)
  1232. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  1233. if(PInfo[playerid][Spectate] == 0)
  1234. return SendClientMessage(playerid, ORANGE, "You aren't spectating");
  1235. TogglePlayerSpectating(playerid, 0);
  1236. PInfo[playerid][Spectate] = 0;
  1237. SendClientMessage(playerid, YELLOW, "Spectate ended");
  1238. return 1;
  1239. }
  1240.  
  1241. dcmd_adminarea(playerid, params[])
  1242. {
  1243. #pragma unused params
  1244. if(PInfo[playerid][Level] < 1)
  1245. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this");
  1246. SetPlayerInterior(playerid, 10);
  1247. Streamer_UpdateEx(playerid, 382.7088,2324.7488,1889.5669);
  1248. SetPlayerPos(playerid, 382.7088,2324.7488,1889.5669);
  1249. TogglePlayerControllable(playerid,0);
  1250. GameTextForPlayer(playerid,"Welcome Admin",5000,3);
  1251. TogglePlayerControllable(playerid,0);
  1252. return 1;
  1253. }
  1254.  
  1255. dcmd_jail(playerid, params[])
  1256. {
  1257. if(PInfo[playerid][Level] < 2)
  1258. return SendClientMessage(playerid, ORANGE, "You need to be level 2+ to use this command");
  1259. new tmp[256], tmp2[256];
  1260. new Index;
  1261. tmp = strtok(params, Index);
  1262. tmp2 = strtok(params, Index);
  1263. new id = strval(tmp);
  1264. if(!strlen(tmp) || !strlen(tmp2))
  1265. return SendClientMessage(playerid, GREY, "USAGE: /jail <ID> <Reason>");
  1266. if(!IsPlayerConnected(id))
  1267. return SendClientMessage(playerid,GREY,"Invalid ID");
  1268. new string[128];
  1269. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  1270. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  1271. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1272. if(PInfo[id][Jail] == 0)
  1273. {
  1274. SetPlayerPos(id,197.6661,173.8179,1003.0234);
  1275. SetPlayerInterior(id,3);
  1276. format(string, 128, "You have jailed %s", pName);
  1277. SendClientMessage(playerid, YELLOW, string);
  1278. format(string, 128, "Administrator %s has jailed you || Reason: %s", aName, params[strlen(tmp)+1]);
  1279. SendClientMessage(id, YELLOW, string);
  1280. PInfo[id][Jail] = 1;
  1281. format(string, 128, "%s has been jailed by administrator %s || Reason: %s", pName, aName, params[strlen(tmp)+1]);
  1282. SendClientMessageToAll(YELLOW, string);
  1283. }
  1284. else
  1285. return SendClientMessage(playerid, ORANGE, "Player is in jail already");
  1286. AdminCommand(playerid, "JAIL");
  1287. return 1;
  1288. }
  1289.  
  1290. dcmd_unjail(playerid, params[])
  1291. {
  1292. if(PInfo[playerid][Level] < 2)
  1293. return SendClientMessage(playerid, ORANGE, "You need to be level 2+ to use this command");
  1294. new tmp[256];
  1295. new Index;
  1296. tmp = strtok(params, Index);
  1297. new id = strval(tmp);
  1298. new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  1299. GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
  1300. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1301. new string[128];
  1302. if(PInfo[id][Jail] == 1)
  1303. {
  1304. SpawnPlayer(id);
  1305. format(string, 128, "You have unjailed %s", pName);
  1306. SendClientMessage(playerid, YELLOW, string);
  1307. format(string, 128, "Administrator %s has unjailed you", aName);
  1308. SendClientMessage(id, YELLOW, string);
  1309. format(string, 128, "%s has been unjailed by administrator %s", pName, aName);
  1310. SendClientMessageToAll(YELLOW, string);
  1311. AdminCommand(playerid, "UNJAIL");
  1312. }
  1313. else if(PInfo[id][Jail] == 0)
  1314. SendClientMessage(playerid, ORANGE, "Player is not in jail");
  1315. return 1;
  1316. }
  1317.  
  1318. dcmd_spawn(playerid, params[])
  1319. {
  1320. if(PInfo[playerid][Level] < 1)
  1321. return SendClientMessage(playerid, ORANGE, "You need to be administrator to use this command");
  1322. new tmp[256];
  1323. new Index;
  1324. tmp = strtok(params, Index);
  1325. new id = strval(tmp);
  1326. new string[128];
  1327. new pName[MAX_PLAYER_NAME];
  1328. GetPlayerName(id, pName, MAX_PLAYER_NAME);
  1329. SpawnPlayer(id);
  1330. format(string, 128, "You have spawned %s", pName);
  1331. SendClientMessage(playerid, YELLOW, string);
  1332. AdminCommand(playerid, "SPAWN");
  1333. return 1;
  1334. }
  1335.  
  1336. dcmd_gmx(playerid, params[])
  1337. {
  1338. #pragma unused params
  1339. if(PInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
  1340. {
  1341. new string[128];
  1342. new playername[MAX_PLAYER_NAME];
  1343. GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
  1344. if(!strlen(params))
  1345. {
  1346. format(string,sizeof(string), "Administrator %s has restarted the server || Reason: Not given", playername);
  1347. }
  1348. else
  1349. {
  1350. format(string,sizeof(string), "Administrator %s has restarted the server || Reason: %s", playername, params);
  1351. }
  1352. for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i)) PlayerPlaySound(i,1057,0.0,0.0,0.0);
  1353. SendClientMessageToAll(YELLOW, string);
  1354. SendRconCommand("gmx");
  1355. }
  1356. else return 0;
  1357. return 1;
  1358. }
  1359.  
  1360.  
  1361. dcmd_ahelp(playerid, params[])
  1362. {
  1363. #pragma unused params
  1364. if(PInfo[playerid][Level] == 1)
  1365. {
  1366. SendClientMessage(playerid, YELLOW, "Level 1 commands: kick, get, goto, slap, adminduty, asay, spec, endspec, adminarea, spawn");
  1367. }
  1368. else if(PInfo[playerid][Level] == 2)
  1369. {
  1370. SendClientMessage(playerid, YELLOW, "Level 1 commands: kick, get, goto, slap, adminduty, asay, spec, endspec, adminarea, spawn");
  1371. SendClientMessage(playerid, YELLOW, "Level 2 commands: mute, setmoney, explode, jail, unjail");
  1372. }
  1373. else if(PInfo[playerid][Level] == 3)
  1374. {
  1375. SendClientMessage(playerid, YELLOW, "Level 1 commands: kick, get, goto, slap, adminduty, asay, spec, endspec, adminarea, spawn");
  1376. SendClientMessage(playerid, YELLOW, "Level 2 commands: mute, setmoney, explode, jail, unjail");
  1377. SendClientMessage(playerid, YELLOW, "Level 3 commands: ban");
  1378. }
  1379. else if(PInfo[playerid][Level] == 4)
  1380. {
  1381. SendClientMessage(playerid, YELLOW, "Level 1 commands: kick, get, goto, slap, adminduty, asay, spec, endspec, adminarea, spawn");
  1382. SendClientMessage(playerid, YELLOW, "Level 2 commands: mute, setmoney, explode, jail, unjail");
  1383. SendClientMessage(playerid, YELLOW, "Level 3 commands: ban");
  1384. SendClientMessage(playerid, YELLOW, "Level 4 commands: healall, armorall, setscore, givescore, setskin");
  1385. }
  1386. else if(PInfo[playerid][Level] == 5)
  1387. {
  1388. SendClientMessage(playerid, YELLOW, "Level 1 commands: kick, get, goto, slap, adminduty, asay, spec, endspec, adminarea, spawn");
  1389. SendClientMessage(playerid, YELLOW, "Level 2 commands: mute, setmoney, explode, jail, unjail");
  1390. SendClientMessage(playerid, YELLOW, "Level 3 commands: ban");
  1391. SendClientMessage(playerid, YELLOW, "Level 4 commands: healall, armorall, setscore, givescore, setskin");
  1392. SendClientMessage(playerid, YELLOW, "Level 5+ commands: setlevel, gmx");
  1393. }
  1394. return 1;
  1395. }
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403. public OnPlayerSpawn(playerid)
  1404. {
  1405. if(PInfo[playerid][AdminDuty] == 1)
  1406. {
  1407. label[playerid] = Create3DTextLabel("On-Duty admin, do not attack",0x008080FF,30.0,40.0,50.0,40.0,0);
  1408. Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
  1409. SetPlayerSkin(playerid, 217);
  1410. SetPlayerHealth(playerid, 10000);
  1411. GivePlayerWeapon(playerid, WEAPON_MINIGUN, 100000);
  1412. }
  1413. return 1;
  1414. }
  1415.  
  1416.  
  1417. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1418. {
  1419. if(newkeys == KEY_CROUCH)
  1420. {
  1421. if(PInfo[playerid][Spectate] == 1)
  1422. {
  1423. TogglePlayerSpectating(playerid, 0);
  1424. PInfo[playerid][Spectate] = 0;
  1425. }
  1426. }
  1427. return 1;
  1428. }
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442. public OnPlayerText(playerid, text[])
  1443. {
  1444. if(text[0] == '#' || text[0] == '.' && PInfo[playerid][Level] >= 1)
  1445. {
  1446. new string[128];
  1447. GetPlayerName(playerid, string, 128);
  1448. format(string,sizeof(string),"[ADMIN CHAT] %s: %s",string,text[1]);
  1449. Loop(i, MAX_PLAYERS)
  1450. {
  1451. if(PInfo[i][Level] >= 1)
  1452. SendClientMessage(playerid, YELLOW, string);
  1453. }
  1454. return 0;
  1455. }
  1456. if(PInfo[playerid][Muted] == 1)
  1457. {
  1458. SendClientMessage(playerid, GREY, "You cannot talk while muted!");
  1459. return 0;
  1460. }
  1461. if(PInfo[playerid][AdminDuty] == 1)
  1462. {
  1463. new string[128];
  1464. GetPlayerName(playerid, string, 128);
  1465. format(string, 128, "Admin %s: %s", string, text);
  1466. SendClientMessageToAll(LIGHTBLUE, string);
  1467. return 0;
  1468. }
  1469. return 1;
  1470. }
  1471.  
  1472. public OnPlayerRequestSpawn(playerid)
  1473. {
  1474. if(PInfo[playerid][Logged] == 0)
  1475. {
  1476. SendClientMessage(playerid, ORANGE, "You need to be logged in before spawning");
  1477. return 0;
  1478. }
  1479. return 1;
  1480. }
  1481.  
  1482. public OnPlayerDeath(playerid, killerid, reason)
  1483. {
  1484. PInfo[playerid][Deaths]++;
  1485. PInfo[killerid][Kills]++;
  1486. return 1;
  1487. }
  1488.  
  1489. public ServerBot()
  1490. {
  1491. new string[128];
  1492. Loop(i, MAX_PLAYERS)
  1493. {
  1494. new pName[MAX_PLAYER_NAME];
  1495. GetPlayerName(i, pName, MAX_PLAYER_NAME);
  1496. if(GetPlayerPing(i) > MAX_PING && GetPlayerPing(i) < 2500)
  1497. {
  1498. format(string, 128, "[SERVER BOT] %s has been kicked from the server || Reason: High Ping (%d), Max allowed (%d)",pName, GetPlayerPing(i), MAX_PING);
  1499. SendClientMessageToAll(GREY, string);
  1500. Kick(i);
  1501. }
  1502. if(GetPlayerWeapon(i) == WEAPON_MINIGUN && PInfo[i][Level] < 1)
  1503. {
  1504. format(string, 128, "[SERVER BOT] %s has been banned from the server || Reason: Weapon hack", pName);
  1505. SendClientMessageToAll(GREY, string);
  1506. BanEx(i, "Weapon hack");
  1507. }
  1508. }
  1509. return 1;
  1510. }
  1511.  
  1512. public God(playerid)
  1513. {
  1514. SetPlayerHealth(playerid, 10000);
  1515. return 1;
  1516. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement