Advertisement
Sky_Softh

SK Cordenadas

Apr 27th, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. //Includes
  2. #include < a_samp > //SA-MP TeaM
  3. #include < zcmd > //Zeex's Include
  4. #include < sscanf2 > //y_Less Include
  5.  
  6. // Loop
  7. #define Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)
  8.  
  9. //dialogs
  10. #define DIALOG_SAVE 2256
  11.  
  12. //variaveis
  13. new
  14.  
  15. PlayerText:Painel[ 6 ][ MAX_PLAYERS ],
  16. TimerPlayer[ MAX_PLAYERS ]
  17. ;
  18.  
  19. //CallBacks
  20. public OnPlayerConnect( playerid ){
  21.  
  22. LoadPainel(playerid);
  23. return true;
  24. }
  25.  
  26. public OnPlayerDisconnect( playerid ){
  27. KillTimer(TimerPlayer[ playerid ]);
  28. return true;
  29. }
  30. public OnFilterScriptInit()
  31. {
  32. print("\n");
  33. print("|_____________________________|");
  34. print("| | ");
  35. print("| SK Cords Editor Carregado ..| ");
  36. print("| Copyright © 2012-2013 | ");
  37. print("| | ");
  38. print("| Sky ™ | ");
  39. print("|_____________________________| ");
  40. print("\n");
  41.  
  42. Loop(_i, GetMaxPlayers( ))
  43. {
  44. if(IsPlayerConnected(_i)) LoadPainel(_i);
  45. }
  46. return true;
  47. }
  48.  
  49. public OnFilterScriptExit()
  50. {
  51.  
  52. Loop(_i, GetMaxPlayers( ))
  53. {
  54. if(IsPlayerConnected(_i)) HideTextDraw(_i);
  55. KillTimer(TimerPlayer[ _i ]);
  56. }
  57.  
  58. print("| SK Cords Editor Desligado .. | ");
  59. return true;
  60. }
  61.  
  62. public OnPlayerSpawn(playerid)
  63. {
  64. SendClientMessage(playerid, -1, "{33AA33}Use: /vercords [ 1 - 2]");
  65. return 1;
  66. }
  67.  
  68. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  69. {
  70. if(playertextid == Painel[ 4 ][ playerid ])
  71. {
  72. HideTextDraw(playerid);
  73. SendClientMessage(playerid, -1, "{33AA33}Salvando Cordenadas.");
  74. CancelSelectTextDraw(playerid);
  75. ShowPlayerDialog(playerid, DIALOG_SAVE, DIALOG_STYLE_INPUT, "SK Cords Editor", "{FFFFFF}A Cordenada será salva na pasta {FF0000}'{FFFFFF}Scriptfiles{FF0000}'\n\n\n{FFFFFF}Escreva o nome do Local ou um Comentario Sobre a Cordenada\nPara Salva-la", "Salvar", "Cancelar");
  76. return 1;
  77. }
  78. return true;
  79. }
  80.  
  81. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  82. {
  83. switch(dialogid)
  84. {
  85. case DIALOG_SAVE:
  86. {
  87. new
  88. vartext[ 129 ]
  89. ;
  90. if(!response) return SendClientMessage(playerid, -1, "Salvamento {FF0000}Cancelado!");
  91. format(vartext, sizeof( vartext ), "{FFFFFF}o Local: {33AA33}%s {FFFFFF}foi salvo com sucesso!", inputtext);
  92. SendClientMessage(playerid, -1, vartext);
  93.  
  94. SalvarPos(playerid, inputtext);
  95. }
  96. }
  97. return true;
  98. }
  99. //Comandos
  100. CMD:vercords(playerid, params[])
  101. {
  102. new sk;
  103. if(!sscanf(params, "i", sk))
  104. {
  105. switch(sk)
  106. {
  107. case 1:
  108. {
  109. Loop(id, sizeof Painel)
  110. {
  111. PlayerTextDrawShow(playerid, Painel[ id ][ playerid ]);
  112. }
  113. AtualizarCordenadas(playerid);
  114. SelectTextDraw(playerid, 0x00FF40FF);
  115. }
  116. case 2:
  117. {
  118. Loop(id, 4)
  119. {
  120. PlayerTextDrawShow(playerid, Painel[ id ][ playerid ]);
  121. }
  122. PlayerTextDrawShow(playerid, Painel[ 5 ][ playerid ]);
  123. SendClientMessage(playerid, -1, "Para fechar o Menu /fecharmenu ");
  124. TimerPlayer[ playerid ] = SetTimerEx("AtualizarCords", 100, true, "i", playerid);
  125. }
  126. }
  127. }
  128. else SendClientMessage(playerid, -1, "{FF0000}Use: /vercords [ 1- 2 ]");
  129. return true;
  130. }
  131.  
  132. CMD:fecharmenu(playerid)
  133. {
  134. HideTextDraw(playerid);
  135. KillTimer(TimerPlayer[ playerid ]);
  136. SendClientMessage(playerid, -1, "Menu Fechado Com sucesso!");
  137. return true;
  138. }
  139.  
  140. HideTextDraw(playerid)
  141. {
  142. Loop(id, sizeof Painel)
  143. {
  144. PlayerTextDrawHide(playerid, Painel[ id ][ playerid ]);
  145. }
  146. }
  147.  
  148. LoadPainel(playerid)
  149. {
  150. Painel[ 0 ][ playerid ] = CreatePlayerTextDraw(playerid,94.000000, 119.000000, "_");
  151.  
  152. PlayerTextDrawAlignment(playerid, Painel[ 0 ][ playerid ], 2);
  153. PlayerTextDrawBackgroundColor(playerid, Painel[ 0 ][ playerid ], 255);
  154. PlayerTextDrawFont(playerid, Painel[ 0 ][ playerid ], 1);
  155. PlayerTextDrawLetterSize(playerid, Painel[ 0 ][ playerid ], 0.500000, 14.999996);
  156. PlayerTextDrawColor(playerid, Painel[ 0 ][ playerid ], -1);
  157. PlayerTextDrawSetOutline(playerid, Painel[ 0 ][ playerid ], 0);
  158. PlayerTextDrawSetProportional(playerid, Painel[ 0 ][ playerid ], 1);
  159. PlayerTextDrawSetShadow(playerid, Painel[ 0 ][ playerid ], 1);
  160. PlayerTextDrawUseBox(playerid, Painel[ 0 ][ playerid ], 1);
  161. PlayerTextDrawBoxColor(playerid, Painel[ 0 ][ playerid ], 133);
  162. PlayerTextDrawTextSize(playerid, Painel[ 0 ][ playerid ], 0.000000, 138.000000);
  163. PlayerTextDrawSetSelectable(playerid, Painel[ 0 ][ playerid ], 0);
  164.  
  165. Painel[ 1 ][ playerid ] = CreatePlayerTextDraw(playerid,94.000000, 106.000000, "_");
  166.  
  167. PlayerTextDrawAlignment(playerid, Painel[ 1 ][ playerid ], 2);
  168. PlayerTextDrawBackgroundColor(playerid, Painel[ 1 ][ playerid ], 255);
  169. PlayerTextDrawFont(playerid, Painel[ 1 ][ playerid ], 1);
  170. PlayerTextDrawLetterSize(playerid, Painel[ 1 ][ playerid ], 0.500000, 1.100000);
  171. PlayerTextDrawColor(playerid, Painel[ 1 ][ playerid ], -1);
  172. PlayerTextDrawSetOutline(playerid, Painel[ 1 ][ playerid ], 0);
  173. PlayerTextDrawSetProportional(playerid, Painel[ 1 ][ playerid ], 1);
  174. PlayerTextDrawSetShadow(playerid, Painel[ 1 ][ playerid ], 1);
  175. PlayerTextDrawUseBox(playerid, Painel[ 1 ][ playerid ], 1);
  176. PlayerTextDrawBoxColor(playerid, Painel[ 1 ][ playerid ], -16777083);
  177. PlayerTextDrawTextSize(playerid, Painel[ 1 ][ playerid ], 0.000000, 138.000000);
  178. PlayerTextDrawSetSelectable(playerid, Painel[ 1 ][ playerid ], 0);
  179.  
  180. Painel[ 2 ][ playerid ] = CreatePlayerTextDraw(playerid,53.000000, 105.000000, "SK Cordenadas");
  181.  
  182. PlayerTextDrawBackgroundColor(playerid, Painel[ 2 ][ playerid ], 255);
  183. PlayerTextDrawFont(playerid, Painel[ 2 ][ playerid ], 0);
  184. PlayerTextDrawLetterSize(playerid, Painel[ 2 ][ playerid ], 0.480000, 1.000000);
  185. PlayerTextDrawColor(playerid, Painel[ 2 ][ playerid ], -1);
  186. PlayerTextDrawSetOutline(playerid, Painel[ 2 ][ playerid ], 0);
  187. PlayerTextDrawSetProportional(playerid, Painel[ 2 ][ playerid ], 1);
  188. PlayerTextDrawSetShadow(playerid, Painel[ 2 ][ playerid ], 1);
  189. PlayerTextDrawSetSelectable(playerid, Painel[ 2 ][ playerid ], 0);
  190.  
  191. Painel[ 3 ][ playerid ] = CreatePlayerTextDraw(playerid,26.000000, 130.000000, "Cord X:~n~_~n~Cord Y:~n~_~n~Cord Z:~n~_~n~Angulo:~n~_~n~Int:");
  192.  
  193. PlayerTextDrawBackgroundColor(playerid, Painel[ 3 ][ playerid ], 255);
  194. PlayerTextDrawFont(playerid, Painel[ 3 ][ playerid ], 1);
  195. PlayerTextDrawLetterSize(playerid, Painel[ 3 ][ playerid ], 0.270000, 1.000000);
  196. PlayerTextDrawColor(playerid, Painel[ 3 ][ playerid ], -1);
  197. PlayerTextDrawSetOutline(playerid, Painel[ 3 ][ playerid ], 0);
  198. PlayerTextDrawSetProportional(playerid, Painel[ 3 ][ playerid ], 1);
  199. PlayerTextDrawSetShadow(playerid, Painel[ 3 ][ playerid ], 1);
  200. PlayerTextDrawSetSelectable(playerid, Painel[ 3 ][ playerid ], 0);
  201.  
  202.  
  203. Painel[ 4 ][ playerid ] = CreatePlayerTextDraw(playerid,27.000000, 242.000000, "Save");
  204.  
  205. PlayerTextDrawBackgroundColor(playerid, Painel[ 4 ][ playerid ], 255);
  206. PlayerTextDrawFont(playerid, Painel[ 4 ][ playerid ], 1);
  207. PlayerTextDrawLetterSize(playerid, Painel[ 4 ][ playerid ], 0.430000, 1.000000);
  208. PlayerTextDrawColor(playerid, Painel[ 4 ][ playerid ], -1);
  209. PlayerTextDrawSetOutline(playerid, Painel[ 4 ][ playerid ], 0);
  210. PlayerTextDrawSetProportional(playerid, Painel[ 4 ][ playerid ], 1);
  211. PlayerTextDrawSetShadow(playerid, Painel[ 4 ][ playerid ], 1);
  212. PlayerTextDrawSetSelectable(playerid, Painel[ 4 ][ playerid ], 0);
  213.  
  214. Painel[ 5 ][ playerid ] = CreatePlayerTextDraw(playerid,66.000000, 130.000000, "0000.0000~n~_~n~0000.0000~n~_~n~0000.0000~n~_~n~0000.0000");
  215.  
  216. PlayerTextDrawBackgroundColor(playerid, Painel[ 5 ][ playerid ], 866792362);
  217. PlayerTextDrawFont(playerid, Painel[ 5 ][ playerid ], 1);
  218. PlayerTextDrawLetterSize(playerid, Painel[ 5 ][ playerid ], 0.240000, 1.000000);
  219. PlayerTextDrawColor(playerid, Painel[ 5 ][ playerid ], -1);
  220. PlayerTextDrawSetOutline(playerid, Painel[ 5 ][ playerid ], 0);
  221. PlayerTextDrawSetProportional(playerid, Painel[ 5 ][ playerid ], 1);
  222. PlayerTextDrawSetShadow(playerid, Painel[ 5 ][ playerid ], 1);
  223. PlayerTextDrawSetSelectable(playerid, Painel[ 5 ][ playerid ], 0);
  224.  
  225. PlayerTextDrawSetSelectable(playerid, Painel[ 4 ][ playerid ], true);
  226. return true;
  227. }
  228.  
  229. forward AtualizarCords( playerid );
  230. public AtualizarCords( playerid ) return AtualizarCordenadas(playerid);
  231.  
  232. AtualizarCordenadas(playerid)
  233. {
  234. new
  235. Float:Pos[ 4 ],
  236. inT,
  237. ACTD[ 100 ]
  238. ;
  239.  
  240. inT = GetPlayerInterior(playerid);
  241. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  242. GetPlayerFacingAngle(playerid, Pos[3]);
  243.  
  244. format(ACTD, sizeof( ACTD ), "%.4f~n~_~n~%.4f~n~_~n~%.4f~n~_~n~%.4f~n~_~n~%d", Pos[0], Pos[1], Pos[2], Pos[3], inT);
  245. return PlayerTextDrawSetString(playerid, Painel[ 5 ][ playerid ], ACTD);
  246. }
  247. SalvarPos(playerid, Local[])
  248. {
  249. new
  250. SKstr[ 200 ],
  251. Float:Pos[ 4 ],
  252. inT,
  253. File:Arquivo
  254. ;
  255.  
  256. inT = GetPlayerInterior(playerid);
  257. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  258. GetPlayerFacingAngle(playerid, Pos[3]);
  259.  
  260. format(SKstr, sizeof( SKstr ), "%s: %.4f, %.4f, %.4f, %.4f, %d \r//Local, X , Y, Z, Interior\n", Local, Pos[0], Pos[1], Pos[2], Pos[3], inT);
  261.  
  262. Arquivo = fopen("SKCords.txt", io_append);
  263. fwrite(Arquivo, SKstr);
  264.  
  265. fclose(Arquivo);
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement