Rei_Ayanami

grafite

Feb 9th, 2021 (edited)
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.30 KB | None | 0 0
  1. /*
  2. criado por NurbWill;
  3. Versão: 0.2b
  4. Skype: Nurb.Will
  5.  
  6. Thanks
  7. Zeex for ZCMD
  8. Incognito for Streamer
  9. DOF2 for ...
  10. */
  11.  
  12. #include <a_samp>
  13. #include <streamer>
  14. #include <zcmd>
  15. #include <dof2>
  16.  
  17. #define GRAFITE_FOLDER "grafite/%s.ini"
  18.  
  19. #define MAX_PLAYERS_TAGS (5) // Maximo de grafite tags criado por player.
  20.  
  21. #define SPRAY_TAG_TIMER (4) // Segundos para criar a grafite tag.
  22. #define SPRAY_TAG_OBJECT (19353) // ID do objeto.
  23. #define SPRAY_TAG_OBJECT_DISTANCE (200.0) // Distância em que pode ser visto a grafite tag
  24.  
  25. // ######### Tipo de diálogo personalizado #########
  26. #define TYPE_LIST_MENU (0)
  27. #define TYPE_LIST_EDIT (1)
  28. #define TYPE_LIST_CREATE (2)
  29. #define TYPE_LIST_TAGS (3)
  30. #define TYPE_LIST_TAGS_DELETE (4)
  31. #define TYPE_LIST_TAGS_CREATE (5)
  32. #define TYPE_LIST_TAGS_FIGND (6)
  33.  
  34. // *********** ID de diálogo #########
  35. #define GRAFITE_MENU (9800)
  36. #define GRAFITE_DELETE (9801)
  37. #define GRAFITE_CREATE (9802)
  38. #define GRAFITE_CREATE_MAIN (9803)
  39. #define GRAFITE_CREATE_TEXT (9804)
  40. #define GRAFITE_CREATE_FONT (9805)
  41. #define GRAFITE_CREATE_SIZE (9806)
  42. #define GRAFITE_CREATE_COLOR (9807)
  43. #define GRAFITE_CREATE_FINISH (9808)
  44. #define GRAFITE_EDIT_MAIN (9809)
  45. #define GRAFITE_EDIT_TEXT (9810)
  46. #define GRAFITE_EDIT_FONT (9811)
  47. #define GRAFITE_EDIT_SIZE (9812)
  48. #define GRAFITE_EDIT_COLOR (9813)
  49. #define GRAFITE_EDIT_FINISH (9814)
  50. #define GRAFITE_EDIT_LIST (9815)
  51. #define GRAFITE_FIND (9816)
  52. #define GRAFITE_DIALOG_RETURN (9817)
  53.  
  54. enum GRAFITE_DATA
  55. {
  56. _spSQLID,
  57. _spObject,
  58. _spText[50],
  59. _spOwned[MAX_PLAYER_NAME],
  60. _spFontColor,
  61. _spBold,
  62. _spFontSize,
  63. _spFont[50],
  64. Float:_spPosX,
  65. Float:_spPosY,
  66. Float:_spPosZ,
  67. Float:_spPosRX,
  68. Float:_spPosRY,
  69. Float:_spPosRZ,
  70. _spVW,
  71. _spInt
  72. }
  73.  
  74. new
  75. GRAFITEs[MAX_PLAYERS][MAX_PLAYERS_TAGS][GRAFITE_DATA],
  76. GRAFITE_object[MAX_PLAYERS],
  77. GRAFITE_timer[MAX_PLAYERS],
  78. GRAFITE_timer_left[MAX_PLAYERS],
  79. GRAFITE_find[MAX_PLAYERS],
  80. GRAFITE_slot[MAX_PLAYERS],
  81. GRAFITE_text[MAX_PLAYERS],
  82. GRAFITE_size[MAX_PLAYERS],
  83. GRAFITE_bold[MAX_PLAYERS],
  84. GRAFITE_color[MAX_PLAYERS],
  85. GRAFITE_font[MAX_PLAYERS],
  86. Float:GRAFITE_positions[MAX_PLAYERS][6]
  87. ;
  88.  
  89.  
  90. public OnFilterScriptInit()
  91. {
  92. print("\n--------------------------------------");
  93. print("Sistema de Grafite | Versão: 0.2b - By: Nurb Will;");
  94. print("--------------------------------------\n");
  95. return 1;
  96. }
  97.  
  98. public OnFilterScriptExit()
  99. {
  100. DOF2_Exit();
  101. }
  102.  
  103. public OnPlayerConnect(playerid)
  104. {
  105. Tag_Load(playerid);
  106. return 1;
  107. }
  108.  
  109. forward GRAFITE_Dialog(iPlayerID, iType);
  110. public GRAFITE_Dialog(iPlayerID, iType)
  111. {
  112. new
  113. szDialog[500],
  114. szText[50],
  115. szFont[50],
  116. szBold[4],
  117. szColor[30]
  118. ;
  119.  
  120. switch(iType)
  121. {
  122. case TYPE_LIST_MENU:
  123. {
  124. ShowPlayerDialog(iPlayerID, GRAFITE_MENU, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Menu", "Criar Grafite tag\nEditar Grafite tag\nDeletar Grafite tag\nRastrear tag's", "Selecionar", "Sair");
  125. }
  126. case TYPE_LIST_CREATE:
  127. {
  128. switch(GRAFITE_bold[iPlayerID])
  129. {
  130. case 0: szBold = "Não";
  131. case 1: szBold = "Sim";
  132. }
  133. switch(GRAFITE_color[iPlayerID])
  134. {
  135. case -65536: szColor = "{FF0000}Vermelho";
  136. case -16468988: szColor = "{04B404}Verde";
  137. case -16730675: szColor = "{00B5CD}Azul Claro";
  138. case -256: szColor = "{FFFF00}Amarelo";
  139. case -16776961: szColor = "{0000FF}Azul";
  140. case -8092540: szColor = "{848484}Cinza";
  141. case -65281: szColor = "{FF00FF}Rosa";
  142. case -1: szColor = "{FFFFFF}Branco";
  143. }
  144.  
  145. format(szText, 50, GRAFITE_text[iPlayerID]);
  146. format(szFont, 50, GRAFITE_font[iPlayerID]);
  147.  
  148. format(szDialog, sizeof szDialog, "\
  149. {F7EC6F}Texto: %s\n\
  150. {F7EC6F}Fonte: %s\n\
  151. {F7EC6F}Tamanho: %d\n\
  152. {F7EC6F}Cor: %s\n\
  153. {F7EC6F}Negrito: %s\n\
  154. {FFB957}Criar Tag",
  155. szText,
  156. szFont,
  157. GRAFITE_size[iPlayerID],
  158. szColor,
  159. szBold
  160. );
  161. ShowPlayerDialog(iPlayerID, GRAFITE_CREATE_MAIN, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Customizacao", szDialog, "Selecionar", "Voltar");
  162. }
  163. case TYPE_LIST_EDIT:
  164. {
  165. switch(GRAFITE_bold[iPlayerID])
  166. {
  167. case 0: szBold = "Nao";
  168. case 1: szBold = "Sim";
  169. }
  170. switch(GRAFITE_color[iPlayerID])
  171. {
  172. case -65536: szColor = "{FF0000}Vermelho";
  173. case -16468988: szColor = "{04B404}Verde";
  174. case -16730675: szColor = "{00B5CD}Azul Claro";
  175. case -256: szColor = "{FFFF00}Amarelo";
  176. case -16776961: szColor = "{0000FF}Azul";
  177. case -8092540: szColor = "{848484}Cinza";
  178. case -65281: szColor = "{FF00FF}Rosa";
  179. case -1: szColor = "{FFFFFF}Branco";
  180. }
  181.  
  182. format(szDialog, sizeof szDialog, "\
  183. {F7EC6F}Texto: %s\n\
  184. {F7EC6F}Fonte: %s\n\
  185. {F7EC6F}Tamanho: %d\n\
  186. {F7EC6F}Cor: %s\n\
  187. {F7EC6F}Negrito: %s\n\
  188. {1EAAD9}Editar Tag",
  189. GRAFITE_text[iPlayerID],
  190. GRAFITE_font[iPlayerID],
  191. GRAFITE_size[iPlayerID],
  192. szColor,
  193. szBold
  194. );
  195. ShowPlayerDialog(iPlayerID, GRAFITE_EDIT_LIST, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Customizacao", szDialog, "Selecionar", "Voltar");
  196. }
  197. case TYPE_LIST_TAGS:
  198. {
  199. new
  200. szName[MAX_PLAYER_NAME]
  201. ;
  202.  
  203. GetPlayerName(iPlayerID, szName, sizeof szName);
  204. for(new i; i < MAX_PLAYERS_TAGS; i++)
  205. {
  206. new szTag[24];
  207. format(szTag, sizeof szTag, "{F7EC6F}Livre");
  208. if(GRAFITEs[iPlayerID][i][_spPosX] != 0.0 && GRAFITEs[iPlayerID][i][_spPosY] != 0.0)
  209. {
  210. format(szTag, sizeof(szTag), "{F7EC6F}Grafite Tag #%i", i);
  211. }
  212. format(szDialog, sizeof(szDialog), "%s%s\n", szDialog, szTag);
  213. }
  214.  
  215. ShowPlayerDialog(iPlayerID, GRAFITE_EDIT_MAIN, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Editar suas tag's", szDialog, "Selecionar", "Voltar");
  216. }
  217. case TYPE_LIST_TAGS_DELETE:
  218. {
  219. new
  220. szName[MAX_PLAYER_NAME]
  221. ;
  222.  
  223. GetPlayerName(iPlayerID, szName, sizeof szName);
  224.  
  225. for(new i; i < MAX_PLAYERS_TAGS; i++)
  226. {
  227. new szTag[24];
  228. format(szTag, sizeof szTag, "{F7EC6F}Livre");
  229. if(GRAFITEs[iPlayerID][i][_spPosX] != 0.0 && GRAFITEs[iPlayerID][i][_spPosY] != 0.0)
  230. {
  231. format(szTag, sizeof(szTag), "{F7EC6F}Grafite Tag #%i", i);
  232. }
  233. format(szDialog, sizeof(szDialog), "%s%s\n", szDialog, szTag);
  234. }
  235. ShowPlayerDialog(iPlayerID, GRAFITE_DELETE, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Deletar suas tag's", szDialog, "Selecionar", "Voltar");
  236. }
  237. case TYPE_LIST_TAGS_CREATE:
  238. {
  239. new
  240. szName[MAX_PLAYER_NAME]
  241. ;
  242.  
  243. GetPlayerName(iPlayerID, szName, sizeof szName);
  244.  
  245. for(new i; i < MAX_PLAYERS_TAGS; i++)
  246. {
  247. new szTag[24];
  248. format(szTag, sizeof szTag, "{F7EC6F}Livre");
  249. if(GRAFITEs[iPlayerID][i][_spPosX] != 0.0 && GRAFITEs[iPlayerID][i][_spPosY] != 0.0)
  250. {
  251. format(szTag, sizeof(szTag), "{F7EC6F}Grafite Tag #%i", i);
  252. }
  253. format(szDialog, sizeof(szDialog), "%s%s\n", szDialog, szTag);
  254. }
  255. ShowPlayerDialog(iPlayerID, GRAFITE_CREATE, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Selecione um slot livre", szDialog, "Selecionar", "Voltar");
  256. }
  257. case TYPE_LIST_TAGS_FIND:
  258. {
  259. new
  260. szName[MAX_PLAYER_NAME]
  261. ;
  262.  
  263. GetPlayerName(iPlayerID, szName, sizeof szName);
  264.  
  265. for(new i; i < MAX_PLAYERS_TAGS; i++)
  266. {
  267. new szTag[24];
  268. format(szTag, sizeof szTag, "{F7EC6F}Livre");
  269. if(GRAFITEs[iPlayerID][i][_spPosX] != 0.0 && GRAFITEs[iPlayerID][i][_spPosY] != 0.0)
  270. {
  271. format(szTag, sizeof(szTag), "{F7EC6F}Grafite Tag #%i", i);
  272. }
  273. format(szDialog, sizeof(szDialog), "%s%s\n", szDialog, szTag);
  274. }
  275. ShowPlayerDialog(iPlayerID, GRAFITE_FIND, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Selecione a tag que voce deseja encontrar", szDialog, "Selecionar", "Voltar");
  276. }
  277. }
  278. return 1;
  279. }
  280.  
  281. public OnPlayerEnterCheckpoint(playerid)
  282. {
  283. if(GRAFITE_find[playerid])
  284. {
  285. SendClientMessage(playerid, -1, "Voce chegou na sua Grafite tag.");
  286. DisablePlayerCheckpoint(playerid);
  287. }
  288. return 1;
  289. }
  290.  
  291. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  292. {
  293. switch(dialogid)
  294. {
  295. case GRAFITE_DIALOG_RETURN: GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  296. case GRAFITE_MENU:
  297. {
  298. if(!response) return 1;
  299. switch(listitem)
  300. {
  301. case 0:
  302. {
  303. GRAFITE_Dialog(playerid, TYPE_LIST_TAGS_CREATE);
  304. }
  305. case 1: GRAFITE_Dialog(playerid, TYPE_LIST_TAGS);
  306. case 2: GRAFITE_Dialog(playerid, TYPE_LIST_TAGS_DELETE);
  307. case 3: GRAFITE_Dialog(playerid, TYPE_LIST_TAGS_FIND);
  308. }
  309. }
  310. case GRAFITE_EDIT_MAIN:
  311. {
  312. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  313. if(GRAFITEs[playerid][listitem][_spPosX] == 0.0)
  314. return ShowPlayerDialog(playerid, GRAFITE_DIALOG_RETURN, DIALOG_STYLE_MSGBOX, "{F7EC6F}Grafite Tag - {BD0000} Ops!!", "Ops! Nao tem nada nesse slot.", "Ok", "");
  315.  
  316. GRAFITE_slot[playerid] = listitem;
  317.  
  318. GRAFITE_bold[playerid] = GRAFITEs[playerid][listitem][_spBold];
  319. GRAFITE_color[playerid] = GRAFITEs[playerid][listitem][_spFontColor];
  320. format(GRAFITE_text[playerid], 50, GRAFITEs[playerid][listitem][_spText]);
  321. format(GRAFITE_font[playerid], 50, GRAFITEs[playerid][listitem][_spFont]);
  322. GRAFITE_size[playerid] = GRAFITEs[playerid][listitem][_spFontSize];
  323. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  324. }
  325. case GRAFITE_DELETE:
  326. {
  327. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  328.  
  329. if(GRAFITEs[playerid][listitem][_spPosX] == 0.0)
  330. return ShowPlayerDialog(playerid, GRAFITE_DIALOG_RETURN, DIALOG_STYLE_MSGBOX, "{F7EC6F}Grafite Tag - {BD0000} Ops!!", "Ops! Nao tem nada nesse slot.", "Ok", "");
  331.  
  332. new
  333. szMessage[60]
  334. ;
  335.  
  336. Tags_Clear(playerid, listitem);
  337. format(szMessage, sizeof szMessage, "[Grafite Tag] A Grafite tag #%i foi deletada com sucesso.", listitem);
  338. SendClientMessage(playerid, -1, szMessage);
  339. GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  340. }
  341. case GRAFITE_FIND:
  342. {
  343. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  344.  
  345. if(GRAFITEs[playerid][listitem][_spPosX] == 0.0)
  346. return ShowPlayerDialog(playerid, GRAFITE_DIALOG_RETURN, DIALOG_STYLE_MSGBOX, "{F7EC6F}Grafite Tag - {BD0000} Ops!!", "Ops! Nao tem nada nesse slot.", "Ok", "");
  347.  
  348. new
  349. szMessage[60]
  350. ;
  351. GRAFITE_find[playerid] = SetPlayerCheckpoint(playerid, GRAFITEs[playerid][listitem][_spPosX], GRAFITEs[playerid][listitem][_spPosY], GRAFITEs[playerid][listitem][_spPosZ], 3.0);
  352. format(szMessage, sizeof szMessage, "[Grafite Tag] Um checkpoint foi marcado na sua Grafite #%i.", listitem);
  353. SendClientMessage(playerid, -1, szMessage);
  354. }
  355. case GRAFITE_CREATE:
  356. {
  357. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  358.  
  359. if(GRAFITEs[playerid][listitem][_spPosX] == 0.0)
  360. {
  361. GRAFITE_slot[playerid] = listitem;
  362. format(GRAFITE_text[playerid], 50, "Exemplo");
  363. format(GRAFITE_font[playerid], 50, "Arial");
  364. GRAFITE_color[playerid] = -1;
  365. GRAFITE_size[playerid] = 24;
  366. GRAFITE_bold[playerid] = 0;
  367. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  368. } else ShowPlayerDialog(playerid, GRAFITE_DIALOG_RETURN, DIALOG_STYLE_MSGBOX, "{F7EC6F}Grafite Tag - {BD0000} Ops!!", "Ops! Este slot ja esta sendo usado.", "Ok", "");
  369. }
  370. case GRAFITE_EDIT_LIST:
  371. {
  372. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_TAGS);
  373.  
  374. new
  375. iIndex = GRAFITE_slot[playerid]
  376. ;
  377.  
  378. switch(listitem)
  379. {
  380. case 0: ShowPlayerDialog(playerid, GRAFITE_EDIT_TEXT, DIALOG_STYLE_INPUT, "{F7EC6F}Grafite Tag - {469BF0}Texto", "Digite o texto que voce quer que aparece na Grafite Tag", "Selecionar", "Voltar");
  381. case 1: ShowPlayerDialog(playerid, GRAFITE_EDIT_FONT, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Fonte", "Arial\nCourier\nImpact\nPricedown\nDaredevil\nBombing\naaaiight! fat\nFrom Street Art\nGhang\nGraffogie\nGraphers Blog\nNosegrind Demo", "Selecionar", "Voltar");
  382. case 2: ShowPlayerDialog(playerid, GRAFITE_EDIT_SIZE, DIALOG_STYLE_INPUT, "{F7EC6F}Grafite Tag - {469BF0}Tamanho", "Digite o tamanho que voce quer que aparece na Grafite Tag", "Selecionar", "Voltar");
  383. case 3: ShowPlayerDialog(playerid, GRAFITE_EDIT_COLOR, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Cor", "{FF0000}Vermelho\n{04B404}Verde\n{00B5CD}Azul Claro\n{FFFF00}Amarelo\n{0000FF}Azul\n{848484}Cinza\n{FF00FF}Rosa\n{FFFFFF}Branco", "Selecionar", "Voltar");
  384. case 4:
  385. {
  386. switch(GRAFITE_bold[playerid])
  387. {
  388. case 0: GRAFITE_bold[playerid] = 1;
  389. case 1: GRAFITE_bold[playerid] = 0;
  390. }
  391. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  392. }
  393. case 5:
  394. {
  395. EditDynamicObject(playerid, GRAFITEs[playerid][iIndex][_spObject]);
  396. SetPVarInt(playerid, "GRAFITE_EDIT", 2);
  397. }
  398. }
  399. }
  400. case GRAFITE_EDIT_TEXT:
  401. {
  402. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  403. format(GRAFITE_text[playerid], 32, inputtext);
  404. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  405. }
  406. case GRAFITE_EDIT_FONT:
  407. {
  408. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  409. format(GRAFITE_font[playerid], 32, inputtext);
  410. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  411. }
  412. case GRAFITE_EDIT_SIZE:
  413. {
  414. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  415. GRAFITE_size[playerid] = strval(inputtext);
  416. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  417. }
  418. case GRAFITE_EDIT_COLOR:
  419. {
  420. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  421. new iColor;
  422. switch(listitem)
  423. {
  424. case 0: iColor = HexToInt("0xFFFF0000");
  425. case 1: iColor = HexToInt("0xFF04B404");
  426. case 2: iColor = HexToInt("0xFF00B5CD");
  427. case 3: iColor = HexToInt("0xFFFFFF00");
  428. case 4: iColor = HexToInt("0xFF0000FF");
  429. case 5: iColor = HexToInt("0xFF848484");
  430. case 6: iColor = HexToInt("0xFFFF00FF");
  431. case 7: iColor = HexToInt("0xFFFFFFFF");
  432. }
  433. GRAFITE_color[playerid] = iColor;
  434. GRAFITE_Dialog(playerid, TYPE_LIST_EDIT);
  435. }
  436.  
  437. case GRAFITE_CREATE_MAIN:
  438. {
  439. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_TAGS_CREATE);
  440. switch(listitem)
  441. {
  442. case 0: ShowPlayerDialog(playerid, GRAFITE_CREATE_TEXT, DIALOG_STYLE_INPUT, "{F7EC6F}Grafite Tag - {469BF0}Texto", "Digite o texto que voce quer que aparece na Grafite Tag", "Selecionar", "Voltar");
  443. case 1: ShowPlayerDialog(playerid, GRAFITE_CREATE_FONT, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Fonte", "Arial\nCourier\nImpact\nPricedown\nDaredevil\nBombing\naaaiight! fat\nFrom Street Art\nGhang\nGraffogie\nGraphers Blog\nNosegrind Demo", "Selecionar", "Voltar");
  444. case 2: ShowPlayerDialog(playerid, GRAFITE_CREATE_SIZE, DIALOG_STYLE_INPUT, "{F7EC6F}Grafite Tag - {469BF0}Tamanho", "Digite o tamanho que voce quer que aparece na Grafite Tag", "Selecionar", "Voltar");
  445. case 3: ShowPlayerDialog(playerid, GRAFITE_CREATE_COLOR, DIALOG_STYLE_LIST, "{F7EC6F}Grafite Tag - {469BF0}Cor", "{FF0000}Vermelho\n{04B404}Verde\n{00B5CD}Azul Claro\n{FFFF00}Amarelo\n{0000FF}Azul\n{848484}Cinza\n{FF00FF}Rosa\n{FFFFFF}Branco", "Selecionar", "Voltar");
  446. case 4:
  447. {
  448. switch(GRAFITE_bold[playerid])
  449. {
  450. case 0: GRAFITE_bold[playerid] = 1;
  451. case 1: GRAFITE_bold[playerid] = 0;
  452. }
  453. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  454. }
  455. case 5:
  456. {
  457. new
  458. Float:Position[3],
  459. szText[50],
  460. szFont[50]
  461. ;
  462.  
  463. GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
  464. format(szText, 50, GRAFITE_text[playerid]);
  465. format(szFont, 50, GRAFITE_font[playerid]);
  466.  
  467. GRAFITE_object[playerid] = CreateDynamicObject(SPRAY_TAG_OBJECT, Position[0]-1.0, Position[1], Position[2], 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, SPRAY_TAG_OBJECT_DISTANCE);
  468. SetDynamicObjectMaterialText(GRAFITE_object[playerid], 0, szText, OBJECT_MATERIAL_SIZE_512x512, szFont, GRAFITE_size[playerid], GRAFITE_bold[playerid], GRAFITE_color[playerid], 0, 1);
  469. EditDynamicObject(playerid, GRAFITE_object[playerid]);
  470. SetPVarInt(playerid, "GRAFITE_EDIT", 1);
  471. }
  472. }
  473. }
  474. case GRAFITE_CREATE_TEXT:
  475. {
  476. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  477. format(GRAFITE_text[playerid], 50, inputtext);
  478. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  479. }
  480. case GRAFITE_CREATE_FONT:
  481. {
  482. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  483. format(GRAFITE_font[playerid], 50, inputtext);
  484. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  485. }
  486. case GRAFITE_CREATE_SIZE:
  487. {
  488. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  489. GRAFITE_size[playerid] = strval(inputtext);
  490. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  491. }
  492. case GRAFITE_CREATE_COLOR:
  493. {
  494. if(!response) return GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  495. new iColor;
  496. switch(listitem)
  497. {
  498. case 0: iColor = HexToInt("0xFFFF0000");
  499. case 1: iColor = HexToInt("0xFF04B404");
  500. case 2: iColor = HexToInt("0xFF00B5CD");
  501. case 3: iColor = HexToInt("0xFFFFFF00");
  502. case 4: iColor = HexToInt("0xFF0000FF");
  503. case 5: iColor = HexToInt("0xFF848484");
  504. case 6: iColor = HexToInt("0xFFFF00FF");
  505. case 7: iColor = HexToInt("0xFFFFFFFF");
  506. }
  507. GRAFITE_color[playerid] = iColor;
  508. GRAFITE_Dialog(playerid, TYPE_LIST_CREATE);
  509. }
  510. }
  511.  
  512. return 1;
  513. }
  514.  
  515. public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
  516. {
  517. if(response == EDIT_RESPONSE_FINAL)
  518. {
  519. if(GetPVarInt(playerid, "GRAFITE_EDIT") == 1)
  520. {
  521. if(!IsPlayerInRangeOfPoint(playerid, 3, x, y, z))
  522. {
  523. DestroyDynamicObject(GRAFITE_object[playerid]);
  524. DeletePVar(playerid, "GRAFITE_EDIT");
  525. return SendClientMessage(playerid, -1, "Voce nao esta perto da Grafite tag.");
  526. }
  527.  
  528. GRAFITE_positions[playerid][0] = x;
  529. GRAFITE_positions[playerid][1] = y;
  530. GRAFITE_positions[playerid][2] = z;
  531. GRAFITE_positions[playerid][3] = rx;
  532. GRAFITE_positions[playerid][4] = ry;
  533. GRAFITE_positions[playerid][5] = rz;
  534.  
  535. GRAFITE_timer[playerid] = SetTimerEx("GRAFITE", 1000, true, "ii", playerid, 2);
  536.  
  537. ApplyAnimation(playerid, "SPRAYCAN", "spraycan_full", 4.0, 1, 1, 1, 0, 0, 1);
  538.  
  539. GRAFITE_timer_left[playerid] = SPRAY_TAG_TIMER;
  540. DestroyDynamicObject(GRAFITE_object[playerid]);
  541. }
  542. if(GetPVarInt(playerid, "GRAFITE_EDIT") == 2)
  543. {
  544. new
  545. iIndex = GRAFITE_slot[playerid]
  546. ;
  547.  
  548. if(!IsPlayerInRangeOfPoint(playerid, 3, x, y, z))
  549. {
  550. DestroyDynamicObject(GRAFITEs[playerid][iIndex][_spObject]);
  551. GRAFITE_Spawn(playerid, iIndex);
  552. DeletePVar(playerid, "GRAFITE_EDIT");
  553. return SendClientMessage(playerid, -1, "Voce nao esta perto da Grafite tag.");
  554. }
  555.  
  556. GRAFITE_positions[playerid][0] = x;
  557. GRAFITE_positions[playerid][1] = y;
  558. GRAFITE_positions[playerid][2] = z;
  559. GRAFITE_positions[playerid][3] = rx;
  560. GRAFITE_positions[playerid][4] = ry;
  561. GRAFITE_positions[playerid][5] = rz;
  562.  
  563. GRAFITE_timer[playerid] = SetTimerEx("GRAFITE", 1000, true, "ii", playerid, 1);
  564.  
  565. ApplyAnimation(playerid, "SPRAYCAN", "spraycan_full", 4.0, 1, 1, 1, 0, 0, 1);
  566.  
  567. GRAFITE_timer_left[playerid] = SPRAY_TAG_TIMER;
  568. DestroyDynamicObject(GRAFITEs[playerid][iIndex][_spObject]);
  569. }
  570. }
  571. if(response == EDIT_RESPONSE_CANCEL)
  572. {
  573. if(GetPVarInt(playerid, "GRAFITE_EDIT") >= 1)
  574. {
  575. DestroyDynamicObject(GRAFITE_object[playerid]);
  576. DestroyDynamicObject(GRAFITEs[playerid][GRAFITE_slot[playerid]][_spObject]);
  577. GRAFITE_Spawn(playerid, GRAFITE_slot[playerid]);
  578. DeletePVar(playerid, "GRAFITE_EDIT");
  579. }
  580. }
  581. return 1;
  582. }
  583.  
  584. forward GRAFITE(playerid, type);
  585. public GRAFITE(playerid, type)
  586. {
  587. new
  588. iIndex = GRAFITE_slot[playerid]
  589. ;
  590.  
  591. if(!IsPlayerConnected(playerid))
  592. {
  593. GRAFITE_timer_left[playerid] = 0;
  594. DeletePVar(playerid, "GRAFITE_EDIT");
  595. KillTimer(GRAFITE_timer[playerid]);
  596. return 1;
  597. }
  598.  
  599. GRAFITE_timer_left[playerid]--;
  600.  
  601. switch(type)
  602. {
  603. case 1:
  604. {
  605. if(GRAFITE_timer_left[playerid] == 0)
  606. {
  607. DestroyDynamicObject(GRAFITEs[playerid][iIndex][_spObject]);
  608. DestroyDynamicObject(GRAFITE_object[playerid]);
  609.  
  610. format(GRAFITEs[playerid][iIndex][_spText], 50, GRAFITE_text[playerid]);
  611. format(GRAFITEs[playerid][iIndex][_spFont], 50, GRAFITE_font[playerid]);
  612.  
  613. GRAFITEs[playerid][iIndex][_spPosX] = GRAFITE_positions[playerid][0];
  614. GRAFITEs[playerid][iIndex][_spPosY] = GRAFITE_positions[playerid][1];
  615. GRAFITEs[playerid][iIndex][_spPosZ] = GRAFITE_positions[playerid][2];
  616. GRAFITEs[playerid][iIndex][_spPosRX] = GRAFITE_positions[playerid][3];
  617. GRAFITEs[playerid][iIndex][_spPosRY] = GRAFITE_positions[playerid][4];
  618. GRAFITEs[playerid][iIndex][_spPosRZ] = GRAFITE_positions[playerid][5];
  619. GRAFITEs[playerid][iIndex][_spFontColor] = GRAFITE_color[playerid];
  620. GRAFITEs[playerid][iIndex][_spFontSize] = GRAFITE_size[playerid];
  621. GRAFITEs[playerid][iIndex][_spBold] = GRAFITE_bold[playerid];
  622.  
  623. GRAFITE_Spawn(playerid, iIndex);
  624. Tags_Save(playerid, iIndex);
  625.  
  626. ClearAnimations(playerid);
  627. ApplyAnimation(playerid, "GRAFFITI", "graffiti_Chkout", 4.0, 0, 0, 0, 0, 0, 1);
  628. KillTimer(GRAFITE_timer[playerid]);
  629. }
  630. }
  631. case 2:
  632. {
  633. if(GRAFITE_timer_left[playerid] == 0)
  634. {
  635. GRAFITE_Create(playerid, GRAFITE_slot[playerid]);
  636. ClearAnimations(playerid);
  637. ApplyAnimation(playerid, "GRAFFITI", "graffiti_Chkout", 4.0, 0, 0, 0, 0, 0, 1);
  638. KillTimer(GRAFITE_timer[playerid]);
  639. }
  640. }
  641. }
  642. DeletePVar(playerid, "GRAFITE_EDIT");
  643. return 1;
  644. }
  645.  
  646. CMD:criargrafite(playerid)
  647. {
  648. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{ff2400}>> Voce nao esta logado por RCON");
  649. if(IsPlayerConnected(playerid)) GRAFITE_Dialog(playerid, TYPE_LIST_MENU);
  650. return 1;
  651. }
  652.  
  653. stock GRAFITE_Create(playerid, iIndex)
  654. {
  655. if(IsPlayerConnected(playerid))
  656. {
  657. new
  658. szMessage[128]
  659. ;
  660.  
  661. GRAFITEs[playerid][iIndex][_spPosX] = GRAFITE_positions[playerid][0];
  662. GRAFITEs[playerid][iIndex][_spPosY] = GRAFITE_positions[playerid][1];
  663. GRAFITEs[playerid][iIndex][_spPosZ] = GRAFITE_positions[playerid][2];
  664. GRAFITEs[playerid][iIndex][_spPosRX] = GRAFITE_positions[playerid][3];
  665. GRAFITEs[playerid][iIndex][_spPosRY] = GRAFITE_positions[playerid][4];
  666. GRAFITEs[playerid][iIndex][_spPosRZ] = GRAFITE_positions[playerid][5];
  667.  
  668. format(GRAFITEs[playerid][iIndex][_spText], 50, GRAFITE_text[playerid]);
  669. format(GRAFITEs[playerid][iIndex][_spFont], 50, GRAFITE_font[playerid]);
  670.  
  671. GRAFITEs[playerid][iIndex][_spFontColor] = GRAFITE_color[playerid];
  672. GRAFITEs[playerid][iIndex][_spFontSize] = GRAFITE_size[playerid];
  673. GRAFITEs[playerid][iIndex][_spBold] = GRAFITE_bold[playerid];
  674.  
  675. GRAFITE_Spawn(playerid, iIndex);
  676. Tags_Save(playerid, iIndex);
  677.  
  678. format(szMessage, sizeof szMessage, "[Grafite Tag] Voce criou uma Grafite tag com ID # %i.", iIndex);
  679. SendClientMessage(playerid, -1, szMessage);
  680. }
  681. }
  682.  
  683. stock GRAFITE_Spawn(playerid, iIndex)
  684. {
  685. GRAFITEs[playerid][iIndex][_spObject] = CreateDynamicObject(SPRAY_TAG_OBJECT, GRAFITEs[playerid][iIndex][_spPosX], GRAFITEs[playerid][iIndex][_spPosY], GRAFITEs[playerid][iIndex][_spPosZ], GRAFITEs[playerid][iIndex][_spPosRX], GRAFITEs[playerid][iIndex][_spPosRY], GRAFITEs[playerid][iIndex][_spPosRZ], GRAFITEs[playerid][iIndex][_spVW], GRAFITEs[playerid][iIndex][_spInt], -1, SPRAY_TAG_OBJECT_DISTANCE);
  686. SetDynamicObjectMaterialText(GRAFITEs[playerid][iIndex][_spObject], 0, GRAFITEs[playerid][iIndex][_spText], OBJECT_MATERIAL_SIZE_512x512, GRAFITEs[playerid][iIndex][_spFont], GRAFITEs[playerid][iIndex][_spFontSize], GRAFITEs[playerid][iIndex][_spBold], GRAFITEs[playerid][iIndex][_spFontColor], 0, 1);
  687. return 1;
  688. }
  689.  
  690. stock Tag_Load(playerid)
  691. {
  692. if(IsPlayerConnected(playerid))
  693. {
  694. new
  695. szFile[40],
  696. szLine[28],
  697. szName[MAX_PLAYER_NAME]
  698. ;
  699. GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  700. format(szFile, 40, GRAFITE_FOLDER, szName);
  701.  
  702. for(new i; i < MAX_PLAYERS_TAGS; i++)
  703. {
  704. format(szLine, sizeof szLine, "Text%i", i); format(GRAFITEs[playerid][i][_spText], 50, DOF2_GetString(szFile, szLine));
  705. format(szLine, sizeof szLine, "Font%i", i); format(GRAFITEs[playerid][i][_spFont], 50, DOF2_GetString(szFile, szLine));
  706. format(szLine, sizeof szLine, "FontSize%i", i); GRAFITEs[playerid][i][_spFontSize] = DOF2_GetInt(szFile, szLine);
  707. format(szLine, sizeof szLine, "FontBold%i", i); GRAFITEs[playerid][i][_spBold] = DOF2_GetInt(szFile, szLine);
  708. format(szLine, sizeof szLine, "FontColor%i", i); GRAFITEs[playerid][i][_spFontColor] = DOF2_GetInt(szFile, szLine);
  709. format(szLine, sizeof szLine, "PosX%i", i); GRAFITEs[playerid][i][_spPosX] = DOF2_GetFloat(szFile, szLine);
  710. format(szLine, sizeof szLine, "PosY%i", i); GRAFITEs[playerid][i][_spPosY] = DOF2_GetFloat(szFile, szLine);
  711. format(szLine, sizeof szLine, "PosZ%i", i); GRAFITEs[playerid][i][_spPosZ] = DOF2_GetFloat(szFile, szLine);
  712. format(szLine, sizeof szLine, "RotX%i", i); GRAFITEs[playerid][i][_spPosRX] = DOF2_GetFloat(szFile, szLine);
  713. format(szLine, sizeof szLine, "RotY%i", i); GRAFITEs[playerid][i][_spPosRY] = DOF2_GetFloat(szFile, szLine);
  714. format(szLine, sizeof szLine, "RotZ%i", i); GRAFITEs[playerid][i][_spPosRZ] = DOF2_GetFloat(szFile, szLine);
  715. format(szLine, sizeof szLine, "VirtualWorld%i", i); GRAFITEs[playerid][i][_spVW] = DOF2_GetInt(szFile, szLine);
  716. format(szLine, sizeof szLine, "Interior%i", i); GRAFITEs[playerid][i][_spInt] = DOF2_GetInt(szFile, szLine);
  717.  
  718. if(GRAFITEs[playerid][i][_spPosX] != 0.0)
  719. {
  720. GRAFITE_Spawn(playerid, i);
  721. }
  722. }
  723. }
  724. return 1;
  725. }
  726.  
  727. stock Tags_Clear(playerid, iIndex)
  728. {
  729. format(GRAFITEs[playerid][iIndex][_spText], 50, "Exemplo");
  730. format(GRAFITEs[playerid][iIndex][_spFont], 50, "Arial");
  731. GRAFITEs[playerid][iIndex][_spFontSize] = 24;
  732. GRAFITEs[playerid][iIndex][_spBold] = 0;
  733. GRAFITEs[playerid][iIndex][_spFontColor] = -1;
  734. GRAFITEs[playerid][iIndex][_spPosX] = 0.0;
  735. GRAFITEs[playerid][iIndex][_spPosY] = 0.0;
  736. GRAFITEs[playerid][iIndex][_spPosZ] = 0.0;
  737. GRAFITEs[playerid][iIndex][_spPosRX] = 0.0;
  738. GRAFITEs[playerid][iIndex][_spPosRY] = 0.0;
  739. GRAFITEs[playerid][iIndex][_spPosRZ] = 0.0;
  740. GRAFITEs[playerid][iIndex][_spVW] = 0;
  741. GRAFITEs[playerid][iIndex][_spInt] = 0;
  742. DestroyDynamicObject(GRAFITEs[playerid][iIndex][_spObject]);
  743. Tags_Save(playerid, iIndex);
  744. return 1;
  745. }
  746.  
  747. stock Tags_Save(playerid, iIndex)
  748. {
  749. if(IsPlayerConnected(playerid))
  750. {
  751. new
  752. szFile[32],
  753. szLine[128],
  754. szName[MAX_PLAYER_NAME]
  755. ;
  756.  
  757. GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
  758. format(szFile, 32, GRAFITE_FOLDER, szName);
  759. if(!DOF2_FileExists(szFile)) DOF2_CreateFile(szFile);
  760. {
  761. format(szLine, sizeof szLine, "Text%i", iIndex); DOF2_SetString(szFile, szLine, GRAFITEs[playerid][iIndex][_spText]);
  762. format(szLine, sizeof szLine, "Font%i", iIndex); DOF2_SetString(szFile, szLine, GRAFITEs[playerid][iIndex][_spFont]);
  763. format(szLine, sizeof szLine, "FontSize%i", iIndex); DOF2_SetInt(szFile, szLine, GRAFITEs[playerid][iIndex][_spFontSize]);
  764. format(szLine, sizeof szLine, "FontBold%i", iIndex); DOF2_SetInt(szFile, szLine, GRAFITEs[playerid][iIndex][_spBold]);
  765. format(szLine, sizeof szLine, "FontColor%i", iIndex); DOF2_SetInt(szFile, szLine, GRAFITEs[playerid][iIndex][_spFontColor]);
  766. format(szLine, sizeof szLine, "PosX%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosX]);
  767. format(szLine, sizeof szLine, "PosY%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosY]);
  768. format(szLine, sizeof szLine, "PosZ%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosZ]);
  769. format(szLine, sizeof szLine, "RotX%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosRX]);
  770. format(szLine, sizeof szLine, "RotY%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosRY]);
  771. format(szLine, sizeof szLine, "RotZ%i", iIndex); DOF2_SetFloat(szFile, szLine, GRAFITEs[playerid][iIndex][_spPosRZ]);
  772. format(szLine, sizeof szLine, "VirtualWorld%i", iIndex); DOF2_SetInt(szFile, szLine, GRAFITEs[playerid][iIndex][_spVW]);
  773. format(szLine, sizeof szLine, "Interior%i", iIndex); DOF2_SetInt(szFile, szLine, GRAFITEs[playerid][iIndex][_spInt]);
  774. DOF2_SaveFile();
  775. }
  776. }
  777. return 1;
  778. }
  779.  
  780. stock HexToInt(string[]) // Criando by Zamaroth!!
  781. {
  782. if (string[0] == 0) return 0;
  783.  
  784. new
  785. i,
  786. cur = 1,
  787. res = 0
  788. ;
  789.  
  790. for (i = strlen(string); i > 0; i --) {
  791. if (string[i-1] < 58) res = res + cur * (string[i-1]-48); else res = res + cur * (string[i-1]-65+10);
  792. cur = cur * 16;
  793. }
  794. return res;
  795. }
  796.  
Add Comment
Please, Sign In to add comment