drogas.pwn 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. //Comandos de comprar drogas
  2. CMD:comprardrogas(playerid, params[])//buydrug
  3. {
  4. if(!Logged{playerid}) return true;
  5. if(Job[playerid] != JOB_DRUGDEALER) return SysMsg(playerid,"Você não é um Revendedor de Drogas.");
  6. new drugAmount;
  7. if(IsPlayerInRangeOfPoint(playerid,3.0,206.74,-102.57,4.89)) //Cocaine Point
  8. {
  9. if(sscanf(params, "i", drugAmount)) return SysMsgF(playerid, "Use: Cocaine: /comprardrogas [quantidade (gramas)] Preço: $%i por grama", DRUG_PRICE_COCAINE);
  10. if(drugAmount < 1 || drugAmount > DRUG_MAX_COCAINE) return SysMsgF(playerid, "Quantidade Inválida. Você só pode obter de 1 - %i gramas de Cocaina.", DRUG_MAX_COCAINE);
  11. if(Inventory[playerid][Cocaine] + drugAmount > DRUG_MAX_COCAINE) return SysMsgF(playerid, "Quantidade Inválida.");
  12. SysMsgF(playerid, "Você não pode pegar tanta droga.");
  13. SysMsgF(playerid, "Você pode pegar no máximo %i gramas.", DRUG_MAX_COCAINE - Inventory[playerid][Cocaine]);
  14. new drugValue = drugAmount * DRUG_PRICE_COCAINE;
  15. if(Cash[playerid] < drugValue) return SysMsgF(playerid, "Você não tem dinheiro suficiente para a Cocaína. Isso custa $%i para %i gramas.", drugValue, drugAmount);
  16. Inventory[playerid][Cocaine] += drugAmount;
  17. GivePlayerCash(playerid, -drugValue);
  18. MySQLUpdateInt(SQLID[playerid], "Cocaine", Inventory[playerid][Cocaine], "players");
  19. format(gstr, sizeof(gstr),"* The door near %s opens slightly... *", NameRP(playerid));//traduzir
  20. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  21. format(gstr, sizeof(gstr),"* %s tira um pequeno pacote de dentro da porta. *",NameRP(playerid));
  22. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  23. format(gstr, sizeof(gstr), "Você recebeu %i gramas de cocaina da distribuidora de drogas por $%i.", drugAmount, drugValue);
  24. SendClientMessage(playerid, COLOR_WHITE, gstr);
  25. format(gstr, sizeof(gstr),"* The door near %s is now closed. *", NameRP(playerid));//traduzir
  26. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  27. return true;
  28. }
  29. else if(IsPlayerInRangeOfPoint(playerid,3.0,-753.07,-131.56,65.82) || IsPlayerInRangeOfPoint(playerid,3.0,-416.35,-1760.50,5.77)) //MoonShine Point 1
  30. {
  31. if(sscanf(params, "i", drugAmount)) return SysMsgF(playerid, "Use: Moonshine: /comprardrogas [quantidade (litros)] Preço: $%i por litros.", DRUG_PRICE_MOONSHINE);
  32. if(drugAmount < 1 || drugAmount > DRUG_MAX_MOONSHINE) return SysMsgF(playerid, "Quantidade Inválida. Você só pode obter 1 - %i litros de MoonShine.", DRUG_MAX_MOONSHINE);
  33. if(Inventory[playerid][MoonShine] + drugAmount > DRUG_MAX_MOONSHINE) return SysMsgF(playerid, "Quantidade Inválida. Você não pode carregar essa quantidade de MoonShine. Máximo de %i litros.", DRUG_MAX_MOONSHINE - Inventory[playerid][MoonShine]);
  34. new drugValue = drugAmount * DRUG_PRICE_MOONSHINE;
  35. if(Cash[playerid] < drugValue) return SysMsgF(playerid, "Você não tem dinheiro suficiente para MoonShine. Isso custa $%i por %i litros.", drugValue, drugAmount);
  36. Inventory[playerid][MoonShine] += drugAmount;
  37. GivePlayerCash(playerid, -drugValue);
  38. MySQLUpdateInt(SQLID[playerid], "MoonShine", Inventory[playerid][MoonShine], "players");
  39. format(gstr, sizeof(gstr),"* %s pega um pacote do revendedor. *",NameRP(playerid));
  40. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  41. format(gstr, sizeof(gstr), "Você recebeu %i litros de MoonShine do revendedor custando $%i.", drugAmount, drugValue);
  42. SendClientMessage(playerid, COLOR_WHITE, gstr);
  43. return true;
  44. }
  45. return true;
  46. }
  47. CMD:usadrogas(playerid, params[])
  48. {
  49. if(!Logged{playerid}) return true;
  50. new drug[10], method[10];
  51. if(sscanf(params, "s[10]S()[10]", drug, method)) return SysMsg(playerid,"Use: /usadrogas [tipo de droga] - Tipos: Marijuana, Moonshine, Cocaina");
  52. if(strcmp("marijuana", drug, true) == 0)
  53. {
  54. if(DrugSpamTimer[playerid] > 0) return SysMsg(playerid,"Você já está drogado.");
  55. if(Inventory[playerid][Weed] == 0) return SysMsg(playerid,"Você não tem Marijuana.");
  56. if(Inventory[playerid][Lighter] <= 0) return SysMsg(playerid,"Você precisa de um isqueiro para acender o cigarro de Marijuana.");
  57. if(sscanf(params, "s[10]s[10]", drug, method)) return SysMsg(playerid,"Use: /usadrogas Marijuana [método: Junta/Bong]");
  58. if(strcmp("junta", method, true) == 0)
  59. {
  60. if(Inventory[playerid][RollingPaper] == 0) return SysMsg(playerid,"Você não tem rolo de papel.");
  61. if(Inventory[playerid][Weed] > 1) Inventory[playerid][Weed] -= 2;
  62. else Inventory[playerid][Weed] --;
  63. Inventory[playerid][Lighter] --;
  64. Inventory[playerid][RollingPaper] --;
  65. mysql_format(conn, mquery, sizeof(mquery), "UPDATE players SET RollingPaper = %i, HasLighter = %i, Weed = %i WHERE id = %i", Inventory[playerid][RollingPaper], Inventory[playerid][Lighter], Inventory[playerid][Weed], SQLID[playerid]);
  66. mysql_pquery(conn, mquery);
  67. DrugSpamTimer[playerid] = 30;
  68. DrunkLevel[playerid] = 10000;
  69. SetPlayerDrunkLevel(playerid, 10000);
  70. TextDrawShowForPlayer(playerid, WeedEffect);
  71. new Float:Health;
  72. GetPlayerHealth(playerid, Health);
  73. if(Health + 15.0 > 100.0) SetPlayerHealthEx(playerid, 100.0);
  74. else SetPlayerHealthEx(playerid, Health + 15.0);
  75. if(!IsPlayerInAnyVehicle(playerid))
  76. {
  77. LoopingAnim(playerid,"SMOKING","M_smk_out", 4.0, 1, 0, 0, 0, 0);
  78. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
  79. }
  80. format(gstr, sizeof(gstr),"* %s rola um baseado, coloca na boca e acende. *",NameRP(playerid));
  81. ProxDetector(20.0, playerid, gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  82. format(gstr, sizeof(gstr), "Você fumou uma maconha. Você tem %i gramas restantes. Você ganhou um impulso de saúde.", Inventory[playerid][Weed]);
  83. SendClientMessage(playerid, COLOR_WHITE, gstr);
  84. }
  85. else if(strcmp("bong", method, true) == 0)
  86. {
  87. if(Inventory[playerid][Bong] == 0) return SysMsg(playerid,"Você não tem Bong.");
  88. if(Inventory[playerid][Weed] > 1) Inventory[playerid][Weed] -= 2;
  89. else Inventory[playerid][Weed] --;
  90. Inventory[playerid][Lighter] --;
  91. MySQLUpdateInt(SQLID[playerid], "HasLighter", Inventory[playerid][Lighter], "players");
  92. MySQLUpdateInt(SQLID[playerid], "Weed", Inventory[playerid][Weed], "players");
  93. DrugSpamTimer[playerid] = 30;
  94. DrunkLevel[playerid] = 10000;
  95. SetPlayerDrunkLevel(playerid, 10000);
  96. TextDrawShowForPlayer(playerid, WeedEffect);
  97. new Float:Health;
  98. GetPlayerHealth(playerid, Health);
  99. if(Health + 20.0 > 100.0) SetPlayerHealthEx(playerid, 100.0);
  100. else SetPlayerHealthEx(playerid, Health + 20.0);
  101. if(!IsPlayerInAnyVehicle(playerid))
  102. {
  103. LoopingAnim(playerid,"SMOKING","M_smk_in", 3.0, 1, 0, 0, 0, 0);
  104. }
  105. format(gstr, sizeof(gstr),"* %s pega um bong e fuma maconha. *",NameRP(playerid));
  106. ProxDetector(20.0, playerid, gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  107. if(random(100) < 5)
  108. {
  109. format(gstr, sizeof(gstr),"* %s gets carried away with the weed and accidentally drops their bong, it smashes. *",NameRP(playerid));//traduzir
  110. ProxDetector(20.0, playerid, gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  111. Inventory[playerid][Bong] = 0;
  112. MySQLUpdateInt(SQLID[playerid], "Bong", Inventory[playerid][Bong], "players");
  113. }
  114. format(gstr, sizeof(gstr), "Você fumou alguma erva daninha. Você tem %i gramas restantes. Você ganhou um grande impulso de saúde.", Inventory[playerid][Weed]);
  115. SendClientMessage(playerid, COLOR_WHITE, gstr);
  116. }
  117. return true;
  118. }
  119. else if(strcmp("Cocaina", drug, true) == 0)
  120. {
  121. if(DrugSpamTimer[playerid] > 0) return SysMsg(playerid,"Você já está drogado.");
  122. if(Inventory[playerid][Cocaine] == 0) return SysMsg(playerid,"Você não tem cocaína.");
  123. Inventory[playerid][Cocaine] -= 1;
  124. MySQLUpdateInt(SQLID[playerid], "Cocaine", Inventory[playerid][Cocaine], "players");
  125. DrugSpamTimer[playerid] = 30;
  126. DrunkLevel[playerid] = 10000;
  127. SetPlayerDrunkLevel(playerid, 10000);
  128. SetPlayerWeather(playerid, 9);
  129. new Float:Armour;
  130. GetPlayerArmour(playerid, Armour);
  131. if(Armour >= 50.0) return SysMsg(playerid,"((Você não receberá colete adicional quando seu colete for 50 ou superior.))");
  132. else if(Armour + 25.0 >= 49.0) SetPlayerArmourEx(playerid, 50, 0);
  133. else SetPlayerArmourEx(playerid, Armour + 25.0, 0);
  134. if(!IsPlayerInAnyVehicle(playerid)) OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
  135. format(gstr, sizeof(gstr),"* %s alinha um punhado de cocaína em seu dedo, e rapidamente xeira todo o pó. *",NameRP(playerid));
  136. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  137. format(gstr, sizeof(gstr), "Você inalou 1 grama de cocaína. Você tem %i gramas restantes, seu colete foi aumentado.", Inventory[playerid][Cocaine]);
  138. SendClientMessage(playerid, COLOR_WHITE, gstr);
  139. return true;
  140. }
  141. else if(strcmp("MoonShine", drug, true) == 0)
  142. {
  143. if(DrugSpamTimer[playerid] > 0) return SysMsg(playerid,"Você já está drogado.");
  144. if(Inventory[playerid][MoonShine] == 0) return SysMsg(playerid,"Você não tem MoonShine.");
  145. Inventory[playerid][MoonShine] -= 1;
  146. MySQLUpdateInt(SQLID[playerid], "MoonShine", Inventory[playerid][MoonShine], "players");
  147. DrugSpamTimer[playerid] = 20;
  148. DrunkLevel[playerid] += 16000;
  149. SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 16000);
  150. new Float:Health;
  151. GetPlayerHealth(playerid, Health);
  152. if(Health + 40.0 > 100.0) SetPlayerHealthEx(playerid, 100.0);
  153. else SetPlayerHealthEx(playerid, Health + 40.0);
  154. if(!IsPlayerInAnyVehicle(playerid))
  155. {
  156. OnePlayAnim(playerid, "VENDING", "VEND_Drink_P", 3.5, 1, 0, 0, 0, 0);
  157. }
  158. format(gstr, sizeof(gstr),"* %s pega uma garrafa de Moonshine e bebe. *",NameRP(playerid));
  159. ProxDetector(7.0,playerid,gstr, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE, COLOR_EMOTE);
  160. format(gstr, sizeof(gstr), "Você bebeu 1 litro de MoonShine. Agora você tem %i litros. Você obteve um enorme impulso de saúde, mas está muito bêbado.", Inventory[playerid][MoonShine]);
  161. SendClientMessage(playerid, COLOR_WHITE, gstr);
  162. return true;
  163. }
  164. return true;
  165. }
  166. CMD:createdrugs(playerid, params[]) //drug comment //parei aqui
  167. {
  168. if(!Logged{playerid}) return true;
  169. if(InValidDrugLoc(playerid))
  170. {
  171. CreatingDrugs[playerid][0] = 1;
  172. SelectObject(playerid);
  173. }
  174. return true;
  175. }
  176. CMD:checkdrugs(playerid, params[])
  177. {
  178. if(!Logged{playerid}) return true;
  179. if(InValidDrugLoc(playerid))
  180. {
  181. SelectObject(playerid);
  182. }
  183. return true;
  184. }
  185. CMD:usedrugnew(playerid, params[])
  186. {
  187. if(!Logged{playerid}) return true;
  188. mysql_format(conn, mquery, sizeof(mquery), "SELECT * FROM drugs WHERE drugOwner = %d AND drugAmount > 0 AND drugOwnerType = 'P' LIMIT 20", SQLID[playerid]);
  189. mysql_pquery(conn, mquery, "ShowPlayerDrugs", "ii", playerid, 0);
  190. return true;
  191. }
  192. CMD:myingredients(playerid, params[])
  193. {
  194. if(!Logged{playerid}) return true;
  195. mysql_format(conn, mquery, sizeof(mquery), "SELECT * FROM ingredients WHERE ingOwner = %d AND ingOwnerType = 'P' LIMIT 20", SQLID[playerid]);
  196. mysql_pquery(conn, mquery, "ShowIngredients", "ii", playerid, 0);
  197. return true;
  198. }
  199. GREENSIDE::ShowPlayerDrugs(playerid, offset)
  200. {
  201. format(gstr, sizeof(gstr), "Drug Name\tAmount\n");
  202. DrugSelectionOffset[playerid] = offset;
  203. for(new r = 0; r < cache_get_row_count(conn); r++)
  204. {
  205. new dName[32];
  206. cache_get_field_content(r, "drugName", dName, conn);
  207. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, dName, cache_get_field_content_int(r, "drugAmount"));
  208. }
  209. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  210. if(offset >= 1) strcat(gstr, "<< Previous Page");
  211. if(strmatch(gstr, "Drug Name\tAmount\n")) strcat(gstr, "No drugs to display.");
  212. Dialog_Show(playerid, ShowPlayerDrugs, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Your drugs", gstr, "Selecionar", "Fechar");
  213. return true;
  214. }
  215. GREENSIDE::ShowCombineDrugs(playerid, offset)
  216. {
  217. format(gstr, sizeof(gstr), "Drug Name\tAmount\n");
  218. DrugSelectionOffset[playerid] = offset;
  219. for(new r = 0; r < cache_get_row_count(conn); r++)
  220. {
  221. new dName[32];
  222. cache_get_field_content(r, "drugName", dName, conn);
  223. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, dName, cache_get_field_content_int(r, "drugAmount"));
  224. }
  225. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  226. if(offset >= 1) strcat(gstr, "<< Previous Page");
  227. if(strmatch(gstr, "Drug Name\tAmount\n")) strcat(gstr, "No drugs to display.");
  228. Dialog_Show(playerid, ShowCombineDrugs, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Your drugs", gstr, "Selecionar", "Fechar");
  229. return true;
  230. }
  231. GREENSIDE::ShowIngredients(playerid, offset)
  232. {
  233. format(gstr, sizeof(gstr), "Ingredient Name\tAmount\n");
  234. DrugSelectionOffset[playerid] = offset;
  235. for(new r = 0; r < cache_get_row_count(conn); r++)
  236. {
  237. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, IngredName[cache_get_field_content_int(r, "ingType")], cache_get_field_content_int(r, "ingAmount"));
  238. }
  239. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  240. if(offset >= 1) strcat(gstr, "<< Previous Page");
  241. if(strmatch(gstr, "Ingredient Name\tAmount\n")) strcat(gstr, "No ingredients to display.");
  242. Dialog_Show(playerid, ShowIngredients, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Your ingredients", gstr, "Selecionar", "Fechar");
  243. return true;
  244. }
  245. GREENSIDE::GivePlayerDrugs(playerid, offset)
  246. {
  247. format(gstr, sizeof(gstr), "Drug Name\tAmount\n");
  248. DrugSelectionOffset[playerid] = offset;
  249. for(new r = 0; r < cache_get_row_count(conn); r++)
  250. {
  251. new dName[32];
  252. cache_get_field_content(r, "drugName", dName, conn);
  253. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, dName, cache_get_field_content_int(r, "drugAmount"));
  254. }
  255. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  256. if(offset >= 1) strcat(gstr, "<< Previous Page");
  257. if(strmatch(gstr, "Drug Name\tAmount\n")) strcat(gstr, "No drugs to display.");
  258. Dialog_Show(playerid, GivePlayerDrugs, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Your drugs", gstr, "Selecionar", "Fechar");
  259. return true;
  260. }
  261. GREENSIDE::GivePlayerIngreds(playerid, offset)
  262. {
  263. format(gstr, sizeof(gstr), "Ingredient Name\tAmount\n");
  264. DrugSelectionOffset[playerid] = offset;
  265. for(new r = 0; r < cache_get_row_count(conn); r++)
  266. {
  267. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, IngredName[cache_get_field_content_int(r, "ingType")], cache_get_field_content_int(r, "ingAmount"));
  268. }
  269. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  270. if(offset >= 1) strcat(gstr, "<< Previous Page");
  271. if(strmatch(gstr, "Ingredient Name\tAmount\n")) strcat(gstr, "No ingredients to display.");
  272. Dialog_Show(playerid, GivePlayerIngreds, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Your ingredients", gstr, "Selecionar", "Fechar");
  273. return true;
  274. }
  275. GREENSIDE::GivePlayerDrug(playerid, drugAmount)
  276. {
  277. new id = cache_get_field_content_int(0, "id"), amount = cache_get_field_content_int(0, "drugAmount"), drugName[64], drugsComedown[128], drugsEffects[128], drugsOverdose[128];
  278. cache_get_field_content(0, "drugName", drugName, conn);
  279. cache_get_field_content(0, "drugComedown", drugsComedown, conn);
  280. cache_get_field_content(0, "drugEffects", drugsEffects, conn);
  281. cache_get_field_content(0, "drugOverdose", drugsOverdose, conn);
  282. new createby = cache_get_field_content_int(0, "drugCreatedBy"), createat = cache_get_field_content_int(0, "drugCreatedAt"), drugtype = cache_get_field_content_int(0, "drugType"), qual = cache_get_field_content_int(0, "drugQuality");
  283. if(amount < drugAmount || drugAmount == 0)
  284. {
  285. format(gstr, sizeof(gstr), "{FFFFFF}Quantidade Inválida!\nHow many grams of %s do you want to give %s?", drugName, NameRP(GetPVarInt(playerid, "giveDrugs")));
  286. return Dialog_Show(playerid, GivePlayerDrugAmount, DIALOG_STYLE_INPUT, "{FFFFFF}Give the drugs - Amount", gstr, "Selecionar", "Cancelar");
  287. }
  288. if(drugAmount == amount)
  289. {
  290. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugOwner = %d WHERE id = %d", SQLID[GetPVarInt(playerid, "giveDrugs")], id);
  291. mysql_pquery(conn, mquery);
  292. }
  293. else
  294. {
  295. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugAmount = drugAmount - %d WHERE id = %d", drugAmount, id);
  296. mysql_pquery(conn, mquery);
  297. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugAmount = drugAmount + %d WHERE drugOwner = %d AND drugEffects = '%e' AND drugName = '%e'", drugAmount, SQLID[GetPVarInt(playerid, "giveDrugs")], drugsEffects, drugName);
  298. new Cache:result = mysql_query(conn, mquery);
  299. if(cache_affected_rows() == 0)
  300. {
  301. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO drugs (drugName, drugCreatedBy, drugCreatedAt, drugOwner, drugOwnerType, drugType, drugEffects, drugComedown, drugOverdose, drugQuality, drugAmount) VALUES ('%e', %d, %d, %d, 'P', %d, '%e', '%e', '%e', %d, %d)",
  302. drugName, createby, createat, SQLID[GetPVarInt(playerid, "giveDrugs")], drugtype, drugsEffects, drugsComedown, drugsOverdose, qual, drugAmount);
  303. mysql_pquery(conn, mquery);
  304. }
  305. cache_delete(result);
  306. }
  307. SendClientMessageF(playerid, COLOR_WHITE, "You gave %s %d grams of %s. You have %d grams left.", NameRP(GetPVarInt(playerid, "giveDrugs")), drugAmount, drugName, amount - drugAmount);
  308. SendClientMessageF(GetPVarInt(playerid, "giveDrugs"), COLOR_WHITE, "%s gave you %d grams of %s", NameRP(playerid), drugAmount, drugName);
  309. format(gstr, sizeof(gstr), "* %s hands something over to %s. *",NameRP(playerid),NameRP(GetPVarInt(playerid, "giveDrugs")));
  310. ProxDetector(20.0,playerid,gstr,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE);
  311. DeletePVar(playerid, "giveDrugs");
  312. return true;
  313. }
  314. GREENSIDE::GivePlayerIngred(playerid, iAmount)
  315. {
  316. new id = cache_get_field_content_int(0, "id"), amount = cache_get_field_content_int(0, "ingAmount"), type = cache_get_field_content_int(0, "ingType");
  317. if(amount < iAmount || iAmount == 0)
  318. {
  319. format(gstr, sizeof(gstr), "{FFFFFF}Quantidade Inválida!\nHow many grams of %s do you want to give %s?", IngredName[type], NameRP(GetPVarInt(playerid, "giveIngred")));
  320. return Dialog_Show(playerid, GivePlayerIngredAmount, DIALOG_STYLE_INPUT, "{FFFFFF}Give the drugs - Amount", gstr, "Selecionar", "Cancelar");
  321. }
  322. if(iAmount == amount)
  323. {
  324. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingOwner = %d WHERE id = %d", SQLID[GetPVarInt(playerid, "giveIngred")], id);
  325. mysql_pquery(conn, mquery);
  326. }
  327. else
  328. {
  329. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount - %d WHERE id = %d", iAmount, id);
  330. mysql_pquery(conn, mquery);
  331. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount + %d WHERE ingOwner = %d AND ingType = %d", iAmount, SQLID[GetPVarInt(playerid, "giveIngred")], type);
  332. new Cache:result = mysql_query(conn, mquery);
  333. if(cache_affected_rows() == 0)
  334. {
  335. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO ingredients (ingOwner, ingOwnerType, ingAmount) VALUES (%d, 'P', %d)", SQLID[GetPVarInt(playerid, "giveIngred")], iAmount);
  336. mysql_pquery(conn, mquery);
  337. }
  338. cache_delete(result);
  339. }
  340. SendClientMessageF(playerid, COLOR_WHITE, "You gave %s %d grams of %s. You have %d grams left.", NameRP(GetPVarInt(playerid, "giveIngred")), iAmount, IngredName[type], amount - iAmount);
  341. SendClientMessageF(GetPVarInt(playerid, "giveIngred"), COLOR_WHITE, "%s gave you %d grams of %s", NameRP(playerid), iAmount, IngredName[type]);
  342. format(gstr, sizeof(gstr), "* %s hands something over to %s. *",NameRP(playerid),NameRP(GetPVarInt(playerid, "giveIngred")));
  343. ProxDetector(20.0,playerid,gstr,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE);
  344. DeletePVar(playerid, "giveIngred");
  345. return true;
  346. }
  347. GREENSIDE::SelectIngredients(playerid)
  348. {
  349. DrugSelectionOffset[playerid] = cache_get_field_content_int(0, "id");
  350. Dialog_Show(playerid, SelectIngredients, DIALOG_STYLE_LIST, IngredName[cache_get_field_content_int(0, "ingType")], "Drop Ingredients", "Selecionar", "Cancelar");
  351. return true;
  352. }
  353. GREENSIDE::SelectPlayerDrug(playerid)
  354. {
  355. DrugSelectionOffset[playerid] = cache_get_field_content_int(0, "id");
  356. new dName[32];
  357. cache_get_field_content(0, "drugName", dName, conn);
  358. Dialog_Show(playerid, SelectPlayerDrug, DIALOG_STYLE_LIST, dName, "Take Drug\nMix Drugs\nDrop Drug", "Selecionar", "Cancelar");
  359. return true;
  360. }
  361. GREENSIDE::SelectCombineDrug(playerid)
  362. {
  363. if(cache_num_rows() == 1)
  364. {
  365. mysql_format(conn, mquery, sizeof(mquery), "SELECT * FROM drugs WHERE id = %d OR id = %d", CombineDrugID[playerid], cache_get_field_content_int(0, "id"));
  366. mysql_pquery(conn, mquery, "SelectCombineDrug", "i", playerid);
  367. }
  368. else
  369. {
  370. new drugData[2][128], comedownData[2][128], Float:effArray[2][15], Float:cmdArray[2][15], drugName[2][64], quality, amount;
  371. cache_get_field_content(0, "drugEffects", drugData[0], conn, 128);
  372. cache_get_field_content(1, "drugEffects", drugData[1], conn, 128);
  373. cache_get_field_content(0, "drugComedown", comedownData[0], conn, 128);
  374. cache_get_field_content(1, "drugComedown", comedownData[1], conn, 128);
  375. cache_get_field_content(0, "drugName", drugName[0], conn, 64);
  376. cache_get_field_content(1, "drugName", drugName[1], conn, 64);
  377. sscanf(drugData[0], "p<,>a<f>[15]", effArray[0]);
  378. sscanf(drugData[1], "p<,>a<f>[15]", effArray[1]);
  379. sscanf(comedownData[0], "p<,>a<f>[15]", cmdArray[0]);
  380. sscanf(comedownData[1], "p<,>a<f>[15]", cmdArray[1]);
  381. effArray[0][0] = (effArray[0][0] + effArray[1][0]) / 2;
  382. cmdArray[0][0] = (cmdArray[0][0] + cmdArray[1][0]) / 2;
  383. cmdArray[0][1] = (cmdArray[0][1] + cmdArray[1][1]) / 2;
  384. cmdArray[0][2] = (cmdArray[0][2] + cmdArray[1][2]) / 2;
  385. for(new j=1; j < 14; j+=2)
  386. {
  387. if(effArray[0][j+1] == effArray[1][j+1])
  388. effArray[0][j] = floatdiv((effArray[0][j] + effArray[1][j]), 2);
  389. else
  390. return Dialog_Show(playerid, CombineDrugsError, DIALOG_STYLE_MSGBOX, "{FFFFFF}Mixing drugs - ERROR", "{FFFFFF}The drug you selected doesn't match the composition of the originally selected drug, please choose another.", "Retornar", "");
  391. }
  392. for(new j=3; j < 14; j+=2)
  393. {
  394. if(cmdArray[0][j+1] == cmdArray[1][j+1])
  395. cmdArray[0][j] = floatdiv((cmdArray[0][j] + cmdArray[1][j]), 2);
  396. else
  397. return Dialog_Show(playerid, CombineDrugsError, DIALOG_STYLE_MSGBOX, "{FFFFFF}Mixing drugs - ERROR", "{FFFFFF}The drug you selected doesn't match the composition of the originally selected drug, please choose another.", "Retornar", "");
  398. }
  399. strdel(drugData[0], 0, 128);
  400. strdel(comedownData[0], 0, 128);
  401. for(new j=0; j < 15; j++)
  402. {
  403. format(drugData[0], 128, "%s%.2f, ", drugData[0], effArray[0][j]);
  404. format(comedownData[0], 128, "%s%.2f, ", comedownData[0], cmdArray[0][j]);
  405. }
  406. quality = (cache_get_field_content_int(0, "drugQuality") + cache_get_field_content_int(1, "drugQuality")) / 2;
  407. amount = cache_get_field_content_int(0, "drugAmount") + cache_get_field_content_int(1, "drugAmount");
  408. CombineDrugID[playerid] = cache_get_field_content_int(0, "id");
  409. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugEffects ='%s', drugComedown = '%s', drugQuality = %d, drugAmount = %d WHERE id = %d", drugData[0], comedownData[0], quality, amount, cache_get_field_content_int(0, "id"));
  410. mysql_pquery(conn, mquery);
  411. mysql_format(conn, mquery, sizeof(mquery), "DELETE FROM drugs WHERE id = %d", cache_get_field_content_int(1, "id"));
  412. mysql_pquery(conn, mquery);
  413. format(gstr, sizeof(gstr), "%s\n%s", drugName[0], drugName[1]);
  414. SetPVarString(playerid, "drugCombName", gstr);
  415. Dialog_Show(playerid, CombinePlayerDrug, DIALOG_STYLE_LIST, "{FFFFFF}Mixing drugs - Choose name", gstr, "Select", "");
  416. }
  417. return 1;
  418. }
  419. //Fim da parte 2
  420. GREENSIDE::DropIngredients(playerid, amount)
  421. {
  422. new iAmount = cache_get_field_content_int(0, "ingAmount"), id = cache_get_field_content_int(0, "id");
  423. if(amount == iAmount)
  424. {
  425. for(new p = 1; p < MAX_INGREDIENTS; p++)
  426. {
  427. if(IngredientsData[p][ingredPos][0] == 0.0 && IngredientsData[p][ingredSQLID] == 0)
  428. {
  429. IngredientsData[p][ingredSQLID] = id;
  430. IngredientsData[p][ingredAmount] = amount;
  431. IngredientsData[p][ingredVW] = GetPlayerVirtualWorld(playerid);
  432. IngredientsData[p][ingredInt] = GetPlayerInterior(playerid);
  433. GetPlayerPos(playerid, IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1], IngredientsData[p][ingredPos][2]);
  434. GetXYInFrontOfPlayer(playerid, IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1], 1.0);
  435. IngredientsData[p][ingredType] = cache_get_field_content_int(0, "ingType");
  436. if(amount < 28){
  437. IngredientsData[p][ingredObj] = CreateDynamicObject(19874, IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1], IngredientsData[p][ingredPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  438. SetDynamicObjectMaterial(IngredientsData[p][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(0, "ingModColor")]);
  439. }
  440. else if(amount < 112){
  441. IngredientsData[p][ingredObj] = CreateDynamicObject(2891, IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1], IngredientsData[p][ingredPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  442. SetDynamicObjectMaterial(IngredientsData[p][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(0, "ingModColor")]);
  443. }
  444. else
  445. {
  446. IngredientsData[p][ingredObj] = CreateDynamicObject(1279, IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1], IngredientsData[p][ingredPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  447. SetDynamicObjectMaterial(IngredientsData[p][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(0, "ingModColor")]);
  448. }
  449. Streamer_Update(playerid);
  450. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingOwner = -1, ingOwnerType = 'D', ingPosX = %f, ingPosY = %f, ingPosZ = %f, ingVw = %d, ingInt = %d WHERE id = %d", IngredientsData[p][ingredPos][0], IngredientsData[p][ingredPos][1],
  451. IngredientsData[p][ingredPos][2] - 1.0, IngredientsData[p][ingredVW], IngredientsData[p][ingredInt], id);
  452. mysql_pquery(conn, mquery);
  453. PlayerPlaySound(playerid, 5600, 0.0, 0.0, 0.0);
  454. SendClientMessageF(playerid, COLOR_YELLOW, "You have dropped %d grams of %s on the ground.", amount, IngredName[IngredientsData[p][ingredType]]);
  455. format(gstr, sizeof(gstr), "* %s drops something on the ground. *",NameRP(playerid));
  456. ProxDetector(20.0,playerid,gstr,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE);
  457. return true;
  458. }
  459. }
  460. }
  461. else if(amount < iAmount)
  462. {
  463. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO ingredients (ingOwner, ingOwnerType, ingType, ingAmount, ingModel, ingModColor) VALUES (%d, 'D', %d, %d, %d, %d)", -1, cache_get_field_content_int(0, "ingType"), amount, cache_get_field_content_int(0, "ingModel"), cache_get_field_content_int(0, "ingModColor"));
  464. new Cache:result = mysql_query(conn, mquery);
  465. DrugSelectionOffset[playerid] = cache_insert_id(conn);
  466. cache_delete(result, conn);
  467. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = %d WHERE id = %d", iAmount - amount, id);
  468. mysql_pquery(conn, mquery);
  469. mysql_format(conn, mquery, sizeof(mquery), "SELECT * FROM ingredients WHERE id = %d", DrugSelectionOffset[playerid]);
  470. mysql_pquery(conn, mquery, "DropIngredients", "ii", playerid, amount);
  471. return true;
  472. }
  473. else
  474. {
  475. return Dialog_Show(playerid, DropIngredients, DIALOG_STYLE_INPUT, "{FFFFFF}Dropping ingredients", "{FFFFFF}Quantidade Inválida!\nHow many grams do you want to drop?", "Confirmar", "Cancelar");
  476. }
  477. return true;
  478. }
  479. GREENSIDE::DroppingDrugs(playerid, amount)
  480. {
  481. new drugAmount = cache_get_field_content_int(0, "drugAmount"), drugName[64], id = cache_get_field_content_int(0, "id"), drugsEffects[128], drugsComedown[128], qual = cache_get_field_content_int(0, "drugQuality"), drugsOverdose[128];
  482. cache_get_field_content(0, "drugName", drugName, conn);
  483. cache_get_field_content(0, "drugEffects", drugsEffects, conn);
  484. cache_get_field_content(0, "drugComedown", drugsComedown, conn);
  485. cache_get_field_content(0, "drugOverdose", drugsOverdose, conn);
  486. if(amount == drugAmount)
  487. {
  488. for(new p = 1; p < MAX_DRUGS; p++)
  489. {
  490. if(DrugTakenData[p][effActive] == 0)
  491. {
  492. DrugTakenData[p][effSQLID] = id;
  493. cache_get_field_content(0, "drugEffects", DrugTakenData[p][drugEffects], conn, 128);
  494. cache_get_field_content(0, "drugComedown", DrugTakenData[p][drugComedown], conn, 128);
  495. cache_get_field_content(0, "drugOverdose", DrugTakenData[p][drugOverdose], conn, 128);
  496. GetPlayerPos(playerid, DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], DrugTakenData[p][drugPos][2]);
  497. GetXYInFrontOfPlayer(playerid, DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], 1.0);
  498. DrugTakenData[p][effDrugType] = cache_get_field_content_int(0, "drugType");
  499. DrugTakenData[p][effActive] = 2;
  500. DrugTakenData[p][effTakenBy] = -1;
  501. DrugTakenData[p][effActivated] = 0;
  502. DrugTakenData[p][drugVW] = GetPlayerVirtualWorld(playerid);
  503. DrugTakenData[p][drugInt] = GetPlayerInterior(playerid);
  504. DrugTakenData[p][drugsQuality] = qual;
  505. if(amount < 28){
  506. DrugTakenData[p][drugObj] = CreateDynamicObject(19874, DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], DrugTakenData[p][drugPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  507. SetDynamicObjectMaterial(DrugTakenData[p][drugObj], 0, 1279, "craigpackage", "drugs");
  508. }
  509. else if(amount < 112)
  510. {
  511. DrugTakenData[p][drugObj] = CreateDynamicObject(2891, DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], DrugTakenData[p][drugPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  512. SetDynamicObjectMaterial(DrugTakenData[p][drugObj], 0, 1279, "craigpackage", "drugs");
  513. }
  514. else
  515. {
  516. DrugTakenData[p][drugObj] = CreateDynamicObject(1279, DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], DrugTakenData[p][drugPos][2] - 1.0, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  517. }
  518. Streamer_Update(playerid);
  519. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugOwner = -1, drugOwnerType = 'D', drugPosX = %f, drugPosY = %f, drugPosZ = %f WHERE id = %d", DrugTakenData[p][drugPos][0], DrugTakenData[p][drugPos][1], DrugTakenData[p][drugPos][2] - 1.0, id);
  520. mysql_pquery(conn, mquery);
  521. PlayerPlaySound(playerid, 5600, 0.0, 0.0, 0.0);
  522. SendClientMessageF(playerid, COLOR_YELLOW, "You have dropped %d grams of %s on the ground.", amount, drugName);
  523. format(gstr, sizeof(gstr), "* %s drops something on the ground. *",NameRP(playerid),NameRP(GetPVarInt(playerid, "giveDrugs")));
  524. ProxDetector(20.0,playerid,gstr,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE);
  525. return true;
  526. }
  527. }
  528. }
  529. else if(amount < drugAmount)
  530. {
  531. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO drugs (drugName, drugCreatedBy, drugCreatedAt, drugOwner, drugOwnerType, drugType, drugEffects, drugComedown, drugOverdose, drugQuality, drugAmount) VALUES ('%e', %d, %d, %d, 'D', %d, '%e', '%e', '%e', %d, %d)",
  532. drugName, cache_get_field_content_int(0, "drugCreatedBy"), cache_get_field_content_int(0, "drugCreatedAt"), -1, cache_get_field_content_int(0, "drugType"), drugsEffects, drugsComedown, drugsOverdose, qual, amount);
  533. new Cache:result = mysql_query(conn, mquery);
  534. DrugSelectionOffset[playerid] = cache_insert_id(conn);
  535. cache_delete(result, conn);
  536. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugAmount = %d WHERE id = %d", drugAmount - amount, id);
  537. mysql_pquery(conn, mquery);
  538. mysql_format(conn, mquery, sizeof(mquery), "SELECT * FROM drugs WHERE id = %d", DrugSelectionOffset[playerid]);
  539. mysql_pquery(conn, mquery, "DroppingDrugs", "ii", playerid, amount);
  540. return true;
  541. }
  542. else
  543. {
  544. return Dialog_Show(playerid, DropDrugs, DIALOG_STYLE_INPUT, "{FFFFFF}Dropping Drugs", "{FFFFFF}Quantidade Inválida!\nHow many grams do you want to drop?", "Confirmar", "Cancelar");
  545. }
  546. return true;
  547. }
  548. GREENSIDE::PickupDrug(playerid, d)
  549. {
  550. if(cache_num_rows() > 0)
  551. {
  552. new amount = cache_get_field_content_int(0, "drugAmount");
  553. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugAmount = drugAmount + %d WHERE id = %d", amount, cache_get_field_content_int(0, "id"));
  554. mysql_pquery(conn, mquery);
  555. mysql_format(conn, mquery, sizeof(mquery), "DELETE FROM drugs WHERE id = %d", DrugTakenData[d][effSQLID]);
  556. mysql_pquery(conn, mquery);
  557. }
  558. else
  559. {
  560. mysql_format(conn, mquery, sizeof(mquery), "UPDATE drugs SET drugOwner = %d, drugOwnerType = 'P', drugPosX = 0.0, drugPosY = 0.0, drugPosZ = 0.0 WHERE id = %d", SQLID[playerid], DrugTakenData[d][effSQLID]);
  561. mysql_pquery(conn, mquery);
  562. }
  563. switch(DrugTakenData[d][effAmount])
  564. {
  565. case 0..27: SendClientMessage(playerid, COLOR_WHITE, "You picked a small package up from the ground.");
  566. case 28..111: SendClientMessage(playerid, COLOR_WHITE, "You picked a package up from the ground.");
  567. default: SendClientMessage(playerid, COLOR_WHITE, "You picked a large package up from the ground.");
  568. }
  569. DrugTakenData[d][effActive] = 0;
  570. DrugTakenData[d][drugPos][0] = 0.0;
  571. DrugTakenData[d][drugPos][1] = 0.0;
  572. DrugTakenData[d][drugPos][2] = 0.0;
  573. ApplyAnimation(playerid, "CARRY", "liftup", 4,0,0,0,0,0,0);
  574. DestroyDynamicObjectEx(DrugTakenData[d][drugObj], "DrugTakenData[d][drugObj]");
  575. DrugTakenData[d][drugObj] = INVALID_OBJECT_ID;
  576. return true;
  577. }
  578. GREENSIDE::PickupIngredient(playerid, d)
  579. {
  580. if(cache_num_rows() > 0)
  581. {
  582. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount + %d WHERE id = %d", IngredientsData[d][ingredAmount], cache_get_field_content_int(0, "id"));
  583. mysql_pquery(conn, mquery);
  584. mysql_format(conn, mquery, sizeof(mquery), "DELETE FROM ingredients WHERE id = %d", IngredientsData[d][ingredSQLID]);
  585. mysql_pquery(conn, mquery);
  586. }
  587. else
  588. {
  589. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingOwner = %d, ingOwnerType = 'P', ingPosX = 0.0, ingPosY = 0.0, ingPosZ = 0.0 WHERE id = %d", SQLID[playerid], IngredientsData[d][ingredSQLID]);
  590. mysql_pquery(conn, mquery);
  591. }
  592. switch(IngredientsData[d][ingredAmount])
  593. {
  594. case 0..27: SendClientMessage(playerid, COLOR_WHITE, "You picked a small package up from the ground.");
  595. case 28..111: SendClientMessage(playerid, COLOR_WHITE, "You picked a package up from the ground.");
  596. default: SendClientMessage(playerid, COLOR_WHITE, "You picked a large package up from the ground.");
  597. }
  598. IngredientsData[d][ingredSQLID] = 0;
  599. IngredientsData[d][ingredPos][0] = 0.0;
  600. IngredientsData[d][ingredPos][1] = 0.0;
  601. IngredientsData[d][ingredPos][2] = 0.0;
  602. ApplyAnimation(playerid, "CARRY", "liftup", 4,0,0,0,0,0,0);
  603. DestroyDynamicObjectEx(IngredientsData[d][ingredObj], "IngredientsData[d][ingredObj]");
  604. IngredientsData[d][ingredObj] = INVALID_OBJECT_ID;
  605. return true;
  606. }
  607. GREENSIDE::PickupTestIngredient(playerid, type)
  608. {
  609. if(cache_num_rows() > 0)
  610. {
  611. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount + %d WHERE id = %d", 20, cache_get_field_content_int(0, "id"));
  612. mysql_pquery(conn, mquery);
  613. }
  614. else
  615. {
  616. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO ingredients (ingOwner, ingType, ingOwnerType, ingAmount, ingModColor) VALUES (%d, %d, 'P', %d, %d)", SQLID[playerid], type, 20, random(6));
  617. mysql_pquery(conn, mquery);
  618. }
  619. ApplyAnimation(playerid, "CARRY", "liftup", 4,0,0,0,0,0,0);
  620. return true;
  621. }
  622. GREENSIDE::DoingDrugsMate(playerid)
  623. {
  624. for(new p = 1; p < MAX_DRUGS; p++)
  625. {
  626. if(DrugTakenData[p][effActive] == 0)
  627. {
  628. new drugTakenCount = 0;
  629. for(new ov = 0; ov < 10; ov++)
  630. {
  631. if(DrugsTaken[playerid][ov] > 0)
  632. drugTakenCount++;
  633. }
  634. if(drugTakenCount >= 10)
  635. {
  636. format(gstr, sizeof(gstr), "%s lurches forward, violently vomiting up the contents of his stomach", NameRP(playerid));
  637. ProxDetector(20.0,playerid,gstr,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE,COLOR_EMOTE);
  638. cmd_vomit(playerid, "");
  639. return true;
  640. }
  641. new effectsData[128], comedownData[128], overdoseData[128], Float:effArray[15], Float:cmdArray[15], Float:ovrArray[18], l = 0;
  642. cache_get_field_content(0, "drugEffects", effectsData, conn);
  643. cache_get_field_content(0, "drugComedown", comedownData, conn);
  644. cache_get_field_content(0, "drugOverdose", overdoseData, conn);
  645. sscanf(overdoseData, "p<,>a<f>[18]", ovrArray);
  646. sscanf(effectsData, "p<,>a<f>[15]", effArray);
  647. sscanf(comedownData, "p<,>a<f>[15]", cmdArray);
  648. for(new e = 1; e < 13; e+=2)
  649. {
  650. DrugTakenData[p][effAmount][l] = effArray[e];
  651. DrugTakenData[p][effType][l] = effArray[e+1];
  652. l++;
  653. }
  654. l = 0;
  655. for(new k = 3; k < 13; k+=2)
  656. {
  657. DrugTakenData[p][cmdAmount][l] = cmdArray[k];
  658. DrugTakenData[p][cmdType][l] = cmdArray[k + 1];
  659. l++;
  660. }
  661. l = 0;
  662. for(new k = 3; k < 13; k+=2)
  663. {
  664. DrugTakenData[p][ovrAmount][l] = ovrArray[k];
  665. DrugTakenData[p][ovrType][l] = ovrArray[k+1];
  666. l++;
  667. }
  668. DrugTakenData[p][ovrMax] = floatround(ovrArray[1]);
  669. DrugTakenData[p][ovrDuration] = floatround(ovrArray[0]);
  670. DrugTakenData[p][effDuration] = floatround(cmdArray[0]);
  671. DrugTakenData[p][cmdStart] = floatround(cmdArray[1]);
  672. DrugTakenData[p][effSQLID] = cache_get_field_content_int(0, "id");
  673. DrugTakenData[p][effDrugType] = cache_get_field_content_int(0, "drugType");
  674. DrugTakenData[p][effTimeTo] = floatround(effArray[0]);
  675. DrugTakenData[p][effActive] = 1;
  676. DrugTakenData[p][effTakenBy] = SQLID[playerid];
  677. DrugTakenData[p][effActivated] = 0;
  678. for(new d = 0; d < 10; d++)
  679. {
  680. if(DrugsTaken[playerid][d] == -1)
  681. {
  682. DrugsTaken[playerid][d] = p;
  683. break;
  684. }
  685. }
  686. break;
  687. }
  688. }
  689. return true;
  690. }
  691. GREENSIDE::RedoingDrugsMate(playerid, d)
  692. {
  693. new effectsData[128], Float:effArray[15], l = 0;
  694. cache_get_field_content(0, "drugEffects", effectsData, conn);
  695. sscanf(effectsData, "p<,>a<f>[15]", effArray);
  696. for(new e = 1; e < 13; e+=2)
  697. {
  698. DrugTakenData[d][effAmount][l] = effArray[e];
  699. DrugTakenData[d][effType][l] = effArray[e+1];
  700. l++;
  701. }
  702. DrugTakenData[d][effSQLID] = cache_get_field_content_int(0, "id");
  703. DrugTakenData[d][effTimeTo] = floatround(effArray[0]);
  704. DrugTakenData[d][effTakenBy] = SQLID[playerid];
  705. return true;
  706. }
  707. GREENSIDE::RetrieveIngInfo(playerid, offset)
  708. {
  709. format(gstr, sizeof(gstr), "Ingredient\tAmount\n");
  710. for(new r = 0; r < cache_get_row_count(conn); r++)
  711. {
  712. TempIngData[playerid][ingAmount][r] = cache_get_field_content_int(r, "ingAmount");
  713. TempIngData[playerid][ingType][r] = cache_get_field_content_int(r, "ingType");
  714. TempIngData[playerid][ingID][r] = cache_get_field_content_int(r, "id");
  715. TempIngData[playerid][ingModel][r] = cache_get_field_content_int(r, "ingModel");
  716. if(TempIngData[playerid][ingAmount][r] != 0)
  717. format(gstr, sizeof(gstr), "%s%s\t%d\n", gstr, IngredName[TempIngData[playerid][ingType][r]], TempIngData[playerid][ingAmount][r]);
  718. }
  719. if(cache_get_row_count(conn) == 20) strcat(gstr, "Next Page >>\n");
  720. if(offset == 1) strcat(gstr, "<< Previous Page");
  721. if(strmatch(gstr, "Ingredient\tAmount\n")) strcat(gstr, "No ingredients to display.");
  722. Dialog_Show(playerid, DisplayIngredients, DIALOG_STYLE_TABLIST_HEADERS, "Ingredient Inventory", gstr, "Selecionar", "Cancelar");
  723. return true;
  724. }
  725. GREENSIDE::CombineDrug(playerid)
  726. {
  727. for(new i=0; i<3; i++)
  728. {
  729. if(DrugCombineData[playerid][5 + i] != 0)
  730. {
  731. for(new l=0; l<3; l++)
  732. {
  733. if(i != l && DrugCombineData[playerid][5+i] == DrugCombineData[playerid][5+l] && DrugCombineData[playerid][5+l] > 0)
  734. {
  735. SendClientMessage(playerid, COLOR_RED, "Error: You can not use 2 of the same ingredient, increase the amount instead.");
  736. PlayerTextDrawSetPreviewModel(playerid, DrugCombineP[playerid][1 + l], 18631);
  737. DrugCombineData[playerid][1+l] = 18631;
  738. PlayerTextDrawShow(playerid, DrugCombineP[playerid][1+l]);
  739. PlayerTextDrawHide(playerid, DrugCombineP[playerid][4]);
  740. TextDrawHideForPlayer(playerid, DrugCombine[7]);
  741. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount + %d WHERE id = %d", DrugCombineData[playerid][13+l],
  742. DrugCombineData[playerid][17+l]);
  743. mysql_pquery(conn, mquery);
  744. DrugCombineData[playerid][5+l] = 0;
  745. DrugCombineData[playerid][13+l] = 0;
  746. DrugCombineData[playerid][17+1] = 0;
  747. return SelectTextDraw(playerid, COLOR_ORANGE);
  748. }
  749. }
  750. }
  751. if(DrugCombineData[playerid][12] < 1)
  752. {
  753. SendClientMessage(playerid, COLOR_RED, "Error: You must use an ingredient in the first slot to create a compound.");
  754. return SelectTextDraw(playerid, COLOR_ORANGE);
  755. }
  756. if(DrugCombineData[playerid][13] < 1 && DrugCombineData[playerid][14] < 1 && DrugCombineData[playerid][15] < 1)
  757. {
  758. SendClientMessage(playerid, COLOR_RED, "Error: You must use atleast two ingredients in order to create a new drug.");
  759. return SelectTextDraw(playerid, COLOR_ORANGE);
  760. }
  761. if(DrugCombineData[playerid][13+i] != DrugCombineData[playerid][12] && DrugCombineData[playerid][13+i] >= 1)
  762. {
  763. SendClientMessage(playerid, COLOR_RED, "Error: You must use the same amount of ingredients for all ingredients.");
  764. PlayerTextDrawSetPreviewModel(playerid, DrugCombineP[playerid][1 + i], 18631);
  765. DrugCombineData[playerid][1+i] = 18631;
  766. PlayerTextDrawShow(playerid, DrugCombineP[playerid][1+i]);
  767. PlayerTextDrawHide(playerid, DrugCombineP[playerid][4]);
  768. TextDrawHideForPlayer(playerid, DrugCombine[7]);
  769. mysql_format(conn, mquery, sizeof(mquery), "UPDATE ingredients SET ingAmount = ingAmount + %d WHERE id = %d", DrugCombineData[playerid][13+i],
  770. DrugCombineData[playerid][17+i]);
  771. mysql_pquery(conn, mquery);
  772. DrugCombineData[playerid][5+i] = 0;
  773. DrugCombineData[playerid][13+i] = 0;
  774. DrugCombineData[playerid][17+i] = 0;
  775. return SelectTextDraw(playerid, COLOR_ORANGE);
  776. }
  777. }
  778. CancelIngMenu(playerid);
  779. new furniData[64];
  780. for(new j = 0; j < 20; j++)
  781. {
  782. FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][j] = DrugCombineData[playerid][j];
  783. format(furniData, sizeof(furniData), "%s%d,", furniData, FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][j]);
  784. }
  785. mysql_format(conn, mquery, sizeof(mquery), "UPDATE hfurniture SET drugBeingCreated = '%s' WHERE id = %d", furniData, HouseData[IsInHouseID[playerid]][FurnSQLID][CreatingDrugs[playerid][2]]);
  786. mysql_pquery(conn, mquery);
  787. CreatingDrugs[playerid][0] = -1;
  788. HouseData[IsInHouseID[playerid]][DrugTimer][CreatingDrugs[playerid][2]] = 30;
  789. return true;
  790. //Drug making magic!
  791. }
  792. GREENSIDE::ExplosionTimer(playerid)
  793. {
  794. if(ExploTimer[playerid] >= 1)
  795. {
  796. if(ExploTimer[playerid] == 2)
  797. {
  798. new Float:ppos1[3];
  799. GetPlayerPos(playerid, ppos1[0], ppos1[1], ppos1[2]);
  800. PlayerPlaySound(playerid, 1159, ppos1[0], ppos1[1], ppos1[2]);
  801. }
  802. if(ExploTimer[playerid] < 13)
  803. {
  804. new tempstr[32];
  805. format(tempstr, sizeof(tempstr), "LD_NONE:explm%02d", ExploTimer[playerid]);
  806. PlayerTextDrawSetString(playerid, NewDrugTDP[playerid], tempstr);
  807. PlayerTextDrawShow(playerid, NewDrugTDP[playerid]);
  808. }
  809. else if(ExploTimer[playerid] == 13)
  810. {
  811. PlayerTextDrawHide(playerid, NewDrugTDP[playerid]);
  812. PlayerTextDrawSetString(playerid, NewDrugTDP[playerid], "LD_NONE:explm01");
  813. }
  814. else if(ExploTimer[playerid] == 17)
  815. {
  816. ExploTimer[playerid] = 0;
  817. print(IngredName[FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][4]]);
  818. //Base effect calculation
  819. new Float:baseEffectPerc[4], usedBase, dAmount = FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][13];
  820. for(new i=0; i < sizeof(BaseEffects); i++)
  821. {
  822. if(strmatch(IngredName[FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][4]], BaseEffects[i][baseName]))
  823. {
  824. usedBase = i;
  825. baseEffectPerc[0] = BaseEffects[i][baseEffect1][0];
  826. baseEffectPerc[1] = BaseEffects[i][baseEffect2][0];
  827. baseEffectPerc[2] = BaseEffects[i][baseEffect3][0];
  828. baseEffectPerc[3] = BaseEffects[i][baseEffect4][0];
  829. break;
  830. }
  831. }
  832. new weightedTotal = floatround(baseEffectPerc[0] + baseEffectPerc[1] + baseEffectPerc[2] + baseEffectPerc[3]) * 100, Float:randChos, effRand;
  833. new Float:comedownData[17], Float:overdoseData[17];
  834. randChos = randomEx(50, weightedTotal);
  835. while(randChos > 0)
  836. {
  837. effRand = random(4);
  838. randChos = floatsub(randChos, baseEffectPerc[effRand]);
  839. }
  840. new Float:basePreEffects[19];
  841. switch(effRand)
  842. {
  843. case 0:
  844. for(new i=0; i < 19; i++)
  845. basePreEffects[i] = BaseEffects[usedBase][baseEffect1][i+1];
  846. case 1:
  847. for(new i=0; i < 19; i++)
  848. basePreEffects[i] = BaseEffects[usedBase][baseEffect2][i+1];
  849. case 2:
  850. for(new i=0; i < 19; i++)
  851. basePreEffects[i] = BaseEffects[usedBase][baseEffect3][i+1];
  852. case 3:
  853. for(new i=0; i < 19; i++)
  854. basePreEffects[i] = BaseEffects[usedBase][baseEffect4][i+1];
  855. }
  856. new Float:effectCalc[17], b=1;
  857. effectCalc[0] = basePreEffects[0];
  858. for(new i = 1; i < 19; i+=3)
  859. {
  860. effectCalc[b] = floatdiv(randomEx(floatround(basePreEffects[i] * 100), floatround(basePreEffects[i+1] * 100)), 100);
  861. effectCalc[b+1] = basePreEffects[i+2];
  862. b+=2;
  863. }
  864. //Bringing in ingredient calculation
  865. new ingredID[3];
  866. for(new i=0; i < 3; i++)
  867. {
  868. if(FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][5 + i] == -1) continue;
  869. for(new g=1; g < sizeof(IngredEffects); g++)
  870. {
  871. if(strmatch(IngredName[FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][5 + i]], IngredEffects[g][ingName]))
  872. {
  873. if(IngredEffects[g][ingUsedBase] == FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][4])
  874. {
  875. ingredID[i] = g;
  876. break;
  877. }
  878. }
  879. }
  880. }
  881. for(new j = 0; j < 17; j++)
  882. {
  883. comedownData[j] = BaseEffects[usedBase][baseComedown][j];
  884. overdoseData[j] = BaseEffects[usedBase][baseOverdose][j];
  885. }
  886. for(new i=0; i<3; i++)
  887. {
  888. if(ingredID[i] <= 0) continue;
  889. new k = 0;
  890. for(new l=0; l < 5; l++)
  891. {
  892. if(IngredEffects[ingredID[i]][ingType][l] != 0)
  893. {
  894. for(new j=2; j < 11; j+=2)
  895. {
  896. switch(IngredEffects[ingredID[i]][ingType][l])
  897. {
  898. case 11.0:
  899. {
  900. effectCalc[0] += effectCalc[0] * IngredEffects[ingredID[i]][ingEffects][k+1];
  901. break;
  902. }
  903. case 12.0:
  904. {
  905. for(new x=4; x < 11; x+=2)
  906. {
  907. if(effectCalc[x] == 0.0)
  908. {
  909. effectCalc[x] = 12.0;
  910. effectCalc[x-1] = IngredEffects[ingredID[i]][ingEffects][k+1];
  911. break;
  912. }
  913. }
  914. break;
  915. }
  916. case 13.0:
  917. {
  918. for(new z = 4; z < 15; z+=2)
  919. if(comedownData[z] == 0.0)
  920. comedownData[z] = 13.0;
  921. }
  922. }
  923. if(IngredEffects[ingredID[i]][ingType][l] == effectCalc[j] || (IngredEffects[ingredID[i]][ingType][l] == 3.0 && (effectCalc[j] == 1.0 || effectCalc[j] == 2.0)))
  924. {
  925. if(IngredEffects[ingredID[i]][ingEffects][k] > 0.0)
  926. {
  927. switch(IngredEffects[ingredID[i]][ingEffects][k])
  928. {
  929. case 1.0:
  930. {
  931. effectCalc[j-1] = effectCalc[j-1] + floatmul(effectCalc[j-1], floatdiv(randomEx(floatround(IngredEffects[ingredID[i]][ingEffects][k+1] * 100),
  932. floatround(IngredEffects[ingredID[i]][ingEffects][k+2] * 100)), 100));
  933. break;
  934. }
  935. default:
  936. {
  937. new Float:percVal[2];
  938. percVal[0] = IngredEffects[ingredID[i]][ingEffects][k];
  939. percVal[1] = floatsub(1.0, IngredEffects[ingredID[i]][ingEffects][k]);
  940. randChos = randomEx(50, 100);
  941. while(randChos > 0)
  942. {
  943. effRand = random(2);
  944. randChos = floatsub(randChos, percVal[effRand]);
  945. }
  946. effectCalc[j-1] = effectCalc[j-1] + (effectCalc[j-1] * IngredEffects[ingredID[i]][ingEffects][k+effRand]);
  947. break;
  948. }
  949. }
  950. }
  951. }
  952. }
  953. }
  954. k+=3;
  955. }
  956. }
  957. //calculate drug quality reduction from level
  958. new drugQuality = 100, Float:percVal[6][2], p=0;
  959. for(new x = 0; x < 15; x+=3)
  960. {
  961. percVal[p][0] = DrugLevelEffects[x];
  962. percVal[p][1] = x;
  963. p++;
  964. }
  965. percVal[5][0] = 0.02;
  966. randChos = randomEx(50, 100);
  967. while(randChos > 0)
  968. {
  969. effRand = random(6);
  970. randChos = floatsub(randChos, percVal[effRand][0]);
  971. }
  972. switch(effRand)
  973. {
  974. case 5:
  975. {
  976. drugQuality = 100;
  977. }
  978. default:
  979. {
  980. new percEx = randomEx(floatround(DrugLevelEffects[floatround(percVal[effRand][1]) + 1] * 100), floatround(DrugLevelEffects[floatround(percVal[effRand][1]) + 2] * 100)), virtualLevel = DrugLevel[playerid];
  981. if(DrugLevel[playerid] > 9) virtualLevel *= 2;
  982. if(DrugLevel[playerid] > 15) virtualLevel += floatround(floatmul(virtualLevel, 0.25));
  983. drugQuality -= floatround(floatmul(drugQuality, floatdiv(percEx - floatmul(percEx, floatdiv(virtualLevel * 2, 100)), 100)));
  984. }
  985. }
  986. //include comedown data
  987. new newComedown[128], newOverdose[128];
  988. new newDrug[128];
  989. for(new e=0; e < 17; e++)
  990. {
  991. format(newComedown, 128, "%s%.2f, ", newComedown, comedownData[e]);
  992. format(newDrug, 128, "%s%.2f, ", newDrug, effectCalc[e]);
  993. format(newOverdose, 128, "%s%.2f, ", newOverdose, overdoseData[e]);
  994. }
  995. strdel(newComedown, strlen(newComedown) - 2, strlen(newComedown));
  996. strdel(newDrug, strlen(newDrug) - 2, strlen(newDrug));
  997. strdel(newOverdose, strlen(newOverdose) - 2, strlen(newOverdose));
  998. mysql_format(conn, mquery, sizeof(mquery), "INSERT INTO drugs (drugName, drugCreatedBy, drugCreatedAt, drugOwner, drugOwnerType, drugType, drugEffects, drugComedown, drugOverdose, drugQuality, drugAmount) VALUES ('New Drug', %d, %d, %d, 'P', %d, '%e', '%e', '%e', %d, %d)",
  999. SQLID[playerid], gettime(), SQLID[playerid], FurniDrugInfo[IsInHouseID[playerid]][CreatingDrugs[playerid][2]][4], newDrug, newComedown, newOverdose, drugQuality, floatround(dAmount * randomEx(2, 3)));
  1000. mysql_pquery(conn, mquery, "DrugSQLID", "i", playerid);
  1001. TextDrawShowForPlayer(playerid, NewDrugTD[2]);
  1002. SelectTextDraw(playerid, COLOR_ORANGE);
  1003. KillTimer(ExpTimer[playerid]);
  1004. return true;
  1005. }
  1006. ExploTimer[playerid]++;
  1007. }
  1008. return true;
  1009. }
  1010. GREENSIDE::DrugSQLID(playerid)
  1011. {
  1012. SetPVarInt(playerid, "drugSQLID", cache_insert_id());
  1013. return true;
  1014. }
  1015. GREENSIDE::LoadDroppedDrugs()
  1016. {
  1017. for(new d = 0, x = cache_num_rows(); d < x; d++)
  1018. {
  1019. for(new dr = 1; dr < MAX_DRUGS; dr++)
  1020. {
  1021. if(DrugTakenData[dr][effActive] == 0)
  1022. {
  1023. DrugTakenData[dr][effSQLID] = cache_get_field_content_int(d, "id");
  1024. DrugTakenData[dr][effActive] = 2;
  1025. DrugTakenData[dr][effAmount] = cache_get_field_content_int(d, "drugAmount");
  1026. DrugTakenData[dr][drugVW] = cache_get_field_content_int(d, "drugVW");
  1027. DrugTakenData[dr][drugInt] = cache_get_field_content_int(d, "drugInt");
  1028. DrugTakenData[dr][drugPos][0] = cache_get_field_content_float(d, "drugPosX");
  1029. DrugTakenData[dr][drugPos][1] = cache_get_field_content_float(d, "drugPosY");
  1030. DrugTakenData[dr][drugPos][2] = cache_get_field_content_float(d, "drugPosZ");
  1031. cache_get_field_content(d, "drugEffects", DrugTakenData[dr][drugEffects], conn, 128);
  1032. cache_get_field_content(d, "drugComedown", DrugTakenData[dr][drugComedown], conn, 128);
  1033. cache_get_field_content(d, "drugOverdose", DrugTakenData[dr][drugOverdose], conn, 128);
  1034. DrugTakenData[dr][effDrugType] = cache_get_field_content_int(d, "drugType");
  1035. DrugTakenData[dr][effTakenBy] = -1;
  1036. DrugTakenData[dr][effActivated] = 0;
  1037. if(DrugTakenData[dr][effAmount] < 28){
  1038. DrugTakenData[dr][drugObj] = CreateDynamicObject(19874, DrugTakenData[dr][drugPos][0], DrugTakenData[dr][drugPos][1], DrugTakenData[dr][drugPos][2], 0.0, 0.0, 0.0, DrugTakenData[dr][drugVW], DrugTakenData[dr][drugInt]);
  1039. SetDynamicObjectMaterial(DrugTakenData[dr][drugObj], 0, 1279, "craigpackage", "drugs");
  1040. }
  1041. else if(DrugTakenData[dr][effAmount] < 112)
  1042. {
  1043. DrugTakenData[dr][drugObj] = CreateDynamicObject(2891, DrugTakenData[dr][drugPos][0], DrugTakenData[dr][drugPos][1], DrugTakenData[dr][drugPos][2], 0.0, 0.0, 0.0, DrugTakenData[dr][drugVW], DrugTakenData[dr][drugInt]);
  1044. SetDynamicObjectMaterial(DrugTakenData[dr][drugObj], 0, 1279, "craigpackage", "drugs");
  1045. }
  1046. else
  1047. {
  1048. DrugTakenData[dr][drugObj] = CreateDynamicObject(1279, DrugTakenData[dr][drugPos][0], DrugTakenData[dr][drugPos][1], DrugTakenData[dr][drugPos][2], 0.0, 0.0, 0.0, DrugTakenData[dr][drugVW], DrugTakenData[dr][drugInt]);
  1049. }
  1050. break;
  1051. }
  1052. }
  1053. }
  1054. printf("%d loaded drugs", cache_num_rows());
  1055. return true;
  1056. }
  1057. GREENSIDE::LoadDroppedIngred()
  1058. {
  1059. for(new d = 0, x = cache_num_rows(); d < x; d++)
  1060. {
  1061. for(new dr = 1; dr < MAX_INGREDIENTS; dr++)
  1062. {
  1063. if(IngredientsData[dr][ingredPos][0] == 0.0)
  1064. {
  1065. IngredientsData[dr][ingredSQLID] = cache_get_field_content_int(d, "id");
  1066. IngredientsData[dr][ingredAmount] = cache_get_field_content_int(d, "ingAmount");
  1067. IngredientsData[dr][ingredVW] = cache_get_field_content_int(d, "ingVW");
  1068. IngredientsData[dr][ingredInt] = cache_get_field_content_int(d, "ingInt");
  1069. IngredientsData[dr][ingredPos][0] = cache_get_field_content_float(d, "ingPosX");
  1070. IngredientsData[dr][ingredPos][1] = cache_get_field_content_float(d, "ingPosY");
  1071. IngredientsData[dr][ingredPos][2] = cache_get_field_content_float(d, "ingPosZ");
  1072. IngredientsData[dr][ingredType] = cache_get_field_content_int(d, "ingType");
  1073. if(IngredientsData[dr][ingredAmount] < 28){
  1074. IngredientsData[dr][ingredObj] = CreateDynamicObject(19874, IngredientsData[dr][ingredPos][0], IngredientsData[dr][ingredPos][1], IngredientsData[dr][ingredPos][2], 0.0, 0.0, 0.0, IngredientsData[dr][ingredVW], IngredientsData[dr][ingredInt]);
  1075. SetDynamicObjectMaterial(IngredientsData[dr][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(d, "ingModColor")]);
  1076. }
  1077. else if(IngredientsData[dr][ingredAmount] < 112){
  1078. IngredientsData[dr][ingredObj] = CreateDynamicObject(2891, IngredientsData[dr][ingredPos][0], IngredientsData[dr][ingredPos][1], IngredientsData[dr][ingredPos][2], 0.0, 0.0, 0.0, IngredientsData[dr][ingredVW], IngredientsData[dr][ingredInt]);
  1079. SetDynamicObjectMaterial(IngredientsData[dr][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(d, "ingModColor")]);
  1080. }
  1081. else
  1082. {
  1083. IngredientsData[dr][ingredObj] = CreateDynamicObject(1279, IngredientsData[dr][ingredPos][0], IngredientsData[dr][ingredPos][1], IngredientsData[dr][ingredPos][2], 0.0, 0.0, 0.0, IngredientsData[dr][ingredVW], IngredientsData[dr][ingredInt]);
  1084. SetDynamicObjectMaterial(IngredientsData[dr][ingredObj], 0, 1575, "dyn_drugs", IngColors[cache_get_field_content_int(d, "ingModColor")]);
  1085. }
  1086. break;
  1087. }
  1088. }
  1089. }
  1090. printf("%d loaded ingredients", cache_num_rows());
  1091. return true;
  1092. }
  1093. stock CancelIngMenu(playerid)
  1094. {
  1095. for(new i=0; i < sizeof(DrugCombine); i++)
  1096. TextDrawHideForPlayer(playerid, DrugCombine[i]);
  1097. for(new i=0; i < sizeof(DrugCombineP[]); i++)
  1098. PlayerTextDrawHide(playerid, DrugCombineP[playerid][i]);
  1099. return true;
  1100. }
  1101. GREENSIDE::InValidDrugLoc(playerid)
  1102. {
  1103. new cookerObj[6] = {2017, 2135, 2144, 2170, 2339, 2417};
  1104. if(IsInHouseID[playerid] != -1) {
  1105. for(new f = 0; f < MAX_HFURNITURE; f++) {
  1106. for(new a = 0; a < 6; a++) {
  1107. if(HouseData[IsInHouseID[playerid]][FurnModel][f] == cookerObj[a]) {
  1108. new Float:oP[3];
  1109. GetDynamicObjectPos(HouseData[IsInHouseID[playerid]][FurnObject][f], oP[0], oP[1], oP[2]);
  1110. if(IsPlayerInRangeOfPoint(playerid, 2.0, oP[0], oP[1], oP[2]))
  1111. return 1;
  1112. }
  1113. }
  1114. }
  1115. }
  1116. else SysMsg(playerid, "Você precisa estar dentro de uma propriedade para usar esse comando.");
  1117. return false;
  1118. }
  1119. stock IsDruggedUp(playerid)
  1120. {
  1121. for(new dr = 0; dr < 10; dr++)
  1122. {
  1123. if(DrugsTaken[playerid][dr] > 0)
  1124. {
  1125. return true;
  1126. }
  1127. }
  1128. return false;
  1129. }
  1130. //Fim dos comandos de drogas