Advertisement
Guest User

Untitled

a guest
Apr 9th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.30 KB | None | 0 0
  1. /*
  2. Vendedores de armas
  3. Jelly23
  4. */
  5.  
  6. #define FILTERSCRIPT
  7.  
  8. /*Includes*/
  9. #include <a_samp>
  10. #include <izcmd>
  11. #include <a_mysql>
  12. #include <foreach>
  13.  
  14. /*Dialogs*/
  15. #define DIALOG_WEAPONS (0)
  16. #define DIALOG_RCON (1)
  17. #define DIALOG_CRTCR (2)
  18. #define DIALOG_CRTGO (3)
  19. #define DIALOG_CRTET (4)
  20. #define DIALOG_CRTED (5)
  21. #define DIALOG_CRTEY (6)
  22. #define DIALOG_CRTEZ (7)
  23. #define DIALOG_CRTEP (8)
  24.  
  25. /*MySQL*/
  26. #define MYSQL_HOST "localhost"
  27. #define MYSQL_USUARIO "root"
  28. #define MYSQL_DATABASE "minigame"
  29. #define MYSQL_SENHA ""
  30.  
  31. /*Configuration*/
  32. #define VENDEDORES_MAXIMOS 500
  33.  
  34. /*Enumerator*/
  35. enum WeapDealers
  36. {
  37. ActorID,
  38. Text3D:Label,
  39. Weapon1,
  40. Weapon2,
  41. Weapon3,
  42. Weapon4,
  43. Weapon5,
  44. Weapon6,
  45. Weapon7,
  46. Weapon8,
  47. Weapon9,
  48. Weapon10,
  49. Cost1,
  50. Cost2,
  51. Cost3,
  52. Cost4,
  53. Cost5,
  54. Cost6,
  55. Cost7,
  56. Cost8,
  57. Cost9,
  58. Cost10,
  59. Ammo1,
  60. Ammo2,
  61. Ammo3,
  62. Ammo4,
  63. Ammo5,
  64. Ammo6,
  65. Ammo7,
  66. Ammo8,
  67. Ammo9,
  68. Ammo10,
  69. dSkin,
  70. Float:dAngle,
  71. Float:dX,
  72. Float:dY,
  73. Float:dZ,
  74. dWorld
  75. };
  76.  
  77. enum playerInfo
  78. {
  79. CurrentDealer,
  80. CurrentItem[10],
  81. CurrentAmmo[10],
  82. CurrentCost[10]
  83. }
  84.  
  85. /*Iterator*/
  86. new Iterator:DealerLoop<VENDEDORES_MAXIMOS>,
  87.  
  88. /*Array(s) & Others*/
  89. dInfo[VENDEDORES_MAXIMOS][WeapDealers],
  90. pInfo[MAX_PLAYERS][playerInfo],
  91. mysql;
  92.  
  93. #if defined FILTERSCRIPT
  94.  
  95. public OnFilterScriptInit()
  96. {
  97. print("\n--------------------------------------");
  98. print(" Vendedores de armas - Jelly23");
  99. print("--------------------------------------\n");
  100. mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
  101. mysql = mysql_connect(MYSQL_HOST, MYSQL_USUARIO, MYSQL_DATABASE, MYSQL_SENHA);
  102. if(mysql_errno(mysql) != 0)
  103. {
  104. print("Could not connect to the database!");
  105. SendRconCommand("hostname MYSQL| ERROR");
  106. }
  107. else
  108. {
  109. printf("Connected to database: %s", MYSQL_DATABASE);
  110. }
  111. if(!mysql_tquery(mysql, "SELECT * FROM `dealers`", "LoadDealers", ""))
  112. {
  113. printf("[MySQL | ERROR]: Couldn't load the information");
  114. }
  115. return 1;
  116. }
  117.  
  118. public OnFilterScriptExit()
  119. {
  120. return 1;
  121. }
  122.  
  123. #else
  124.  
  125. main()
  126. {
  127. print("\n----------------------------------");
  128. print(" Vendedores de armas - Jelly23");
  129. print("----------------------------------\n");
  130. }
  131.  
  132. #endif
  133.  
  134. /*Callbacks*/
  135. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  136. {
  137. if(dialogid == DIALOG_WEAPONS)
  138. {
  139. if(response)
  140. {
  141. if(GetPlayerMoney(playerid) < pInfo[playerid][CurrentCost][listitem]) return SendClientMessage(playerid,-1,"{FF0000}[!]{FFFFFF} Você não tem dinheiro sulficiente.");
  142. GivePlayerWeapon(playerid,pInfo[playerid][CurrentItem][listitem],pInfo[playerid][CurrentAmmo][listitem]);
  143. GivePlayerMoney(playerid,-pInfo[playerid][CurrentCost][listitem]);
  144. }
  145. }
  146. if(dialogid == DIALOG_RCON)
  147. {
  148. if(response)
  149. {
  150. switch(listitem)
  151. {
  152. case 0:
  153. {
  154. new query[43];
  155. foreach(new dealerid: DealerLoop)
  156. {
  157. DestroyActor(dInfo[dealerid][ActorID]);
  158. Delete3DTextLabel(dInfo[dealerid][Label]);
  159. dInfo[dealerid][Weapon1] = dInfo[dealerid][Weapon2] = dInfo[dealerid][Weapon3] = dInfo[dealerid][Weapon4] = dInfo[dealerid][Weapon5] =
  160. dInfo[dealerid][Weapon6] = dInfo[dealerid][Weapon7] = dInfo[dealerid][Weapon8] = dInfo[dealerid][Weapon9] = dInfo[dealerid][Weapon10] = -1;
  161. mysql_format(mysql,query,sizeof(query),"DELETE FROM `dealers` WHERE `ID` ='%i'",dealerid);
  162. mysql_tquery(mysql,query,"","");
  163. Iter_SafeRemove(DealerLoop, dealerid, dealerid);
  164. }
  165. SendClientMessageToAll(-1,"{FFFF00}[!] {FFFFFF} Todos os vendedores de armas foram removidos por um(a) administrador(a).");
  166. }
  167. case 1:
  168. {
  169. new count = -1;
  170. foreach(new i: DealerLoop)
  171. {
  172. if(IsPlayerInRangeOfPoint(playerid, 1.5, dInfo[i][dX], dInfo[i][dY], dInfo[i][dZ]))
  173. {
  174. count = i;
  175. }
  176. }
  177. if(count == -1) return SendClientMessage(playerid,-1,"{FFFF00}[!] {FFFFFF}Você não está próximo de nenhum vendedor de armas.");
  178. RemoveDealer(count);
  179. }
  180. case 2:
  181. {
  182. new count = -1;
  183. foreach(new i: DealerLoop)
  184. {
  185. if(IsPlayerInRangeOfPoint(playerid, 1.5, dInfo[i][dX], dInfo[i][dY], dInfo[i][dZ]))
  186. {
  187. count = i;
  188. }
  189. }
  190. if(count == -1) return SendClientMessage(playerid,-1,"{FFFF00}[!] {FFFFFF}Você não está próximo de nenhum vendedor de armas.");
  191. dInfo[count][Weapon1] = dInfo[count][Weapon2] = dInfo[count][Weapon3] = dInfo[count][Weapon4] = dInfo[count][Weapon5] = dInfo[count][Weapon6] =
  192. dInfo[count][Weapon7] = dInfo[count][Weapon8] = dInfo[count][Weapon9] = dInfo[count][Weapon10] = -1;
  193. UpdateDealers(pInfo[playerid][CurrentDealer],0);
  194. }
  195. case 3:
  196. {
  197. ShowPlayerDialog(playerid,DIALOG_CRTCR, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Criar vendedor", "Coloque o ID de skin abaixo:", "Criar", "Cancelar");
  198. }
  199. case 4:
  200. {
  201. ShowPlayerDialog(playerid,DIALOG_CRTGO, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Ir para vendedor", "Coloque o ID do vendedor abaixo:", "Ir", "Cancelar");
  202. }
  203. case 5:
  204. {
  205. ShowPlayerDialog(playerid,DIALOG_CRTET, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Editar vendedor", "Coloque o ID do vendedor abaixo:", "Editar", "Cancelar");
  206. }
  207. }
  208. }
  209. }
  210. if(dialogid == DIALOG_CRTCR)
  211. {
  212. if(response)
  213. {
  214. new Float:X,Float:Y,Float:Z,Float:F;
  215. GetPlayerPos(playerid,X,Y,Z);
  216. GetPlayerFacingAngle(playerid,F);
  217. CreateDealer(strval(inputtext), X, Y, Z, F, GetPlayerVirtualWorld(playerid));
  218. SetPlayerPos(playerid,X+2,Y,Z+1);
  219. }
  220. }
  221. if(dialogid == DIALOG_CRTGO)
  222. {
  223. if(response)
  224. {
  225. if (!Iter_Contains(DealerLoop, strval(inputtext))) return SendClientMessage(playerid,-1,"{FFFF00}[!] {FFFFFF} ID de vendedor inválido.");
  226. SetPlayerPos(playerid,dInfo[strval(inputtext)][dX]+2,dInfo[strval(inputtext)][dY],dInfo[strval(inputtext)][dZ]+1);
  227. }
  228. }
  229. if(dialogid == DIALOG_CRTET)
  230. {
  231. if(response)
  232. {
  233. if (!Iter_Contains(DealerLoop, strval(inputtext))) return SendClientMessage(playerid,-1,"{FFFF00}[!] {FFFFFF} ID de vendedor inválido.");
  234. pInfo[playerid][CurrentDealer] = strval(inputtext);
  235. ShowPlayerDialog(playerid,DIALOG_CRTED, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Editar Vendedor", "Entre o slot de arma abaixo\nAs slots são entre: 1-10", "Editar", "Cancelar");
  236. }
  237. }
  238. if(dialogid == DIALOG_CRTED)
  239. {
  240. if(response)
  241. {
  242. if( 1 < strval(inputtext) > 10) return SendClientMessage(playerid,-1,"{FFFF00}[!]{FFFFFF}Slot inválida.");
  243. pInfo[playerid][CurrentItem][0] = strval(inputtext);
  244. ShowPlayerDialog(playerid,DIALOG_CRTEY, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Editar vendedor", "Entre o ID da arma abaixo.\nPara apagar uma arma, use '-1' como ID", "Editar", "Cancelar");
  245. }
  246. }
  247. if(dialogid == DIALOG_CRTEY)
  248. {
  249. if(response)
  250. {
  251. switch(pInfo[playerid][CurrentItem][0])
  252. {
  253. case 1: dInfo[pInfo[playerid][CurrentDealer]][Weapon1] = strval(inputtext);
  254. case 2: dInfo[pInfo[playerid][CurrentDealer]][Weapon2] = strval(inputtext);
  255. case 3: dInfo[pInfo[playerid][CurrentDealer]][Weapon3] = strval(inputtext);
  256. case 4: dInfo[pInfo[playerid][CurrentDealer]][Weapon4] = strval(inputtext);
  257. case 5: dInfo[pInfo[playerid][CurrentDealer]][Weapon5] = strval(inputtext);
  258. case 6: dInfo[pInfo[playerid][CurrentDealer]][Weapon6] = strval(inputtext);
  259. case 7: dInfo[pInfo[playerid][CurrentDealer]][Weapon7] = strval(inputtext);
  260. case 8: dInfo[pInfo[playerid][CurrentDealer]][Weapon8] = strval(inputtext);
  261. case 9: dInfo[pInfo[playerid][CurrentDealer]][Weapon9] = strval(inputtext);
  262. case 10: dInfo[pInfo[playerid][CurrentDealer]][Weapon10] = strval(inputtext);
  263. }
  264. UpdateDealers(pInfo[playerid][CurrentDealer],0);
  265. if(strval(inputtext) == -1) return SendClientMessage(playerid,-1,"{FFFF00}[!]{FFFFFF} Armas removidas.");
  266. ShowPlayerDialog(playerid,DIALOG_CRTEZ, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Editar Vendedor", "Quantidade de balas\n9999 é o máximo de balas.", "Editar", "Cancelar");
  267. }
  268. }
  269. if(dialogid == DIALOG_CRTEZ)
  270. {
  271. if(response)
  272. {
  273. switch(pInfo[playerid][CurrentItem][0])
  274. {
  275. case 1: dInfo[pInfo[playerid][CurrentDealer]][Ammo1] = strval(inputtext);
  276. case 2: dInfo[pInfo[playerid][CurrentDealer]][Ammo2] = strval(inputtext);
  277. case 3: dInfo[pInfo[playerid][CurrentDealer]][Ammo3] = strval(inputtext);
  278. case 4: dInfo[pInfo[playerid][CurrentDealer]][Ammo4] = strval(inputtext);
  279. case 5: dInfo[pInfo[playerid][CurrentDealer]][Ammo5] = strval(inputtext);
  280. case 6: dInfo[pInfo[playerid][CurrentDealer]][Ammo6] = strval(inputtext);
  281. case 7: dInfo[pInfo[playerid][CurrentDealer]][Ammo7] = strval(inputtext);
  282. case 8: dInfo[pInfo[playerid][CurrentDealer]][Ammo8] = strval(inputtext);
  283. case 9: dInfo[pInfo[playerid][CurrentDealer]][Ammo9] = strval(inputtext);
  284. case 10: dInfo[pInfo[playerid][CurrentDealer]][Ammo10] = strval(inputtext);
  285. }
  286. UpdateDealers(pInfo[playerid][CurrentDealer],1);
  287. ShowPlayerDialog(playerid,DIALOG_CRTEP, DIALOG_STYLE_INPUT, "Vendedores »{FFFFFF} Editar vendedor", "Custo da arma\nColoque qualquer valor como custo.", "Editar", "Cancelar");
  288. }
  289. }
  290. if(dialogid == DIALOG_CRTEP)
  291. {
  292. if(response)
  293. {
  294. switch(pInfo[playerid][CurrentItem][0])
  295. {
  296. case 1: dInfo[pInfo[playerid][CurrentDealer]][Cost1] = strval(inputtext);
  297. case 2: dInfo[pInfo[playerid][CurrentDealer]][Cost2] = strval(inputtext);
  298. case 3: dInfo[pInfo[playerid][CurrentDealer]][Cost3] = strval(inputtext);
  299. case 4: dInfo[pInfo[playerid][CurrentDealer]][Cost4] = strval(inputtext);
  300. case 5: dInfo[pInfo[playerid][CurrentDealer]][Cost5] = strval(inputtext);
  301. case 6: dInfo[pInfo[playerid][CurrentDealer]][Cost6] = strval(inputtext);
  302. case 7: dInfo[pInfo[playerid][CurrentDealer]][Cost7] = strval(inputtext);
  303. case 8: dInfo[pInfo[playerid][CurrentDealer]][Cost8] = strval(inputtext);
  304. case 9: dInfo[pInfo[playerid][CurrentDealer]][Cost9] = strval(inputtext);
  305. case 10: dInfo[pInfo[playerid][CurrentDealer]][Cost10] = strval(inputtext);
  306. }
  307. UpdateDealers(pInfo[playerid][CurrentDealer],2);
  308. SendClientMessage(playerid,-1,"{FF0000}[!]{FFFFFF} Slot de arma editada.");
  309. }
  310. }
  311. return 1;
  312. }
  313.  
  314. forward LoadDealers();
  315. public LoadDealers()
  316. {
  317. new t,string[59];
  318. for(new i = 0; i < cache_get_row_count(); i++)
  319. {
  320. t = cache_get_field_content_int(i,"ID");
  321. Iter_Add(DealerLoop,t);
  322.  
  323. dInfo[t][dSkin] = cache_get_field_content_int(i,"dSkin");
  324.  
  325. dInfo[t][dX] = cache_get_field_content_float(i, "dX");
  326. dInfo[t][dY] = cache_get_field_content_float(i, "dY");
  327. dInfo[t][dZ] = cache_get_field_content_float(i, "dZ");
  328.  
  329. dInfo[t][dAngle] = cache_get_field_content_float(i, "dAngle");
  330.  
  331. format(string,sizeof(string),"{FF0000}Vendedor De Armas (%i)\n\n{FFFFFF}Use {00FF00}/armas",t);
  332. dInfo[t][ActorID] = CreateActor(dInfo[t][dSkin], dInfo[t][dX], dInfo[t][dY], dInfo[t][dZ], dInfo[t][dAngle]);
  333. dInfo[t][Label] = Create3DTextLabel(string, -1,dInfo[t][dX],dInfo[t][dY],dInfo[t][dZ]+0.4, 5.0,0, 0);
  334.  
  335. dInfo[t][Weapon1] = cache_get_field_content_int(i,"Weapon1");
  336. dInfo[t][Weapon2] = cache_get_field_content_int(i,"Weapon2");
  337. dInfo[t][Weapon3] = cache_get_field_content_int(i,"Weapon3");
  338. dInfo[t][Weapon4] = cache_get_field_content_int(i,"Weapon4");
  339. dInfo[t][Weapon5] = cache_get_field_content_int(i,"Weapon5");
  340. dInfo[t][Weapon6] = cache_get_field_content_int(i,"Weapon6");
  341. dInfo[t][Weapon7] = cache_get_field_content_int(i,"Weapon7");
  342. dInfo[t][Weapon8] = cache_get_field_content_int(i,"Weapon8");
  343. dInfo[t][Weapon9] = cache_get_field_content_int(i,"Weapon9");
  344. dInfo[t][Weapon10] = cache_get_field_content_int(i,"Weapon10");
  345.  
  346. dInfo[t][Cost1] = cache_get_field_content_int(i,"Cost1");
  347. dInfo[t][Cost2] = cache_get_field_content_int(i,"Cost2");
  348. dInfo[t][Cost3] = cache_get_field_content_int(i,"Cost3");
  349. dInfo[t][Cost4] = cache_get_field_content_int(i,"Cost4");
  350. dInfo[t][Cost5] = cache_get_field_content_int(i,"Cost5");
  351. dInfo[t][Cost6] = cache_get_field_content_int(i,"Cost6");
  352. dInfo[t][Cost7] = cache_get_field_content_int(i,"Cost7");
  353. dInfo[t][Cost8] = cache_get_field_content_int(i,"Cost8");
  354. dInfo[t][Cost9] = cache_get_field_content_int(i,"Cost9");
  355. dInfo[t][Cost10] = cache_get_field_content_int(i,"Cost10");
  356.  
  357. dInfo[t][Ammo1] = cache_get_field_content_int(i,"Ammo1");
  358. dInfo[t][Ammo2] = cache_get_field_content_int(i,"Ammo2");
  359. dInfo[t][Ammo3] = cache_get_field_content_int(i,"Ammo3");
  360. dInfo[t][Ammo4] = cache_get_field_content_int(i,"Ammo4");
  361. dInfo[t][Ammo5] = cache_get_field_content_int(i,"Ammo5");
  362. dInfo[t][Ammo6] = cache_get_field_content_int(i,"Ammo6");
  363. dInfo[t][Ammo7] = cache_get_field_content_int(i,"Ammo7");
  364. dInfo[t][Ammo8] = cache_get_field_content_int(i,"Ammo8");
  365. dInfo[t][Ammo9] = cache_get_field_content_int(i,"Ammo9");
  366. dInfo[t][Ammo10] = cache_get_field_content_int(i,"Ammo10");
  367. }
  368. printf("\n=======================================\n");
  369. printf(" Vendedores de armas carregados!\n");
  370. printf(" Um total de %d vendedores de %d carregados\n", cache_get_row_count(), VENDEDORES_MAXIMOS);
  371. printf("\n=======================================\n");
  372. }
  373.  
  374. /*Funções*/
  375. CreateDealer(Skin, Float:X, Float:Y, Float:Z, Float:Angle, World)
  376. {
  377. new FreeID = Iter_Free(DealerLoop),query[621];
  378. format(query,sizeof(query),"{FF0000}Vendedor De Armas (%i)\n\nUse {00FF00}/armas",FreeID);
  379. Iter_Add(DealerLoop, FreeID);
  380. dInfo[FreeID][dAngle] = Angle;
  381. dInfo[FreeID][dWorld] = World;
  382. dInfo[FreeID][dSkin] = Skin;
  383. dInfo[FreeID][dX] = X,dInfo[FreeID][dY] = Y,dInfo[FreeID][dZ] = Z;
  384. dInfo[FreeID][Weapon1] = dInfo[FreeID][Weapon2] = dInfo[FreeID][Weapon3] = dInfo[FreeID][Weapon4] = dInfo[FreeID][Weapon5] =
  385. dInfo[FreeID][Weapon6] = dInfo[FreeID][Weapon7] = dInfo[FreeID][Weapon8] = dInfo[FreeID][Weapon9] = dInfo[FreeID][Weapon10] = -1;
  386. dInfo[FreeID][ActorID] = CreateActor(Skin, X, Y, Z, Angle);
  387. SetActorVirtualWorld(dInfo[FreeID][ActorID], World);
  388. dInfo[FreeID][Label] = Create3DTextLabel(query, -1,dInfo[FreeID][dX],dInfo[FreeID][dY],dInfo[FreeID][dZ]+0.4, 5.0,0, 0);
  389. mysql_format(mysql, query, sizeof(query), "INSERT INTO `dealers` (`ID`, `dSkin`, `dX`, `dY`, `dZ`, `dAngle`, `Weapon1`, `Weapon2` , `Weapon3`, `Weapon4`, `Weapon5`, `Weapon6`, `Weapon7`, `Weapon8`, `Weapon9`, `Weapon10`) VALUES ('%i', '%i', '%f', '%f', \
  390. '%f', '%f', '%i', '%i', '%i','%i', '%i', '%i', '%i', '%i', '%i', '%i')",
  391. FreeID,dInfo[FreeID][dSkin],dInfo[FreeID][dX],dInfo[FreeID][dY],dInfo[FreeID][dZ],dInfo[FreeID][dAngle],dInfo[FreeID][Weapon1],dInfo[FreeID][Weapon2],dInfo[FreeID][Weapon3],dInfo[FreeID][Weapon4],dInfo[FreeID][Weapon5],dInfo[FreeID][Weapon6],dInfo[FreeID][Weapon7],dInfo[FreeID][Weapon8],dInfo[FreeID][Weapon9],dInfo[FreeID][Weapon10]);
  392. mysql_tquery(mysql, query, "","");
  393. }
  394.  
  395. RemoveDealer(dealerid)
  396. {
  397. new query[43];
  398. Iter_Remove(DealerLoop, dealerid);
  399. DestroyActor(dInfo[dealerid][ActorID]);
  400. Delete3DTextLabel(dInfo[dealerid][Label]);
  401. dInfo[dealerid][Weapon1] = dInfo[dealerid][Weapon2] = dInfo[dealerid][Weapon3] = dInfo[dealerid][Weapon4] = dInfo[dealerid][Weapon5] =
  402. dInfo[dealerid][Weapon6] = dInfo[dealerid][Weapon7] = dInfo[dealerid][Weapon8] = dInfo[dealerid][Weapon9] = dInfo[dealerid][Weapon10] = -1;
  403. mysql_format(mysql,query,sizeof(query),"DELETE FROM `dealers` WHERE `ID` ='%i'",dealerid);
  404. mysql_tquery(mysql,query,"","");
  405. }
  406.  
  407. UpdateDealers(i,updateid)
  408. {
  409. new query[352];
  410. switch(updateid)
  411. {
  412. case 0:
  413. {
  414. mysql_format(mysql, query, sizeof(query), "UPDATE `dealers` SET `Weapon1` ='%i' , `Weapon2` ='%i' , `Weapon3` ='%i' , `Weapon4` ='%i', `Weapon5` = '%i', `Weapon6` ='%i', `Weapon7` ='%i', `Weapon8` ='%i', `Weapon9` ='%i', `Weapon10` ='%i' WHERE `ID` = '%i'",
  415. dInfo[i][Weapon1],dInfo[i][Weapon2],dInfo[i][Weapon3],dInfo[i][Weapon4],dInfo[i][Weapon5],dInfo[i][Weapon6],dInfo[i][Weapon7],dInfo[i][Weapon8],dInfo[i][Weapon9],dInfo[i][Weapon10],i);
  416. mysql_tquery(mysql,query,"","");
  417. }
  418. case 1:
  419. {
  420. mysql_format(mysql, query, sizeof(query), "UPDATE `dealers` SET `Ammo1` ='%i' , `Ammo2` ='%i' , `Ammo3` ='%i' , `Ammo4` ='%i', `Ammo5` = '%i', `Ammo6` ='%i', `Ammo7` ='%i', `Ammo8` ='%i', `Ammo9` ='%i', `Ammo10` ='%i' WHERE `ID` = '%i'",
  421. dInfo[i][Ammo1],dInfo[i][Ammo2],dInfo[i][Ammo3],dInfo[i][Ammo4],dInfo[i][Ammo5],dInfo[i][Ammo6],dInfo[i][Ammo7],dInfo[i][Ammo8],dInfo[i][Ammo9],dInfo[i][Ammo10],i);
  422. mysql_tquery(mysql,query,"","");
  423. }
  424. case 2:
  425. {
  426. mysql_format(mysql, query, sizeof(query), "UPDATE `dealers` SET `Cost1` ='%i' , `Cost2` ='%i' , `Cost3` ='%i' , `Cost4` ='%i', `Cost5` = '%i', `Cost6` ='%i', `Cost7` ='%i', `Cost8` ='%i', `Cost9` ='%i', `Cost10` ='%i' WHERE `ID` = '%i'",
  427. dInfo[i][Cost1],dInfo[i][Cost2],dInfo[i][Cost3],dInfo[i][Cost4],dInfo[i][Cost5],dInfo[i][Cost6],dInfo[i][Cost7],dInfo[i][Cost8],dInfo[i][Cost9],dInfo[i][Cost10],i);
  428. mysql_tquery(mysql,query,"","");
  429. }
  430. }
  431. }
  432.  
  433. ShowWeaps(playerid,dealerid)
  434. {
  435. new i[1043],z,x,y;
  436. format(i,sizeof(i),"Arma\tCusto\tBalas\n");
  437. for(new p = 2; p < 12; p++)
  438. {
  439. if(dInfo[dealerid][WeapDealers:p] != -1)
  440. {
  441. z = p+10;
  442. x = p+20;
  443. pInfo[playerid][CurrentCost][y] = dInfo[dealerid][WeapDealers:z];
  444. pInfo[playerid][CurrentAmmo][y] = dInfo[dealerid][WeapDealers:x];
  445. pInfo[playerid][CurrentItem][y] = dInfo[dealerid][WeapDealers:p];
  446. format(i,sizeof(i),"%s{FFFFFF}%s\t{00FF00}$%i\t{FFFFFF}%i\n",i,GetWeaponNameEx(dInfo[dealerid][WeapDealers:p]),dInfo[dealerid][WeapDealers:z],dInfo[dealerid][WeapDealers:x]);
  447. y++;
  448. }
  449. }
  450. if(y == 0) return SendClientMessage(playerid,-1,"{FFFF00}[!]{FFFFFF} Esse vendedor não tem armas.");
  451. ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_TABLIST_HEADERS, "Comprar Arma",i,"Selecionar","Cancelar");
  452. return 1;
  453. }
  454.  
  455. GetWeaponNameEx(weaponid)
  456. {
  457. new weaponna[32];
  458. switch(weaponid)
  459. {
  460. case 18: weaponna = "Molotov Cocktail";
  461. case 44: weaponna = "Night Vision Goggles";
  462. case 45: weaponna = "Thermal Goggles";
  463. default: GetWeaponName(weaponid, weaponna, sizeof(weaponna));
  464. }
  465. return weaponna;
  466. }
  467.  
  468.  
  469. /*Comandos*/
  470. CMD:armas(playerid)
  471. {
  472. new count;
  473. foreach(new i: DealerLoop)
  474. {
  475. if(IsPlayerInRangeOfPoint(playerid, 1.5, dInfo[i][dX], dInfo[i][dY], dInfo[i][dZ]))
  476. {
  477. pInfo[playerid][CurrentDealer] = i;
  478. count++;
  479. }
  480. }
  481. if(count == 0) return SendClientMessage(playerid,-1,"{FFFF00}[!] {FFFFFF}Você não está próximo de nenhum vendedor.");
  482. ShowWeaps(playerid,pInfo[playerid][CurrentDealer]);
  483. return 1;
  484. }
  485.  
  486. CMD:vamenu(playerid)
  487. {
  488. if(IsPlayerAdmin(playerid))
  489. {
  490. new count,string[151];
  491. foreach(new c: DealerLoop)
  492. {
  493. count++;
  494. }
  495. format(string,sizeof(string),"%s» Remover vendedores {FF0000}(%i)\n{FFFFFF}» Remover vendedor próximo\n» Resetar vendedor próximo\n» Criar vendedor\n» Ir para vendedor\n» Editar vendedor",string,count);
  496. ShowPlayerDialog(playerid, DIALOG_RCON, DIALOG_STYLE_LIST, "Vendedores",string, "Selecionar", "Cancelar");
  497. }
  498. return 1;
  499. }
  500.  
  501. CMD:test245(playerid)
  502. {
  503. if(IsPlayerAdmin(playerid))
  504. {
  505. GivePlayerMoney(playerid,10000);
  506. }
  507. return 1;
  508. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement