1
0

dedicated.pwn 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Dedicated System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. /** Austin's DP system **/
  34. #include <YSI\y_hooks>
  35. SendDedicatedMessage(color, string[])
  36. {
  37. foreach(new i: Player)
  38. {
  39. if((PlayerInfo[i][pDedicatedPlayer] > 0 || PlayerInfo[i][pAdmin] >= 4) && PlayerInfo[i][pDedicatedEnabled] == 1)
  40. {
  41. SendClientMessageEx(i, color, string);
  42. }
  43. }
  44. }
  45. HourDedicatedPlayer(playerid)
  46. {
  47. new thedate[3];
  48. getdate(thedate[0], thedate[1], thedate[2]);
  49. PlayerInfo[playerid][pDedicatedHours]++;
  50. if(PlayerInfo[playerid][pDedicatedHours] >= 50 && PlayerInfo[playerid][pDedicatedPlayer] == 0)
  51. {
  52. if(PlayerInfo[playerid][pDedicatedPlayer] != 4) PlayerInfo[playerid][pDedicatedPlayer] = 1;
  53. SendClientMessageEx(playerid, COLOR_YELLOW, "Congratulations you are now a Tier 1 Dedicated Player!");
  54. format(szMiscArray, sizeof(szMiscArray), "%s has ascended to Tier 1 Dedicated Player after playing 50 hours!", GetPlayerNameEx(playerid));
  55. SendClientMessageToAll(-1, szMiscArray);
  56. }
  57. else if(PlayerInfo[playerid][pDedicatedHours] >= 75 && PlayerInfo[playerid][pDedicatedPlayer] == 1)
  58. {
  59. if(PlayerInfo[playerid][pDedicatedPlayer] != 4) PlayerInfo[playerid][pDedicatedPlayer] = 2;
  60. format(PlayerInfo[playerid][pDedicatedTimestamp], 11, "%d-%02d-%02d", thedate[0], thedate[1], thedate[2]);
  61. SendClientMessageEx(playerid, COLOR_YELLOW, "Congratulations you are now a Tier 2 Dedicated Player!");
  62. format(szMiscArray, sizeof(szMiscArray), "%s has ascended to Tier 2 Dedicated Player after playing 75 hours!", GetPlayerNameEx(playerid));
  63. SendClientMessageToAll(-1, szMiscArray);
  64. }
  65. else if(PlayerInfo[playerid][pDedicatedHours] >= 90 && PlayerInfo[playerid][pDedicatedPlayer] == 2)
  66. {
  67. if(PlayerInfo[playerid][pDedicatedPlayer] != 4) PlayerInfo[playerid][pDedicatedPlayer] = 3;
  68. SendClientMessageEx(playerid, COLOR_YELLOW, "Congratulations you are now a Tier 3 Dedicated Player!");
  69. format(szMiscArray, sizeof(szMiscArray), "%s has ascended to Tier 3 Dedicated Player after playing 90 hours!.", GetPlayerNameEx(playerid));
  70. SendClientMessageToAll(-1, szMiscArray);
  71. }
  72. }
  73. DayDedicatedPlayer(playerid)
  74. {
  75. new thedate[3],
  76. tdate[3];
  77. getdate(thedate[0], thedate[1], thedate[2]);
  78. sscanf(PlayerInfo[playerid][pDedicatedTimestamp], "p<->iii", tdate[0], tdate[1], tdate[2]);
  79. if(tdate[2]+1 == thedate[2] && PlayerInfo[playerid][pDedicatedPlayer] >= 2)
  80. {
  81. GiftPlayer(MAX_PLAYERS, playerid);
  82. format(PlayerInfo[playerid][pDedicatedTimestamp], 11, "%d-%02d-%02d", thedate[0], thedate[1], thedate[2]);
  83. PlayerInfo[playerid][pGiftTime] = 0;
  84. }
  85. /*
  86. else if(thedate[2] == 1 && thedate[1] != tdate[1])
  87. {
  88. SendClientMessageEx(playerid, COLOR_RED, "Dedicated: It's a new month your dedicated rank has been reset!");
  89. PlayerInfo[playerid][pDedicatedPlayer] = 0;
  90. PlayerInfo[playerid][pDedicatedHours] = 0;
  91. }
  92. */
  93. }
  94. GetDPRankName(playerid)
  95. {
  96. new rank[77];
  97. if(PlayerInfo[playerid][pAdmin] >= 4 && (PlayerInfo[playerid][pTogReports] == 1 || GetPVarType(playerid, "Undercover")))
  98. {
  99. rank = "Tier 1 Dedicated Player";
  100. }
  101. else if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0)
  102. {
  103. switch(PlayerInfo[playerid][pAdmin])
  104. {
  105. case 2: rank = "Junior Admin";
  106. case 3: rank = "General Admin";
  107. case 4: rank = "Senior Admin";
  108. case 1337: rank = "Head Admin";
  109. case 99999: rank = "Executive Admin";
  110. }
  111. }
  112. else
  113. {
  114. switch(PlayerInfo[playerid][pDedicatedPlayer])
  115. {
  116. case 1: rank = "Tier 1 Dedicated Player";
  117. case 2: rank = "Tier 2 Dedicated Player";
  118. case 3: rank = "Tier 3 Dedicated Player";
  119. case 4: rank = "Dedicated Moderator";
  120. }
  121. }
  122. return rank;
  123. }
  124. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  125. if(dialogid == DIALOG_LOCKER_DP1)
  126. {
  127. if(!response) return SendClientMessageEx(playerid, COLOR_GRAD2, "You have exited the locker.");
  128. if(!IsPlayerInRangeOfPoint(playerid, 4.0, 166.6046,-2001.0406,3499.6482)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not near the DP Locker.");// Need co-ordinates
  129. if(listitem == 0)
  130. {
  131. new Float:health;
  132. GetHealth(playerid, health);
  133. new hpint = floatround( health, floatround_round );
  134. if( hpint >= 100 )
  135. {
  136. SendClientMessageEx(playerid, COLOR_GREY, "You already have full health.");
  137. return 1;
  138. }
  139. else {
  140. SetHealth(playerid, 100);
  141. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You have used a first aid kit, you now have 100.0 HP.");
  142. }
  143. }
  144. if(listitem == 1)
  145. {
  146. new Float:armour;
  147. GetArmour(playerid, armour);
  148. if(armour >= 100)
  149. {
  150. SendClientMessageEx(playerid, COLOR_GREY, "You already have full armor.");
  151. return 1;
  152. }
  153. else if(GetPlayerCash(playerid) < 10000)
  154. {
  155. SendClientMessageEx(playerid, COLOR_GREY,"You don't have $10,000");
  156. return 1;
  157. }
  158. else
  159. {
  160. GivePlayerCash(playerid, -10000);
  161. SetArmour(playerid, 100);
  162. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You paid $10,000 for a kevlar vest.");
  163. }
  164. }
  165. }
  166. else if(dialogid == DIALOG_LOCKER_DP2)
  167. {
  168. if(!response) return SendClientMessageEx(playerid, COLOR_GRAD2, "You have exited the locker.");
  169. if(!IsPlayerInRangeOfPoint(playerid, 4.0, 166.6046,-2001.0406,3499.6482)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not near the DP Locker.");// Need co-ordinates
  170. if(listitem == 0)
  171. {
  172. new Float:health;
  173. GetHealth(playerid, health);
  174. new hpint = floatround( health, floatround_round );
  175. if( hpint >= 100 )
  176. {
  177. SendClientMessageEx(playerid, COLOR_GREY, "You already have full health.");
  178. return 1;
  179. }
  180. else {
  181. SetHealth(playerid, 100);
  182. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You have used a first aid kit, you now have 100.0 HP.");
  183. }
  184. }
  185. if(listitem == 1)
  186. {
  187. new Float:armour;
  188. GetArmour(playerid, armour);
  189. if(armour >= 100)
  190. {
  191. SendClientMessageEx(playerid, COLOR_GREY, "You already have full armor.");
  192. return 1;
  193. }
  194. else if(GetPlayerCash(playerid) < 5000 && PlayerInfo[playerid][pDedicatedPlayer] < 3)
  195. {
  196. SendClientMessageEx(playerid, COLOR_GREY,"You don't have $5,000");
  197. return 1;
  198. }
  199. else
  200. {
  201. if(PlayerInfo[playerid][pDedicatedPlayer] < 3) GivePlayerCash(playerid, -5000);
  202. SetArmour(playerid, 100);
  203. if(PlayerInfo[playerid][pDedicatedPlayer] < 3)
  204. {
  205. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You paid $5,000 for a kevlar vest.");
  206. }
  207. else
  208. {
  209. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You take a kevlar vest from the locker.");
  210. }
  211. }
  212. }
  213. if(listitem == 2)
  214. {
  215. if(PlayerInfo[playerid][pAccountRestricted] != 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "Your account is restricted!");
  216. if(PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You can't take weapons out as you're currently weapon restricted!");
  217. ShowPlayerDialogEx(playerid, DIALOG_DEDICATED_WEAPON, DIALOG_STYLE_LIST, "Dedicated Weapon Inventory", "Desert Eagle (Free)\nSemi-Automatic MP5 (Free)\nPump Shotgun (Free)", "Take", "Cancel");
  218. }
  219. }
  220. else if(dialogid == DIALOG_DEDICATED_WEAPON)
  221. {
  222. if(!response) return SendClientMessageEx(playerid, COLOR_GRAD2, "You have exited the locker.");
  223. if(!IsPlayerInRangeOfPoint(playerid, 4.0, 166.6046,-2001.0406,3499.6482)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not near the DP Locker.");// Need co-ordinates
  224. switch(listitem)
  225. {
  226. case 0: //Deagle
  227. {
  228. GivePlayerValidWeapon(playerid, 24);
  229. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You have taken a Desert Eagle from the locker.");
  230. }
  231. case 1: //MP5
  232. {
  233. GivePlayerValidWeapon(playerid, 29);
  234. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You have taken a Semi-Automatic MP5 from the locker.");
  235. }
  236. case 2: //Shotgun
  237. {
  238. GivePlayerValidWeapon(playerid, 25);
  239. SendClientMessageEx(playerid, COLOR_YELLOW, "[Dedicated Locker] You have taken a Pump Shotgun from the locker.");
  240. }
  241. }
  242. }
  243. return 0;
  244. }
  245. /** Austin's Dedicated Player System **/
  246. CMD:dp(playerid, params[])
  247. {
  248. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  249. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && !PlayerInfo[playerid][pDedicatedPlayer]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Dedicated player.");
  250. if(PlayerInfo[playerid][pDedicatedEnabled] != 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must enable Dedicated chat before using it. (/togdp)");
  251. if(PlayerInfo[playerid][pDedicatedMuted] != 0 || PlayerInfo[playerid][pDedicatedWarn] != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are currently muted from the Dedicated chat.");
  252. if(GetPVarInt(playerid, "LastDPChat") > gettime()) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must wait 5 seconds between messages.");
  253. new szMessage[128];
  254. if(sscanf(params, "s[128", szMessage)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /dp [message]");
  255. format(szMessage, sizeof(szMessage), "%s %s: %s", GetDPRankName(playerid), GetPlayerNameEx(playerid), szMessage);
  256. SendDedicatedMessage(0x2FC660FF, szMessage);
  257. SetPVarInt(playerid, "LastDPChat", gettime()+5);
  258. return 1;
  259. }
  260. CMD:togdp(playerid, params[])
  261. {
  262. if(PlayerInfo[playerid][pDedicatedPlayer] > 0 || PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  263. {
  264. if(PlayerInfo[playerid][pDedicatedEnabled] == 0)
  265. {
  266. PlayerInfo[playerid][pDedicatedEnabled] = 1;
  267. SendClientMessageEx(playerid, COLOR_WHITE, "You have enabled the Dedicated chat.");
  268. }
  269. else
  270. {
  271. PlayerInfo[playerid][pDedicatedEnabled] = 0;
  272. SendClientMessageEx(playerid, COLOR_WHITE, "You have disabled Dedicated chat and will no longer recieve messages.");
  273. }
  274. }
  275. else
  276. {
  277. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Dedicated player.");
  278. }
  279. return 1;
  280. }
  281. CMD:dplocker(playerid, params[])
  282. {
  283. #if defined zombiemode
  284. if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie")) return SendClientMessageEx(playerid, COLOR_GREY, "Zombies can't use this.");
  285. #endif
  286. if(IsPlayerInRangeOfPoint(playerid, 4.0, 166.6540, -2001.0413, 3499.6482)) // Need co-ordinates
  287. {
  288. switch(PlayerInfo[playerid][pDedicatedPlayer])
  289. {
  290. case 0: SendClientMessageEx(playerid, COLOR_GRAD2, "You're not a dedicated player!");
  291. case 1: ShowPlayerDialogEx(playerid, DIALOG_LOCKER_DP1, DIALOG_STYLE_LIST, "Dedicated Player 1", "First Aid Kit (Free)\nKevlar Vest ($10,000)", "Select", "Cancel");
  292. case 2: ShowPlayerDialogEx(playerid, DIALOG_LOCKER_DP2, DIALOG_STYLE_LIST, "Dedicated Player 2", "First Aid Kit (Free)\nKevlar Vest ($5,000)\nWeapons (Free)", "Select", "Cancel");
  293. default: ShowPlayerDialogEx(playerid, DIALOG_LOCKER_DP2, DIALOG_STYLE_LIST, "Dedicated Player 3", "First Aid Kit (Free)\nKevlar Vest (Free)\nWeapons (Free)", "Select", "Cancel");
  294. }
  295. }
  296. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not at the dedicated locker!");
  297. return 1;
  298. }
  299. /*
  300. CMD:dpplate(playerid, params[])
  301. {
  302. if(PlayerInfo[playerid][pDedicatedPlayer] < 1)
  303. return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not a Dedicated player!");
  304. new string[128], Float: vHealth, inpveh;
  305. if(IsPlayerConnected(playerid))
  306. {
  307. if(isnull(params))
  308. return SendClientMessageEx(playerid, COLOR_GREY, "Usage: /dpplate [dp/superdp/remove]");
  309. inpveh = false;
  310. for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
  311. {
  312. if(IsPlayerInVehicle(playerid, PlayerVehicleInfo[playerid][d][pvId]))
  313. {
  314. GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], vHealth);
  315. inpveh = 1;
  316. if(vHealth < 800)
  317. return SendClientMessageEx(playerid, COLOR_LIGHTRED, "Please repair your vehicle before replacing your plate.");
  318. if(strcmp(params, "dp", true) == 0)
  319. {
  320. format(string, sizeof(string), "{2FC660}DEDICATED");
  321. format(PlayerVehicleInfo[playerid][d][pvPlate], 32, "%s", string);
  322. SendClientMessageEx(playerid, COLOR_WHITE, "Your vehicle will now appear with the Dedicated Player Plate, parking your vehicle momentarily...");
  323. cmd_park(playerid, "");
  324. }
  325. else if(strcmp(params, "superdp", true) == 0)
  326. {
  327. if(PlayerInfo[playerid][pDedicatedPlayer] < 2) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not a high enough Dedicated player for this plate.");
  328. format(string, sizeof(string), "{2FC660}SUPERDP");
  329. format(PlayerVehicleInfo[playerid][d][pvPlate], 32, "%s", string);
  330. SendClientMessageEx(playerid, COLOR_WHITE, "Your vehicle will now appear with the Super Dedicated Player Plate.");
  331. cmd_park(playerid, "");
  332. }
  333. else if(strcmp(params, "remove", true) == 0)
  334. {
  335. PlayerVehicleInfo[playerid][d][pvPlate] = 0;
  336. SendClientMessageEx(playerid, COLOR_WHITE, "Your vehicle will now appear with the default plate.");
  337. cmd_park(playerid, "");
  338. }
  339. else
  340. {
  341. SendClientMessageEx(playerid, COLOR_GREY, "Usage: /dpplate [dp/superdp/remove]");
  342. }
  343. }
  344. }
  345. if(inpveh == 0) SendClientMessageEx(playerid, COLOR_GRAD2, "You're not inside a vehicle that you own!");
  346. }
  347. return 1;
  348. }
  349. */
  350. CMD:dpwarn(playerid, params[])
  351. {
  352. new giveplayerid, reason[24], string[164];
  353. if(PlayerInfo[playerid][pDedicatedPlayer] >= 4 || PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  354. {
  355. if(!sscanf(params, "us[24]", giveplayerid, reason))
  356. {
  357. if(!IsPlayerConnected(giveplayerid))
  358. return SendClientMessageEx(playerid, COLOR_GREY, "That person is not connected.");
  359. if(PlayerInfo[giveplayerid][pDedicatedMuted] != 0)
  360. return SendClientMessageEx(playerid, COLOR_GREY, "That person is muted from the chat.");
  361. if(PlayerInfo[giveplayerid][pDedicatedWarn] > 0)
  362. return SendClientMessageEx(playerid, COLOR_GREY, "That person is already serving a warning.");
  363. format(string, sizeof(string), "AdmCmd: %s has temporarily muted %s from Dedicated chat, reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
  364. ABroadCast(COLOR_LIGHTRED, string, 4);
  365. SendDedicatedMessage(COLOR_LIGHTRED, string);
  366. Log("logs/dedicated.log", string);
  367. format(string, sizeof(string), "You have been warned from the Dedicated chat by %s, reason: %s", GetPlayerNameEx(playerid), reason);
  368. SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
  369. SendClientMessageEx(giveplayerid, COLOR_WHITE, "This action lasts for two hours. To appeal, please visit our forums: www.ng-gaming.net/forums");
  370. PlayerInfo[giveplayerid][pDedicatedWarn] = 120;
  371. }
  372. else
  373. {
  374. SendClientMessageEx(playerid, COLOR_GRAD1, "Usage: /dpwarn [playerid] [reason]");
  375. }
  376. }
  377. else
  378. {
  379. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
  380. }
  381. return 1;
  382. }
  383. CMD:setdedicated(playerid, params[])
  384. {
  385. if(PlayerInfo[playerid][pAdmin] >= 1337)
  386. {
  387. new string[128], targetid, level;
  388. if(sscanf(params, "ui", targetid, level))
  389. {
  390. SendClientMessageEx(playerid, COLOR_GRAD1, "Usage: /setdedicated [player] [level]");
  391. SendClientMessageEx(playerid, COLOR_GRAD2, "(1) Tier 1 Dedicated - (2) Tier 2 Dedicated - (3) Tier 3 Dedicated 3 - (4) DP Moderator");
  392. return 1;
  393. }
  394. if(IsPlayerConnected(targetid))
  395. {
  396. if(targetid != INVALID_PLAYER_ID)
  397. {
  398. if(PlayerInfo[targetid][pDedicatedPlayer] > PlayerInfo[playerid][pDedicatedPlayer])
  399. return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot use this command on this person!");
  400. PlayerInfo[targetid][pDedicatedPlayer] = level;
  401. format(string, sizeof(string), "AdmCmd: %s has set %s Dedicated level to %d.", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), level);
  402. ABroadCast(COLOR_LIGHTRED, string, 4);
  403. SendDedicatedMessage(COLOR_LIGHTRED, string);
  404. Log("logs/dedicated.log", string);
  405. }
  406. }
  407. else
  408. {
  409. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  410. }
  411. }
  412. else
  413. {
  414. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  415. }
  416. return 1;
  417. }
  418. CMD:osetdedicated(playerid, params[])
  419. {
  420. if(PlayerInfo[playerid][pAdmin] >= 1337)
  421. {
  422. new string[128], pname[MAX_PLAYER_NAME], level;
  423. if(sscanf(params, "s[32]i", pname, level))
  424. return SendClientMessageEx(playerid, COLOR_WHITE, "Usage: /osetdedicated [player] [level]");
  425. new targetid = ReturnUser(pname);
  426. if(IsPlayerConnected(targetid))
  427. {
  428. SendClientMessageEx(playerid, COLOR_WHITE, "This player is connected, please use /setdedicated.");
  429. }
  430. else
  431. {
  432. new
  433. szQuery[128],
  434. szPlayerName[MAX_PLAYER_NAME];
  435. mysql_escape_string(pname, szPlayerName);
  436. SetPVarInt(playerid, "Offline_Dedicated", level);
  437. SetPVarString(playerid, "Offline_DName", szPlayerName);
  438. mysql_format(MainPipeline, szQuery, sizeof(szQuery), "SELECT `pDedicatedPlayer` FROM `accounts` WHERE `Username` = '%s'", szPlayerName);
  439. mysql_tquery(MainPipeline, szQuery, "OnQueryFinish", "iii", OFFLINE_DEDICATED_THREAD, playerid, g_arrQueryHandle{playerid});
  440. format(string, sizeof(string), "Attempting to offline set %s account to level %d Dedicated.", szPlayerName, level);
  441. SendClientMessageEx(playerid, COLOR_WHITE, string);
  442. }
  443. }
  444. else
  445. {
  446. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  447. }
  448. return 1;
  449. }
  450. CMD:dpmute(playerid, params[])
  451. {
  452. if(PlayerInfo[playerid][pDedicatedPlayer] >= 4 || PlayerInfo[playerid][pAdmin] >= 4)
  453. {
  454. new string[128], targetid, reason[64];
  455. if(sscanf(params, "us[64]", targetid, reason))
  456. return SendClientMessageEx(playerid, COLOR_GRAD1, "Usage: /dpmute [player] [reason]");
  457. if(IsPlayerConnected(targetid))
  458. {
  459. if(PlayerInfo[targetid][pDedicatedMuted] == 0)
  460. {
  461. if(targetid != INVALID_PLAYER_ID)
  462. {
  463. if(PlayerInfo[targetid][pDedicatedPlayer] > PlayerInfo[playerid][pDedicatedPlayer] && PlayerInfo[playerid][pAdmin] <= 0 || PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
  464. return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot use this command on this person!");
  465. PlayerInfo[targetid][pDedicatedMuted] = 1;
  466. format(string, sizeof(string), "You were muted from the Dedicated chat by %s, reason: %s. You may appeal this mute at www.ng-gaming.net/forums", GetPlayerNameEx(playerid), reason);
  467. SendClientMessageEx(targetid, COLOR_GRAD2, string);
  468. format(string, sizeof(string), "AdmCmd: %s has muted %s from the Dedicated chat, reason: %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), reason);
  469. ABroadCast(COLOR_LIGHTRED, string, 4);
  470. SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
  471. Log("logs/dedicated.log", string);
  472. }
  473. }
  474. else
  475. {
  476. SendClientMessageEx(playerid, COLOR_GRAD1, "This person is already muted from the Dedicated chat!");
  477. }
  478. }
  479. else
  480. {
  481. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  482. }
  483. }
  484. else
  485. {
  486. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  487. }
  488. return 1;
  489. }
  490. CMD:dpunmute(playerid, params[])
  491. {
  492. if(PlayerInfo[playerid][pDedicatedPlayer] >= 4 || PlayerInfo[playerid][pAdmin] >= 4)
  493. {
  494. new string[128], targetid, reason[64];
  495. if(sscanf(params, "us[64]", targetid, reason))
  496. return SendClientMessageEx(playerid, COLOR_GRAD1, "Usage: /dpunmute [player] [reason]");
  497. if(IsPlayerConnected(targetid))
  498. {
  499. if(PlayerInfo[targetid][pDedicatedMuted] == 1)
  500. {
  501. if(targetid != INVALID_PLAYER_ID)
  502. {
  503. //if(PlayerInfo[targetid][pDedicatedPlayer] > PlayerInfo[playerid][pDedicatedPlayer] || PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
  504. // return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot use this command on this person!");
  505. PlayerInfo[targetid][pDedicatedMuted] = 0;
  506. format(string, sizeof(string), "You were unmuted from the Dedicated chat by %s, reason: %s.", GetPlayerNameEx(playerid), reason);
  507. SendClientMessageEx(targetid, COLOR_GRAD2, string);
  508. format(string, sizeof(string), "AdmCmd: %s has unmuted %s from the Dedicated chat, reason: %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), reason);
  509. ABroadCast(COLOR_LIGHTRED, string, 4);
  510. SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
  511. Log("logs/dedicated.log", string);
  512. }
  513. }
  514. else
  515. {
  516. SendClientMessageEx(playerid, COLOR_GRAD1, "This person is not muted from the Dedicated chat!");
  517. }
  518. }
  519. else
  520. {
  521. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  522. }
  523. }
  524. else
  525. {
  526. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  527. }
  528. return 1;
  529. }
  530. CMD:dedicatedplayers(playerid, params[])
  531. {
  532. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pDedicatedPlayer] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  533. {
  534. new string[1024];
  535. foreach(new i : Player)
  536. {
  537. if(PlayerInfo[i][pDedicatedPlayer] >= 1)
  538. {
  539. format(string, sizeof(string), "%s\nLevel %d Dedicated %s", string, PlayerInfo[i][pDedicatedPlayer], GetPlayerNameEx(i));
  540. }
  541. }
  542. ShowPlayerDialogEx(playerid, 0, DIALOG_STYLE_LIST, "Online Dedicated Players", string, "Close", "");
  543. }
  544. else
  545. {
  546. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  547. }
  548. return 1;
  549. }
  550. CMD:dpdraw(playerid, params[])
  551. {
  552. if(PlayerInfo[playerid][pDedicatedPlayer] >= 4 || PlayerInfo[playerid][pAdmin] >= 1337)
  553. {
  554. new
  555. arr_Winners[MAX_PLAYERS],
  556. iWinCount,
  557. iBroadcast;
  558. if(sscanf(params, "d", iBroadcast))
  559. {
  560. SendClientMessageEx(playerid, COLOR_GRAD1, "Usage: /dpdraw [broadcast(0-1)]");
  561. return 1;
  562. }
  563. foreach(new i: Player)
  564. {
  565. if(PlayerInfo[i][pDedicatedPlayer] > 0) arr_Winners[iWinCount++] = i;
  566. }
  567. if(iWinCount > 0)
  568. {
  569. new
  570. iWinrar = arr_Winners[random(iWinCount)],
  571. szMessage[128];
  572. if(iBroadcast == 1)
  573. {
  574. format(szMessage, sizeof(szMessage), "%s was just randomly selected! Congratulations! (Dedicated Player Draw)", GetPlayerNameEx(iWinrar));
  575. SendDedicatedMessage(COLOR_WHITE, szMessage);
  576. }
  577. else
  578. {
  579. format(szMessage, sizeof(szMessage), "%s (ID %d) was randomly selected (/dpdraw).", GetPlayerNameEx(iWinrar), iWinrar);
  580. SendClientMessageEx(playerid, COLOR_YELLOW, szMessage);
  581. ABroadCast(COLOR_YELLOW, szMessage, 1338);
  582. }
  583. format(szMessage, sizeof(szMessage), "%s has used /dpdraw and %s won.", GetPlayerNameEx(playerid), GetPlayerNameEx(iWinrar));
  584. Log("logs/dedicated.log", szMessage);
  585. }
  586. else
  587. {
  588. SendClientMessageEx(playerid, COLOR_WHITE, "Nobody online can win!");
  589. }
  590. }
  591. return 1;
  592. }