skins_core.inc 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /*
  2. file: customs_skins/core.inc
  3. description: The custom skin registration system.
  4. author: Jay Cortez
  5. date created: 28th March 2018
  6. */
  7. /*
  8. NOTE TO THE PERSON WHO MAKES ANY CHANGE IN THIS FILE.
  9. If you add or remove a RegisterCustomSkin(); Please make sure to keep note of the next free ID.
  10. In-between Free IDs: 20021, 20022, 20023
  11. Next free ID in series: 20068 >
  12. */
  13. #include "inc/custom_skins/array.inc"
  14. #define SKIN_SHOP_MENU 20
  15. #define SKIN_SHOP_PRICE 500
  16. // Types of custom skins
  17. enum {
  18. CUSTOM_SKIN_TYPE_PUBLIC,
  19. CUSTOM_SKIN_TYPE_FACTION,
  20. CUSTOM_SKIN_TYPE_GROUP,
  21. CUSTOM_SKIN_TYPE_DONOR
  22. }
  23. /*
  24. Register all skins you add to the server here.
  25. Please keep this as organized as possible.
  26. Examples:
  27. > RegisterCustomSkin(20001, CUSTOM_SKIN_TYPE_PUBLIC);
  28. // Registers skin ID 20001 to the public
  29. > RegisterCustomSkin(20080, CUSTOM_SKIN_TYPE_FACTION, FACTION_FMD);
  30. // Registers skin ID 20080 to the SAFMD faction (all ranks can use it)
  31. > RegisterCustomSkin(20003, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD, 3);
  32. // Registers skin ID 20003 to the SAPD faction (rank 3 and above can use it)
  33. > RegisterCustomSkin(20006, CUSTOM_SKIN_TYPE_GROUP, GROUP_HITMAN);
  34. // Registers skin ID 20006 to the Hitman group
  35. > RegisterCustomSkin(20009, CUSTOM_SKIN_TYPE_GROUP, GROUP_CRIME, 2);
  36. // Registers skin ID 20009 to the crime group (rank 2 and above can use it)
  37. > RegisterCustomSkin(20011, CUSTOM_SKIN_TYPE_DONOR, 7379);
  38. // Registers skin ID 20011 to the player with SQL ID 7379
  39. */
  40. /*
  41. 20063 unused
  42. 65 70 71 72 too
  43. */
  44. Hook:skins_OnGameModeInit() {
  45. // Public skins
  46. RegisterCustomSkin(20001, CUSTOM_SKIN_TYPE_PUBLIC);
  47. RegisterCustomSkin(20002, CUSTOM_SKIN_TYPE_PUBLIC);
  48. RegisterCustomSkin(20003, CUSTOM_SKIN_TYPE_PUBLIC);
  49. RegisterCustomSkin(20004, CUSTOM_SKIN_TYPE_PUBLIC);
  50. RegisterCustomSkin(20005, CUSTOM_SKIN_TYPE_PUBLIC);
  51. RegisterCustomSkin(20006, CUSTOM_SKIN_TYPE_PUBLIC);
  52. RegisterCustomSkin(20007, CUSTOM_SKIN_TYPE_PUBLIC);
  53. RegisterCustomSkin(20008, CUSTOM_SKIN_TYPE_PUBLIC);
  54. RegisterCustomSkin(20093, CUSTOM_SKIN_TYPE_PUBLIC);
  55. RegisterCustomSkin(20103, CUSTOM_SKIN_TYPE_PUBLIC);
  56. RegisterCustomSkin(20104, CUSTOM_SKIN_TYPE_PUBLIC);
  57. RegisterCustomSkin(20105, CUSTOM_SKIN_TYPE_PUBLIC);
  58. RegisterCustomSkin(20106, CUSTOM_SKIN_TYPE_PUBLIC);
  59. RegisterCustomSkin(20107, CUSTOM_SKIN_TYPE_PUBLIC);
  60. RegisterCustomSkin(20108, CUSTOM_SKIN_TYPE_PUBLIC);
  61. RegisterCustomSkin(20109, CUSTOM_SKIN_TYPE_PUBLIC);
  62. // SAFMD skins
  63. RegisterCustomSkin(20009, CUSTOM_SKIN_TYPE_FACTION, FACTION_FMD);
  64. RegisterCustomSkin(20010, CUSTOM_SKIN_TYPE_FACTION, FACTION_FMD);
  65. RegisterCustomSkin(20011, CUSTOM_SKIN_TYPE_FACTION, FACTION_FMD);
  66. RegisterCustomSkin(20097, CUSTOM_SKIN_TYPE_FACTION, FACTION_FMD);
  67. // SAPD skins
  68. RegisterCustomSkin(20012, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  69. RegisterCustomSkin(20013, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  70. RegisterCustomSkin(20014, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  71. RegisterCustomSkin(20015, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  72. RegisterCustomSkin(20016, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  73. RegisterCustomSkin(20017, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  74. //RegisterCustomSkin(20063, CUSTOM_SKIN_TYPE_FACTION, FACTION_SAPD);
  75. // FBI skins
  76. RegisterCustomSkin(20018, CUSTOM_SKIN_TYPE_FACTION, FACTION_FBI);
  77. RegisterCustomSkin(20044, CUSTOM_SKIN_TYPE_FACTION, FACTION_FBI);
  78. RegisterCustomSkin(20045, CUSTOM_SKIN_TYPE_FACTION, FACTION_FBI);
  79. RegisterCustomSkin(20046, CUSTOM_SKIN_TYPE_FACTION, FACTION_FBI);
  80. RegisterCustomSkin(20088, CUSTOM_SKIN_TYPE_FACTION, FACTION_FBI);
  81. // CJNG Skins
  82. RegisterCustomSkin(20098, CUSTOM_SKIN_TYPE_GROUP, GROUP_CARTEL);
  83. // Tijuana Cartel group skins (donated)
  84. /* Female skin - p-rp.xyz */
  85. RegisterCustomSkin(20020, CUSTOM_SKIN_TYPE_GROUP, GROUP_TIJUANA);
  86. /* Tijuana Cartel Group Skin - */
  87. RegisterCustomSkin(20061, CUSTOM_SKIN_TYPE_GROUP, GROUP_TIJUANA);
  88. /* - */
  89. RegisterCustomSkin(20024, CUSTOM_SKIN_TYPE_DONOR, 170751); // His player account
  90. RegisterCustomSkin(20024, CUSTOM_SKIN_TYPE_DONOR, 186548); // His admin account
  91. /* Chris Ta - */
  92. RegisterCustomSkin(20025, CUSTOM_SKIN_TYPE_DONOR, 13843);
  93. /* Chris Ta - http://www.gta-sarp.com/forums/showthread.php?288630 */
  94. RegisterCustomSkin(20026, CUSTOM_SKIN_TYPE_DONOR, 8075);
  95. /* Roscoe Jarvis - Got it for being an official modder */
  96. RegisterCustomSkin(20027, CUSTOM_SKIN_TYPE_DONOR, 60274);
  97. /* Casper Holstein - http://www.gta-sarp.com/forums/showthread.php?290760 */
  98. RegisterCustomSkin(20028, CUSTOM_SKIN_TYPE_DONOR, 19791);
  99. /* Jimmy Ta - http://www.gta-sarp.com/forums/showthread.php?292129 */
  100. RegisterCustomSkin(20029, CUSTOM_SKIN_TYPE_DONOR, 312);
  101. /* Carlos Alcazar - http://www.gta-sarp.com/forums/showthread.php?292069 */
  102. RegisterCustomSkin(20030, CUSTOM_SKIN_TYPE_DONOR, 82903);
  103. /* Mary Oswald's skin */
  104. RegisterCustomSkin(20031, CUSTOM_SKIN_TYPE_DONOR, 7381);
  105. RegisterCustomSkin(20096, CUSTOM_SKIN_TYPE_DONOR, 7381);
  106. /* Chris Sanchez - http://www.gta-sarp.com/forums/showthread.php?292281 */
  107. RegisterCustomSkin(20032, CUSTOM_SKIN_TYPE_DONOR, 181598);
  108. /* Dixie Banton - http://www.gta-sarp.com/forums/showthread.php?292458 */
  109. RegisterCustomSkin(20033, CUSTOM_SKIN_TYPE_DONOR, 5920);
  110. /* Rodrigo Sosa - http://www.gta-sarp.com/forums/showthread.php?293673 */
  111. RegisterCustomSkin(20035, CUSTOM_SKIN_TYPE_DONOR, 185225);
  112. /* Armando Sosa - http://www.gta-sarp.com/forums/showthread.php?293770 */
  113. RegisterCustomSkin(20036, CUSTOM_SKIN_TYPE_DONOR, 8075);
  114. /* Tatyana Nowak - http://www.gta-sarp.com/forums/showthread.php?292834-Development-Related-Tatyana_Nowak-s-Request */
  115. RegisterCustomSkin(20037, CUSTOM_SKIN_TYPE_DONOR, 191172);
  116. /* Donald Crooks - http://www.gta-sarp.com/forums/showthread.php?293922 */
  117. RegisterCustomSkin(20038, CUSTOM_SKIN_TYPE_DONOR, 475);
  118. /* Claude West - http://www.gta-sarp.com/forums/showthread.php?294789 */
  119. RegisterCustomSkin(20039, CUSTOM_SKIN_TYPE_DONOR, 178970);
  120. /* Reece Sawano - http://www.gta-sarp.com/forums/showthread.php?295519 */
  121. RegisterCustomSkin(20040, CUSTOM_SKIN_TYPE_DONOR, 92920);
  122. /* Sean Johnson - http://www.gta-sarp.com/forums/showthread.php?295495 */
  123. RegisterCustomSkin(20041, CUSTOM_SKIN_TYPE_DONOR, 859);
  124. /* Chris Ta - http://www.gta-sarp.com/forums/showthread.php?295072 */
  125. RegisterCustomSkin(20042, CUSTOM_SKIN_TYPE_DONOR, 13843);
  126. /* Aaron Steel - (Will add link)*/
  127. RegisterCustomSkin(20043, CUSTOM_SKIN_TYPE_DONOR, 152639);
  128. /* Pooya - Given for all his hard work */
  129. RegisterCustomSkin(20047, CUSTOM_SKIN_TYPE_DONOR, 140405);
  130. /* Skarr Torino - http://www.gta-sarp.com/forums/showthread.php?294594 */
  131. RegisterCustomSkin(20048, CUSTOM_SKIN_TYPE_DONOR, 1118);
  132. /* Jerrelle_Mackenzie - http://www.gta-sarp.com/forums/showthread.php?295611-Game-Related-Jerrelle_Mackenzie-s-Request */
  133. RegisterCustomSkin(20049, CUSTOM_SKIN_TYPE_DONOR, 26660);
  134. /* Jesus_Salonga - http://www.gta-sarp.com/forums/showthread.php?295391-Game-Related-Jesus_Salonga-s-Request */
  135. RegisterCustomSkin(20050, CUSTOM_SKIN_TYPE_DONOR, 174017);
  136. /* Aaron_Steel - http://www.gta-sarp.com/forums/showthread.php?295652-Game-Related-Aaron_Steel-s-Request */
  137. RegisterCustomSkin(20051, CUSTOM_SKIN_TYPE_DONOR, 152639);
  138. /* Aaron Steel - http://www.gta-sarp.com/forums/showthread.php?294598 */
  139. RegisterCustomSkin(20052, CUSTOM_SKIN_TYPE_DONOR, 152639);
  140. /* Chris Ta - http://www.gta-sarp.com/forums/showthread.php?293378-Game-Related-Chris_Ta-s-Request */
  141. RegisterCustomSkin(20053, CUSTOM_SKIN_TYPE_DONOR, 13843);
  142. /* Chris Ta - http://www.gta-sarp.com/forums/showthread.php?293378-Game-Related-Chris_Ta-s-Request */
  143. RegisterCustomSkin(20054, CUSTOM_SKIN_TYPE_DONOR, 13843);
  144. /* Aaron Steel - http://www.gta-sarp.com/forums/showthread.php?294598 */
  145. RegisterCustomSkin(20055, CUSTOM_SKIN_TYPE_DONOR, 152639);
  146. /* Zherdev OPG (Rebels MC) - http://www.gta-sarp.com/forums/showthread.php?295626-Game-Related-Nikolai_Borodin-s-Request */
  147. RegisterCustomSkin(20056, CUSTOM_SKIN_TYPE_GROUP, GROUP_CARTEL);
  148. /* Thomas Teressi - http://www.gta-sarp.com/forums/showthread.php?292422-Game-Related-Thomas_Teressi-s-Request */
  149. RegisterCustomSkin(20057, CUSTOM_SKIN_TYPE_DONOR, 127908);
  150. /* Chris Ta - http://www.gta-sarp.com/forums/showthread.php?295961-Game-Related-Chris_Ta-s-Request */
  151. RegisterCustomSkin(20058, CUSTOM_SKIN_TYPE_DONOR, 13843);
  152. /* Tatyana_Nowak - http://www.gta-sarp.com/forums/showthread.php?292913-Shop-Related-Tatyana_Nowak-s-Request */
  153. RegisterCustomSkin(20059, CUSTOM_SKIN_TYPE_DONOR, 191172);
  154. RegisterCustomSkin(20060, CUSTOM_SKIN_TYPE_DONOR, 191172);
  155. RegisterCustomSkin(20062, CUSTOM_SKIN_TYPE_GROUP, GROUP_TIJUANA);
  156. //http://www.gta-sarp.com/forums/showthread.php?299095-Development-Related-Casper_Holstein-s-Request
  157. RegisterCustomSkin(20064, CUSTOM_SKIN_TYPE_DONOR, 19791);
  158. RegisterCustomSkin(20065, CUSTOM_SKIN_TYPE_DONOR, 19791);
  159. /* S9 Group skin - http://www.gta-sarp.com/forums/showthread.php?298172-Development-Related-Lance_Rizzi-s-Request */
  160. RegisterCustomSkin(20066, CUSTOM_SKIN_TYPE_GROUP, GROUP_S9);
  161. /* Emily Erosel - http://www.gta-sarp.com/forums/showthread.php?297592-Development-Related-Emily_Erosel-s-Request */
  162. RegisterCustomSkin(20067, CUSTOM_SKIN_TYPE_DONOR, 7516);
  163. RegisterCustomSkin(20068, CUSTOM_SKIN_TYPE_DONOR, 372); // Ren Rosetti donor skin
  164. RegisterCustomSkin(20069, CUSTOM_SKIN_TYPE_DONOR, 30420); // Jay Destiny donor skin
  165. // SANG //
  166. RegisterCustomSkin(20073, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  167. RegisterCustomSkin(20074, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  168. RegisterCustomSkin(20075, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  169. RegisterCustomSkin(20076, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  170. RegisterCustomSkin(20077, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  171. RegisterCustomSkin(20078, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  172. RegisterCustomSkin(20079, CUSTOM_SKIN_TYPE_FACTION, FACTION_SANG);
  173. /* Manuel_Delgado - http://www.gta-sarp.com/forums/member.php?57715-Antwan_Brooks*/
  174. RegisterCustomSkin(20080, CUSTOM_SKIN_TYPE_DONOR, 48583);
  175. /* Aaron Steel Skin - check previous skins for link*/
  176. RegisterCustomSkin(20081, CUSTOM_SKIN_TYPE_DONOR, 152639);
  177. /* Aaron Steel - http://www.gta-sarp.com/forums/showthread.php?302639-Game-Related-Aaron_Steel-s-Request */
  178. RegisterCustomSkin(20082, CUSTOM_SKIN_TYPE_DONOR, 152639);
  179. RegisterCustomSkin(20083, CUSTOM_SKIN_TYPE_GROUP, GROUP_HITMAN);
  180. RegisterCustomSkin(20084, CUSTOM_SKIN_TYPE_GROUP, GROUP_HITMAN);
  181. /* Steven Royce */
  182. RegisterCustomSkin(20086, CUSTOM_SKIN_TYPE_DONOR, 7385);
  183. RegisterCustomSkin(20087, CUSTOM_SKIN_TYPE_DONOR, 7385);
  184. /* Christian Collins */
  185. RegisterCustomSkin(20089, CUSTOM_SKIN_TYPE_DONOR, 7397);
  186. /* SQL 7439 */
  187. RegisterCustomSkin(20090, CUSTOM_SKIN_TYPE_DONOR, 7408);
  188. RegisterCustomSkin(20092, CUSTOM_SKIN_TYPE_DONOR, 7381);
  189. /* Dominic Heimdall's skin */
  190. RegisterCustomSkin(20099, CUSTOM_SKIN_TYPE_DONOR, 7388);
  191. RegisterCustomSkin(20110, CUSTOM_SKIN_TYPE_DONOR, 7388);
  192. /* Rose Cassdiy skin */
  193. RegisterCustomSkin(20100, CUSTOM_SKIN_TYPE_DONOR, 7582);
  194. RegisterCustomSkin(20101, CUSTOM_SKIN_TYPE_DONOR, 7582);
  195. RegisterCustomSkin(20102, CUSTOM_SKIN_TYPE_DONOR, 7582);
  196. /* Millhouse skins */
  197. RegisterCustomSkin(20111, CUSTOM_SKIN_TYPE_DONOR, 7441);
  198. /* Richie Townes */
  199. RegisterCustomSkin(20112, CUSTOM_SKIN_TYPE_DONOR, 7408);
  200. /* Josh Steel's custom skin by Shadow */
  201. RegisterCustomSkin(20113, CUSTOM_SKIN_TYPE_DONOR, 7742);
  202. /* Rocco's custom skin by Shadow */
  203. RegisterCustomSkin(20114, CUSTOM_SKIN_TYPE_DONOR, 7762);
  204. RegisterCustomSkin(20115, CUSTOM_SKIN_TYPE_DONOR, 7762);
  205. RegisterCustomSkin(20117, CUSTOM_SKIN_TYPE_DONOR, 7747); //ANTHONY
  206. RegisterCustomSkin(20118, CUSTOM_SKIN_TYPE_GROUP, 9); //jaxy playa's group skin
  207. RegisterCustomSkin(20120, CUSTOM_SKIN_TYPE_FACTION, 7); //Judicial dept skin
  208. RegisterCustomSkin(20121, CUSTOM_SKIN_TYPE_GROUP, 10); //Wermacht
  209. RegisterCustomSkin(20122, CUSTOM_SKIN_TYPE_GROUP, 10); //Wermacht
  210. RegisterCustomSkin(20123, CUSTOM_SKIN_TYPE_GROUP, 10); //Wermacht
  211. RegisterCustomSkin(20124, CUSTOM_SKIN_TYPE_GROUP, 10); //Wermacht
  212. RegisterCustomSkin(20125, CUSTOM_SKIN_TYPE_DONOR, 7516);
  213. RegisterCustomSkin(20126, CUSTOM_SKIN_TYPE_DONOR, 7516);
  214. //RegisterCustomSkin(20127, CUSTOM_SKIN_TYPE_DONOR, 7742);
  215. RegisterCustomSkin(20130, CUSTOM_SKIN_TYPE_DONOR, 7541);
  216. }
  217. // Set variables on connect
  218. new bool:skinShopFree[MAX_PLAYERS],
  219. lastEquippedCSkin[MAX_PLAYERS];
  220. Hook:skins_OnPlayerConnect(playerid) {
  221. skinShopFree[playerid] = false;
  222. lastEquippedCSkin[playerid] = gettime();
  223. }
  224. // Checks if the player is allowed to wear a certain skin
  225. IsAllowedSkin(playerid, id) {
  226. if(!CustomSkin[id][cs_Used])
  227. return false;
  228. new skinType = CustomSkin[id][cs_SkinType];
  229. // Public skin
  230. if(skinType == CUSTOM_SKIN_TYPE_PUBLIC) return true;
  231. // Faction restricted skin
  232. else if(skinType == CUSTOM_SKIN_TYPE_FACTION) {
  233. if(PlayerInfo[playerid][pMember] == FACTION_S9) return true;
  234. if(PlayerInfo[playerid][pMember] != CustomSkin[id][cs_Meta1])
  235. return false;
  236. if(PlayerInfo[playerid][pRank] < CustomSkin[id][cs_Meta2])
  237. return false;
  238. return true;
  239. }
  240. // Group restricted skin
  241. else if(skinType == CUSTOM_SKIN_TYPE_GROUP) {
  242. if(PlayerInfo[playerid][pGroup] != CustomSkin[id][cs_Meta1])
  243. return false;
  244. if(PlayerInfo[playerid][pGroupRank] < CustomSkin[id][cs_Meta2])
  245. return false;
  246. return true;
  247. }
  248. // Donor restricted skin
  249. else if(skinType == CUSTOM_SKIN_TYPE_DONOR) {
  250. if(PlayerInfo[playerid][pID] != CustomSkin[id][cs_Meta1])
  251. return false;
  252. return true;
  253. }
  254. return true;
  255. }
  256. // Registers a skin
  257. RegisterCustomSkin(skinID, skinType, skinMeta1 = 0, skinMeta2 = 0) {
  258. new skID = -1;
  259. // Find a free ID
  260. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  261. if(!CustomSkin[i][cs_Used]) {
  262. skID = i;
  263. break;
  264. }
  265. }
  266. // No free ID was found
  267. if(skID == -1) {
  268. printf("[Custom Skins] A skin failed to register.");
  269. return false;
  270. }
  271. CustomSkin[skID][cs_Used] = true;
  272. CustomSkin[skID][cs_SkinID] = skinID;
  273. CustomSkin[skID][cs_SkinType] = skinType;
  274. CustomSkin[skID][cs_Meta1] = skinMeta1;
  275. CustomSkin[skID][cs_Meta2] = skinMeta2;
  276. /*printf("[Custom Skins] Registered: skin ID %i, type: %i.",
  277. skinID,
  278. skinType
  279. );*/
  280. return true;
  281. }
  282. // Checks if a SAMP default skin is a civilian skin or not
  283. IsACivilianSkin(skinID) {
  284. switch(skinID) {
  285. case 71: return false;
  286. case 74: return false;
  287. case 165 .. 166: return false;
  288. case 265 .. 267: return false;
  289. case 274 .. 288: return false;
  290. case 300 .. 302: return false;
  291. case 306 .. 311: return false;
  292. }
  293. return true;
  294. }
  295. // Checks if a SAMP default skin is a cop skin or not
  296. IsACopSkin(skinID) {
  297. switch(skinID) {
  298. case 71: return true;
  299. case 280 .. 285: return true;
  300. case 288: return true;
  301. case 300 .. 302: return true;
  302. case 306 .. 307: return true;
  303. case 309 .. 311: return true;
  304. }
  305. return false;
  306. }
  307. // Checks if a SAMP default skin is a FBI skin or not
  308. IsAFBISkin(skinID) {
  309. switch(skinID) {
  310. case 286: return true;
  311. }
  312. return false;
  313. }
  314. // Checks if a SAMP default skin is a medic skin or not
  315. IsAMedicSkin(skinID) {
  316. switch(skinID) {
  317. case 274 .. 279: return true;
  318. case 308: return true;
  319. }
  320. return false;
  321. }
  322. // Checks if a SAMP default skin is a government skin or not
  323. IsAGovSkin(skinID) {
  324. switch(skinID) {
  325. case 165 .. 166: return true;
  326. case 17: return true;
  327. case 111: return true;
  328. case 228: return true;
  329. }
  330. return false;
  331. }
  332. // Checks if a SAMP default skin is a JD skin or not
  333. IsAJDSkin(skinID) {
  334. switch(skinID) {
  335. case 165 .. 166: return true;
  336. }
  337. return false;
  338. }
  339. IsANGSkin(skinID) {
  340. switch(skinID) {
  341. case 287: return true;
  342. case 191: return true;
  343. }
  344. return false;
  345. }
  346. // Checks if the given skin ID is a restricted skin
  347. isRestrictedModel(skinID) {
  348. return (
  349. IsAGovSkin(skinID) ||
  350. IsAMedicSkin(skinID) ||
  351. IsAFBISkin(skinID) ||
  352. IsACopSkin(skinID)
  353. );
  354. }
  355. // Shows the skin shop to a player
  356. ShowSkinShop(
  357. playerid,
  358. bool:incCivilianSkins = true, // Should the skin shop include civilian skins?
  359. bool:incFactionSkins = false, // Should the skin shop include faction skins?
  360. bool:incGroupSkins = false, // Should the skin shop include group skins?
  361. bool:incDonorSkins = false, // Should the skin shop include donor skins?
  362. bool:allFree = false // Should the items in the skin shop be free?
  363. ) {
  364. new skinsArr[mS_CUSTOM_MAX_ITEMS], amountToshow = 0;
  365. // Default SAMP skins
  366. for(new i = 1; i < 311; i++) {
  367. // Civilian skins
  368. if(incCivilianSkins && IsACivilianSkin(i)) {
  369. skinsArr[amountToshow] = i;
  370. amountToshow++;
  371. continue;
  372. }
  373. // Faction skins
  374. if(incFactionSkins) {
  375. if(
  376. // Perform the check for S9 first. If the player isn't S9 then show only their faction skin.
  377. PlayerInfo[playerid][pMember] == FACTION_S9 ||
  378. ((IsACop(playerid) && IsACopSkin(i)) ||
  379. (IsAFBI(playerid) && IsAFBISkin(i)) ||
  380. (IsAMedic(playerid) && IsAMedicSkin(i)) ||
  381. (IsASenate(playerid) && IsAGovSkin(i))) ||
  382. (IsAJudge(playerid) && IsAJDSkin(i)) ||
  383. (IsASANG(playerid) && IsANGSkin(i))
  384. ) {
  385. skinsArr[amountToshow] = i;
  386. amountToshow++;
  387. continue;
  388. }
  389. }
  390. }
  391. // Add all the necessary custom skins
  392. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  393. if( !CustomSkin[i][cs_Used] ||
  394. !IsAllowedSkin(playerid, i)
  395. ) continue;
  396. // Add civilian skin
  397. if(incCivilianSkins && CustomSkin[i][cs_SkinType] == CUSTOM_SKIN_TYPE_PUBLIC)
  398. skinsArr[amountToshow] = CustomSkin[i][cs_SkinID];
  399. // Add faction skin
  400. else if(incFactionSkins && CustomSkin[i][cs_SkinType] == CUSTOM_SKIN_TYPE_FACTION)
  401. skinsArr[amountToshow] = CustomSkin[i][cs_SkinID];
  402. // Add group skin
  403. else if(incGroupSkins && CustomSkin[i][cs_SkinType] == CUSTOM_SKIN_TYPE_GROUP)
  404. skinsArr[amountToshow] = CustomSkin[i][cs_SkinID];
  405. // Add donor skin
  406. else if(incDonorSkins && CustomSkin[i][cs_SkinType] == CUSTOM_SKIN_TYPE_DONOR)
  407. skinsArr[amountToshow] = CustomSkin[i][cs_SkinID];
  408. else continue;
  409. amountToshow++;
  410. }
  411. skinShopFree[playerid] = allFree;
  412. if(!allFree) {
  413. new skinStr[128];
  414. format(skinStr, sizeof(skinStr), "* A new outfit will cost you $%i.", SKIN_SHOP_PRICE);
  415. SendClientMessage(playerid, COLOR_LIGHTBLUE, skinStr);
  416. }
  417. ShowModelSelectionMenuEx(playerid, skinsArr, amountToshow, "", SKIN_SHOP_MENU, 0.0, 0.0, 0.0, 1.0, 0x404240BB, 0x6e726e99);
  418. //ShowModelSelectionMenuEx(playerid, skinsArr, amountToshow, "", SKIN_SHOP_MENU);
  419. return bool:(amountToshow > 0);
  420. }
  421. // Called on model selection response
  422. skins_OnPlayerModelSelectionEx(playerid, response, extraid, modelid) {
  423. if(!response || extraid != SKIN_SHOP_MENU) return false;
  424. if(!skinShopFree[playerid]) {
  425. if(PlayerInfo[playerid][pCash] < SKIN_SHOP_PRICE)
  426. return SendClientMessage(playerid, COLOR_GREY, "You cannot afford a new outfit.");
  427. // Take the money
  428. GiveMoney(playerid, -SKIN_SHOP_PRICE);
  429. // Add money to the business
  430. new clStore = GetPlayerVirtualWorld(playerid);
  431. BizInfo[clStore][bTill] += SKIN_SHOP_PRICE;
  432. BizInfo[clStore][bProducts]--;
  433. // Send info message
  434. new skinStr[128];
  435. format(skinStr, sizeof(skinStr), "* You have paid $%i for your new outfit.", SKIN_SHOP_PRICE);
  436. SendClientMessage(playerid, COLOR_LIGHTBLUE, skinStr);
  437. }
  438. else SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have put on a new outift.");
  439. // Set the new skin
  440. SetPlayerSkin(playerid, modelid);
  441. PlayerInfo[playerid][pModel] = modelid;
  442. PlayerInfo[playerid][pClothes] = 0;
  443. // If it's one of their custom skins
  444. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  445. if( !CustomSkin[i][cs_Used] ||
  446. !IsAllowedSkin(playerid, i)
  447. ) continue;
  448. if(CustomSkin[i][cs_SkinType] != CUSTOM_SKIN_TYPE_DONOR)
  449. continue;
  450. if(CustomSkin[i][cs_SkinID] == modelid) {
  451. // Send prox message to inform players
  452. new skinStr[128];
  453. format(skinStr, sizeof(skinStr), "(( %s has equipped a custom skin ))", PlayerICName(playerid));
  454. ProxDetector(10.0, playerid, skinStr, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
  455. // Set cooldown
  456. lastEquippedCSkin[playerid] = gettime();
  457. break;
  458. }
  459. }
  460. if(JustRegistered[playerid]) displayWelcomeMessage(playerid), JustRegistered[playerid] = false;
  461. return true;
  462. }
  463. // Checks if the player has any donated custom skins
  464. HasAnyDonorSkins(playerid) {
  465. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  466. if( !CustomSkin[i][cs_Used] ||
  467. !IsAllowedSkin(playerid, i)
  468. ) continue;
  469. if(CustomSkin[i][cs_SkinType] == CUSTOM_SKIN_TYPE_DONOR)
  470. return true;
  471. }
  472. return false;
  473. }
  474. // Command for developers to list the skins they have access to
  475. CMD:skindebug(playerid, params[]) {
  476. if(PlayerInfo[playerid][pDev] < DEVRANK_SENIOR)
  477. return AdmErrorMsg;
  478. SendClientMessage(playerid, COLOR_LIGHTBLUE, "The following custom skins are available to you:");
  479. new skinStr[128];
  480. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  481. if(!IsAllowedSkin(playerid, i)) continue;
  482. format(skinStr, sizeof(skinStr), "Skin ID %i | Skin is", CustomSkin[i][cs_SkinID]);
  483. switch(CustomSkin[i][cs_SkinType]) {
  484. case CUSTOM_SKIN_TYPE_PUBLIC: {
  485. format(skinStr, sizeof(skinStr), "%s public", skinStr);
  486. }
  487. case CUSTOM_SKIN_TYPE_FACTION: {
  488. format(skinStr, sizeof(skinStr), "%s restricted to your faction", skinStr);
  489. }
  490. case CUSTOM_SKIN_TYPE_GROUP: {
  491. format(skinStr, sizeof(skinStr), "%s restricted to your group", skinStr);
  492. }
  493. case CUSTOM_SKIN_TYPE_DONOR: {
  494. format(skinStr, sizeof(skinStr), "%s restricted to your SQL ID", skinStr);
  495. }
  496. }
  497. SendClientMessage(playerid, COLOR_RED, skinStr);
  498. }
  499. return 1;
  500. }
  501. // Command for developers to list all skins
  502. CMD:allskins(playerid, params[]) {
  503. if(PlayerInfo[playerid][pDev] < DEVRANK_SENIOR)
  504. return AdmErrorMsg;
  505. SendClientMessage(playerid, COLOR_LIGHTBLUE, "The following custom skins are in-game:");
  506. new skinStr[128];
  507. for(new i = 0; i < MAX_CUSTOM_SKINS; i++) {
  508. if(!CustomSkin[i][cs_Used]) continue;
  509. format(skinStr, sizeof(skinStr), "Skin ID %i | Skin is", CustomSkin[i][cs_SkinID]);
  510. switch(CustomSkin[i][cs_SkinType]) {
  511. case CUSTOM_SKIN_TYPE_PUBLIC: {
  512. format(skinStr, sizeof(skinStr), "%s public", skinStr);
  513. }
  514. case CUSTOM_SKIN_TYPE_FACTION: {
  515. format(skinStr, sizeof(skinStr), "%s restricted to faction: %s (rank %i and above)", skinStr, GetFactionName(CustomSkin[i][cs_Meta1]), CustomSkin[i][cs_Meta2]);
  516. }
  517. case CUSTOM_SKIN_TYPE_GROUP: {
  518. format(skinStr, sizeof(skinStr), "%s restricted to group: %s (rank %i and above)", skinStr, GetGroupName(CustomSkin[i][cs_Meta1]), CustomSkin[i][cs_Meta2]);
  519. }
  520. case CUSTOM_SKIN_TYPE_DONOR: {
  521. format(skinStr, sizeof(skinStr), "%s restricted to SQL ID: %i", skinStr, CustomSkin[i][cs_Meta1]);
  522. }
  523. }
  524. SendClientMessage(playerid, COLOR_RED, skinStr);
  525. }
  526. return 1;
  527. }
  528. // Command for developers to show a certain skin shop
  529. CMD:skinshop(playerid, params[]) {
  530. if(PlayerInfo[playerid][pDev] < DEVRANK_SENIOR)
  531. return AdmErrorMsg;
  532. new skShopType;
  533. if(sscanf(params, "i", skShopType)) {
  534. SendClientMessage(playerid, COLOR_LIGHTBLUE, "{00BFFF}USAGE:{FFFFFF} /skinshop [type]");
  535. SendClientMessage(playerid, COLOR_GREY, "Type 0: Civilian skins only");
  536. SendClientMessage(playerid, COLOR_GREY, "Type 1: Faction skins only");
  537. SendClientMessage(playerid, COLOR_GREY, "Type 2: Group skins only");
  538. SendClientMessage(playerid, COLOR_GREY, "Type 3: Civilian and faction skins");
  539. SendClientMessage(playerid, COLOR_GREY, "Type 4: Donor skins");
  540. SendClientMessage(playerid, COLOR_GREY, "Type 5: All skins");
  541. return 1;
  542. }
  543. if(skShopType < 0 || skShopType > 5)
  544. return SendClientMessage(playerid, COLOR_GREY, "Invalid skin shop type.");
  545. new anythingToShow;
  546. switch(skShopType) {
  547. case 0: anythingToShow = ShowSkinShop(playerid, true, false, false, false, true);
  548. case 1: anythingToShow = ShowSkinShop(playerid, false, true, false, false, true);
  549. case 2: anythingToShow = ShowSkinShop(playerid, false, false, true, false, true);
  550. case 3: anythingToShow = ShowSkinShop(playerid, true, true, false, false, true);
  551. case 4: anythingToShow = ShowSkinShop(playerid, false, false, false, true, true);
  552. case 5: anythingToShow = ShowSkinShop(playerid, true, true, true, true, true);
  553. }
  554. if(!anythingToShow)
  555. SendClientMessage(playerid, COLOR_GREY, "Nothing to show in this skin shop.");
  556. return 1;
  557. }
  558. // Command for donors to equip one of their skins
  559. CMD:donorskin(playerid, params[])
  560. return cmd_myskins(playerid, params);
  561. CMD:myskin(playerid, params[])
  562. return cmd_myskins(playerid, params);
  563. CMD:myskins(playerid, params[]) {
  564. if(!HasAnyDonorSkins(playerid)) {
  565. SendClientMessage(playerid, COLOR_GREY, "Oops! Looks like you don't have any donor skins at the moment.");
  566. SendClientMessage(playerid, COLOR_GREY, "If you are interested in having your own exclusive skin, please follow the link below.");
  567. SendClientMessage(playerid, COLOR_GREY, "Donation link: http://donate.Coming soon/.");
  568. return 1;
  569. }
  570. if(IsPlayerRestricted(playerid))
  571. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now.");
  572. if(IsPlayerInAnyVehicle(playerid))
  573. return SendClientMessage(playerid, COLOR_GREY, "You cannot do this while being in a vehicle.");
  574. if(IsPlayerMoving(playerid))
  575. return SendClientMessage(playerid, COLOR_GREY, "You must be standing still.");
  576. // 5 minute cooldown on this command
  577. //if(gettime() - lastEquippedCSkin[playerid] < (5 * 60))
  578. // return SendClientMessage(playerid, COLOR_GREY, "You need to wait 5 minutes in between doing that.");
  579. ShowSkinShop(playerid, false, false, false, true, true);
  580. return 1;
  581. }