citizenship.pwn 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Citizenship 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. /*
  34. NationSel_InitNationNameText(Text:txtInit)
  35. {
  36. TextDrawUseBox(txtInit, 0);
  37. TextDrawLetterSize(txtInit,1.25,3.0);
  38. TextDrawFont(txtInit, 0);
  39. TextDrawSetShadow(txtInit,0);
  40. TextDrawSetOutline(txtInit,1);
  41. TextDrawColor(txtInit,0xEEEEEEFF);
  42. TextDrawBackgroundColor(txtNationSelHelper,0x000000FF);
  43. }
  44. NationSel_InitTextDraws()
  45. {
  46. // Init our observer helper text display
  47. txtSanAndreas = TextDrawCreate(10.0, 380.0, "San Andreas");
  48. NationSel_InitNationNameText(txtSanAndreas);
  49. txtTierraRobada = TextDrawCreate(10.0, 380.0, "Tierro Robada");
  50. NationSel_InitNationNameText(txtTierraRobada);
  51. // Init our observer helper text display
  52. txtNationSelHelper = TextDrawCreate(10.0, 415.0,
  53. " Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
  54. TextDrawUseBox(txtNationSelHelper, 1);
  55. TextDrawBoxColor(txtNationSelHelper,0x222222BB);
  56. TextDrawLetterSize(txtNationSelHelper,0.3,1.0);
  57. TextDrawTextSize(txtNationSelHelper,400.0,40.0);
  58. TextDrawFont(txtNationSelHelper, 2);
  59. TextDrawSetShadow(txtNationSelHelper,0);
  60. TextDrawSetOutline(txtNationSelHelper,1);
  61. TextDrawBackgroundColor(txtNationSelHelper,0x000000FF);
  62. TextDrawColor(txtNationSelHelper,0xFFFFFFFF);
  63. txtNationSelMain = TextDrawCreate(10.0, 50.0, "Select Your Nation");
  64. TextDrawUseBox(txtNationSelMain, 0);
  65. TextDrawLetterSize(txtNationSelMain, 1.25, 3.0);
  66. TextDrawFont(txtNationSelMain, 1);
  67. TextDrawSetShadow(txtNationSelMain, 0);
  68. TextDrawSetOutline(txtNationSelMain, 1);
  69. TextDrawBackgroundColor(txtNationSelMain, 0x000000FF);
  70. TextDrawColor(txtNationSelMain, 0xFFFFFFFF);
  71. }
  72. NationSel_SetupSelectedNation(playerid)
  73. {
  74. if(PlayerNationSelection[playerid] == -1) {
  75. PlayerNationSelection[playerid] = NATION_SAN_ANDREAS;
  76. }
  77. if(PlayerNationSelection[playerid] == NATION_SAN_ANDREAS) {
  78. SetPlayerInterior(playerid,0);
  79. SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
  80. SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
  81. TextDrawShowForPlayer(playerid,txtSanAndreas);
  82. TextDrawHideForPlayer(playerid,txtTierraRobada);
  83. }
  84. else if(PlayerNationSelection[playerid] == NATION_TIERRA_ROBADA) {
  85. SetPlayerInterior(playerid,0);
  86. SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390);
  87. SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275);
  88. TextDrawHideForPlayer(playerid,txtSanAndreas);
  89. TextDrawShowForPlayer(playerid,txtTierraRobada);
  90. }
  91. }
  92. NationSel_SwitchToNextNation(playerid)
  93. {
  94. PlayerNationSelection[playerid]++;
  95. if(PlayerNationSelection[playerid] > NATION_TIERRA_ROBADA) {
  96. PlayerNationSelection[playerid] = NATION_SAN_ANDREAS;
  97. }
  98. PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
  99. NationSel_SetupSelectedNation(playerid);
  100. }
  101. NationSel_SwitchToPrevNation(playerid)
  102. {
  103. PlayerNationSelection[playerid]--;
  104. if(PlayerNationSelection[playerid] < NATION_SAN_ANDREAS) {
  105. PlayerNationSelection[playerid] = NATION_TIERRA_ROBADA;
  106. }
  107. PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
  108. NationSel_SetupSelectedNation(playerid);
  109. }
  110. NationSel_HandleNationSelection(playerid)
  111. {
  112. new Keys,ud,lr;
  113. new Float:diff = float(TRCitizens)/float(TotalCitizens)*100;
  114. GetPlayerKeys(playerid,Keys,ud,lr);
  115. if(PlayerNationSelection[playerid] == -1) {
  116. NationSel_SwitchToNextNation(playerid);
  117. return;
  118. }
  119. if(Keys & KEY_FIRE)
  120. {
  121. PlayerHasNationSelected[playerid] = 1;
  122. TextDrawHideForPlayer(playerid,txtNationSelHelper);
  123. TextDrawHideForPlayer(playerid,txtNationSelMain);
  124. TextDrawHideForPlayer(playerid,txtSanAndreas);
  125. TextDrawHideForPlayer(playerid,txtTierraRobada);
  126. RegistrationStep[playerid] = 0;
  127. PlayerInfo[playerid][pTut] = 1;
  128. gOoc[playerid] = 0; gNews[playerid] = 0;
  129. TogglePlayerControllable(playerid, 1);
  130. SetCamBack(playerid);
  131. DeletePVar(playerid, "MedicBill");
  132. SetPlayerColor(playerid,TEAM_HIT_COLOR);
  133. SetPlayerInterior(playerid,0);
  134. SetHealth(playerid, 100);
  135. for(new x;x<10000;x++)
  136. {
  137. new rand=random(300);
  138. if(PlayerInfo[playerid][pSex] == 2)
  139. {
  140. if(IsValidSkin(rand) && IsFemaleSpawnSkin(rand))
  141. {
  142. PlayerInfo[playerid][pModel] = rand;
  143. SetPlayerSkin(playerid, rand);
  144. break;
  145. }
  146. }
  147. else
  148. {
  149. if(IsValidSkin(rand) && !IsFemaleSkin(rand))
  150. {
  151. PlayerInfo[playerid][pModel] = rand;
  152. SetPlayerSkin(playerid, rand);
  153. break;
  154. }
  155. }
  156. }
  157. SetCameraBehindPlayer(playerid);
  158. SetPlayerVirtualWorld(playerid, 0);
  159. if(NATION_SAN_ANDREAS == PlayerNationSelection[playerid])
  160. {
  161. PlayerInfo[playerid][pNation] = 0;
  162. switch(random(2))
  163. {
  164. case 0:
  165. {
  166. SetPlayerPos(playerid, 1715.1201,-1903.1711,13.5665);
  167. SetPlayerFacingAngle(playerid, 360.0);
  168. }
  169. case 1:
  170. {
  171. SetPlayerPos(playerid, -1969.0737,138.1210,27.6875);
  172. SetPlayerFacingAngle(playerid, 90.0);
  173. }
  174. }
  175. }
  176. else if(NATION_TIERRA_ROBADA == PlayerNationSelection[playerid])
  177. {
  178. if(floatround(diff) >= 30)
  179. {
  180. AddNationQueue(playerid, 1, 1);
  181. SendClientMessageEx(playerid, COLOR_RED, "The nation of New Robada is currently full. You have been placed into a queue to join.");
  182. switch(random(2))
  183. {
  184. case 0:
  185. {
  186. SetPlayerPos(playerid, 1715.1201,-1903.1711,13.5665);
  187. SetPlayerFacingAngle(playerid, 360.0);
  188. }
  189. case 1:
  190. {
  191. SetPlayerPos(playerid, -1969.0737,138.1210,27.6875);
  192. SetPlayerFacingAngle(playerid, 90.0);
  193. }
  194. }
  195. }
  196. else
  197. {
  198. AddNationQueue(playerid, 1, 2);
  199. switch(random(2))
  200. {
  201. case 0:
  202. {
  203. SetPlayerPos(playerid, 1699.2, 1435.1, 10.7);
  204. SetPlayerFacingAngle(playerid, 270.0);
  205. }
  206. case 1:
  207. {
  208. SetPlayerPos(playerid, -1446.5997, 2608.4478, 55.8359);
  209. SetPlayerFacingAngle(playerid, 180.0);
  210. }
  211. }
  212. }
  213. }
  214. return;
  215. }
  216. if(lr > 0) {
  217. NationSel_SwitchToNextNation(playerid);
  218. }
  219. else if(lr < 0) {
  220. NationSel_SwitchToPrevNation(playerid);
  221. }
  222. }*/
  223. stock NationCheck(playerid, giveplayerid) {
  224. if(PlayerInfo[playerid][pNation] != PlayerInfo[giveplayerid][pNation]) {
  225. SendClientMessageEx(playerid, COLOR_GRAD1, "This person is not part of your nation and can therefore not be processed.");
  226. return 0;
  227. }
  228. return 1;
  229. }
  230. stock GetPlayerNation(playerid) {
  231. szMiscArray[0] = 0;
  232. switch(PlayerInfo[playerid][pNation]) {
  233. case 0: szMiscArray = "San Andreas";
  234. case 1: szMiscArray = "New Robada";
  235. case 2: szMiscArray = "None";
  236. }
  237. return szMiscArray;
  238. }
  239. CMD:apply(playerid, params[])
  240. {
  241. new choice[3];
  242. if(sscanf(params, "s[3]", choice))
  243. {
  244. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /apply [SA|NR]");
  245. return 1;
  246. }
  247. if(PlayerInfo[playerid][pFreezeBank] || PlayerInfo[playerid][pFreezeHouse] || PlayerInfo[playerid][pFreezeCar]) {
  248. return SendClientMessageEx(playerid, COLOR_GRAD1, "The current nation you're in has frozen your assets. Therefore, you cannot apply.");
  249. }
  250. if(strcmp(choice, "sa", true) == 0)
  251. {
  252. if(PlayerInfo[playerid][pNation] == 0) return SendClientMessageEx(playerid, COLOR_GREY, "You're currently part of San Andreas.");
  253. CheckNationQueue(playerid, 0);
  254. }
  255. else if(strcmp(choice, "nr", true) == 0)
  256. {
  257. if(PlayerInfo[playerid][pNation] == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You're currently part of New Robada.");
  258. CheckNationQueue(playerid, 1);
  259. }
  260. return 1;
  261. }
  262. CMD:checkapps(playerid, params[])
  263. {
  264. if((0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS) && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV)
  265. {
  266. switch(arrGroupData[PlayerInfo[playerid][pMember]][g_iAllegiance])
  267. {
  268. case 1: mysql_tquery(MainPipeline, "SELECT `playerid`, `name`, `date` FROM `nation_queue` WHERE `nation` = 0 AND `status` = 1 ORDER BY `id` ASC", "NationQueueQueryFinish", "iii", playerid, 0, AppQueue);
  269. case 2: mysql_tquery(MainPipeline, "SELECT `playerid`, `name`, `date` FROM `nation_queue` WHERE `nation` = 1 AND `status` = 1 ORDER BY `id` ASC", "NationQueueQueryFinish", "iii", playerid, 1, AppQueue);
  270. }
  271. }
  272. else SendClientMessage(playerid, COLOR_GREY, "You are not the leader of a Government agency.");
  273. return 1;
  274. }
  275. CMD:deport(playerid, params[])
  276. {
  277. if((0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS) && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV)
  278. {
  279. new string[128], giveplayerid;
  280. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deport [player]");
  281. if(!IsPlayerConnected(giveplayerid)) SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  282. else if(!ProxDetectorS(5.0, playerid, giveplayerid)) SendClientMessageEx(playerid, COLOR_GREY, "You are not close enough to the deportee.");
  283. else if(PlayerInfo[playerid][pNation] == 0 && PlayerInfo[giveplayerid][pNation] == 0) SendClientMessageEx(playerid, COLOR_GREY, "You can't deport a citizen of San Andreas!");
  284. else
  285. {
  286. format(string, sizeof(string), "* You deported %s!", GetPlayerNameEx(giveplayerid));
  287. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  288. DeletePVar(giveplayerid, "IsFrozen");
  289. TogglePlayerControllable(giveplayerid, 1);
  290. ClearAnimationsEx(giveplayerid);
  291. SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
  292. PlayerCuffed[giveplayerid] = 0;
  293. DeletePVar(giveplayerid, "PlayerCuffed");
  294. PlayerCuffedTime[giveplayerid] = 0;
  295. if(PlayerInfo[playerid][pNation] == 0 && PlayerInfo[giveplayerid][pNation] == 1)
  296. {
  297. switch(random(2))
  298. {
  299. case 0:
  300. {
  301. SetPlayerPos(giveplayerid, 2231.578613, -48.729660, 26.484375);
  302. SetPlayerFacingAngle(giveplayerid, 270.0);
  303. }
  304. case 1:
  305. {
  306. SetPlayerPos(giveplayerid, 2231.578613, -48.729660, 26.484375);
  307. SetPlayerFacingAngle(giveplayerid, 180.0);
  308. }
  309. }
  310. SendClientMessageEx(giveplayerid, COLOR_RED, "You have been deported back to New Robada.");
  311. }
  312. else if(PlayerInfo[playerid][pNation] == 1 && PlayerInfo[giveplayerid][pNation] == 0)
  313. {
  314. switch(random(2))
  315. {
  316. case 0:
  317. {
  318. SetPlayerPos(giveplayerid, 1715.1201,-1903.1711,13.5665);
  319. SetPlayerFacingAngle(giveplayerid, 360.0);
  320. }
  321. case 1:
  322. {
  323. SetPlayerPos(giveplayerid, -1969.0737,138.1210,27.6875);
  324. SetPlayerFacingAngle(giveplayerid, 90.0);
  325. }
  326. }
  327. SendClientMessageEx(giveplayerid, COLOR_RED, "You have been deported back to San Andreas.");
  328. }
  329. else if(PlayerInfo[playerid][pNation] == 0 && PlayerInfo[giveplayerid][pNation] == 0)
  330. {
  331. switch(random(2))
  332. {
  333. case 0:
  334. {
  335. SetPlayerPos(giveplayerid, 1715.1201,-1903.1711,13.5665);
  336. SetPlayerFacingAngle(giveplayerid, 360.0);
  337. }
  338. case 1:
  339. {
  340. SetPlayerPos(giveplayerid, -1969.0737,138.1210,27.6875);
  341. SetPlayerFacingAngle(giveplayerid, 90.0);
  342. }
  343. }
  344. PlayerInfo[giveplayerid][pNation] = 2;
  345. SendClientMessageEx(giveplayerid, COLOR_RED, "You were deported from your country. You have lost your citizenship.");
  346. }
  347. else if(PlayerInfo[playerid][pNation] == 1 && PlayerInfo[giveplayerid][pNation] == 1)
  348. {
  349. switch(random(2))
  350. {
  351. case 0:
  352. {
  353. SetPlayerPos(giveplayerid, 1715.1201,-1903.1711,13.5665);
  354. SetPlayerFacingAngle(giveplayerid, 360.0);
  355. }
  356. case 1:
  357. {
  358. SetPlayerPos(giveplayerid, -1969.0737,138.1210,27.6875);
  359. SetPlayerFacingAngle(giveplayerid, 90.0);
  360. }
  361. }
  362. PlayerInfo[giveplayerid][pNation] = 2;
  363. SendClientMessageEx(giveplayerid, COLOR_RED, "You were deported from your country. You have lost your citizenship.");
  364. }
  365. }
  366. }
  367. else SendClientMessage(playerid, COLOR_GREY, "You are not the leader of a Government agency.");
  368. return 1;
  369. }
  370. // Citizenship Commands
  371. /*CMD:grantcitizenship(playerid, params[]) {
  372. new iGroupID = PlayerInfo[playerid][pLeader];
  373. if((0 <= iGroupID < MAX_GROUPS)) {
  374. }
  375. else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
  376. return 1;
  377. }*/