Texpair

Menu veiculo clickando "2"

Jul 17th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.24 KB | None | 0 0
  1.  
  2. /*
  3. Filtro Script Sistema de Veiculo Menu
  4. Para usalo apenas aperte 2 e veja as opções
  5. Desenvolvido por TexPair
  6. Não se esqueça de manter os créditos =d
  7. FlW e até o proximo desenvolvimento
  8. */
  9.  
  10. #include <a_samp>
  11.  
  12. #define ROXINHO 0xC2A2DAAA
  13. #define GERENCIAR_VEICULO 109 // isto indica o dialog das opções do menu
  14. #define PLACA_VEICULO 108 // isto indica o dialog para troca de placas
  15. new engine,lights,alarm,doors,bonnet,boot,objective;
  16. new BigEar[MAX_PLAYERS];
  17. #if defined FILTERSCRIPT
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26. return 1;
  27. }
  28.  
  29. #else
  30.  
  31. main()
  32. {
  33. print("| Sistema de Menu do veiculo |");
  34. print("| Criado por Texpair |");
  35. print("| Filtro Script iniciado com sucesso |");
  36. }
  37.  
  38. #endif
  39.  
  40. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  41. {// 512 é a tecla 2
  42. if((newkeys==512)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
  43. {
  44. ShowPlayerDialog(playerid, GERENCIAR_VEICULO, DIALOG_STYLE_LIST, "|Gerenciando o Veiculo|", "Mudar Placa do Veiculo\nAbrir o capo\nFechar o Capo\n-Abrir Porta\nFechar Porta\nAlarme\nDesligar Alarme\nLigar Veiculo\nDesligar Veiculo\nLigar Luz\nApagar Luz", "Selecionar", "Fechar");
  45. return 1;
  46. }
  47. return 1;
  48. }
  49.  
  50. forward public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  51. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5) // função do gf se ja possuir em seu gamemode não é nescessario.
  52. {
  53. if(IsPlayerConnected(playerid))
  54. {
  55. new Float:posx, Float:posy, Float:posz;
  56. new Float:oldposx, Float:oldposy, Float:oldposz;
  57. new Float:tempposx, Float:tempposy, Float:tempposz;
  58. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  59. //radi = 2.0; //Trigger Radius
  60. for(new i = 0; i < MAX_PLAYERS; i++)
  61. {
  62. if(IsPlayerConnected(i))
  63. {
  64. if(!BigEar[i])
  65. {
  66. GetPlayerPos(i, posx, posy, posz);
  67. tempposx = (oldposx -posx);
  68. tempposy = (oldposy -posy);
  69. tempposz = (oldposz -posz);
  70. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  71. {
  72. SendClientMessage(i, col1, string);
  73. }
  74. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  75. {
  76. SendClientMessage(i, col2, string);
  77. }
  78. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  79. {
  80. SendClientMessage(i, col3, string);
  81. }
  82. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  83. {
  84. SendClientMessage(i, col4, string);
  85. }
  86. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  87. {
  88. SendClientMessage(i, col5, string);
  89. }
  90. }
  91. else
  92. {
  93. SendClientMessage(i, col1, string);
  94. }
  95. }
  96. }
  97. }//not connected
  98. return 1;
  99. }
  100.  
  101.  
  102. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  103. {
  104. new string[128],sendername[24];
  105. if(dialogid == GERENCIAR_VEICULO)
  106. {
  107. if(response)
  108. {
  109. if(listitem == 0)
  110. {
  111. if(IsPlayerAdmin(playerid))//<< podes modificar para função de seu gamemode
  112. {
  113. ShowPlayerDialog(playerid, PLACA_VEICULO, DIALOG_STYLE_INPUT, "Sistema de Placa", "Digite sua Placa:\n\nMaximo de 8 Caracteres", "Mudar", "Cancelar");
  114. }
  115. else
  116. {
  117. SendClientMessage(playerid, ROXINHO , "Você não é um Administrador RCON para trocar placa do veiculo!");
  118. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  119. }
  120. }
  121. if(listitem == 1)
  122. {
  123. new vid = GetPlayerVehicleID(playerid);
  124. if(vid != INVALID_VEHICLE_ID)
  125. {
  126. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  127. SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  128. }
  129. format(string, 256, "%s abriu o capo do veiculo.",sendername);
  130. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  131. }
  132. if(listitem == 2)
  133. {
  134. new vid = GetPlayerVehicleID(playerid);
  135. if(vid != INVALID_VEHICLE_ID)
  136. {
  137. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  138. SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  139. }
  140. format(string, 256, "%s fechou o capo do veiculo.",sendername);
  141. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  142. }
  143. if(listitem == 3)
  144. {
  145. new vid = GetPlayerVehicleID(playerid);
  146. if(vid != INVALID_VEHICLE_ID)
  147. {
  148. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  149. SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  150. }
  151. format(string, 256, "%s abriu a porta do veiculo.",sendername);
  152. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  153. return 1;
  154. }
  155. if(listitem == 4)
  156. {
  157. new vid = GetPlayerVehicleID(playerid);
  158. if(vid != INVALID_VEHICLE_ID)
  159. {
  160. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  161. SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  162. }
  163.  
  164. format(string, 256, "%s fechou a porta do veiculo.",sendername);
  165. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  166. }
  167. if(listitem == 5)
  168. {
  169. new vid = GetPlayerVehicleID(playerid);
  170. if(vid != INVALID_VEHICLE_ID)
  171. {
  172. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  173. SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  174. }
  175. format(string, 256, "%s ligou o alarme do veiculo.",sendername);
  176. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  177. }
  178. if(listitem == 6)
  179. {
  180. new vid = GetPlayerVehicleID(playerid);
  181. if(vid != INVALID_VEHICLE_ID) {
  182. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  183. SetVehicleParamsEx(vid,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  184. }
  185. format(string, 256, "%s ligou o alarme do veiculo.",sendername);
  186. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  187. }
  188. if(listitem == 7)
  189. {
  190. new vid = GetPlayerVehicleID(playerid);
  191. if(vid != INVALID_VEHICLE_ID)
  192. {
  193. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  194. SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  195. }
  196. format(string, 256, "%s ligou o veiculo.",sendername);
  197. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  198. }
  199. if(listitem == 8)
  200. {
  201. new vid = GetPlayerVehicleID(playerid);
  202. if(vid != INVALID_VEHICLE_ID)
  203. {
  204. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  205. SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  206. }
  207. format(string, 256, "%s desligou o veiculo.",sendername);
  208. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  209. }
  210. if(listitem == 9)
  211. {
  212. new vid = GetPlayerVehicleID(playerid);
  213. if(vid != INVALID_VEHICLE_ID)
  214. {
  215. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  216. SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  217. }
  218. format(string, 256, "%s acendeu a luz do veiculo.",sendername);
  219. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  220. }
  221. if(listitem == 10)
  222. {
  223. new vid = GetPlayerVehicleID(playerid);
  224. if(vid != INVALID_VEHICLE_ID)
  225. {
  226. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  227. SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  228. }
  229. format(string, 256, "%s apagou a luz do veiculo.",sendername);
  230. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  231. }
  232. }
  233. return 1;
  234. }
  235.  
  236. if(dialogid == PLACA_VEICULO)
  237. {
  238. new Float:X, Float:Y, Float:Z, Float:angle;
  239. if(strlen(inputtext) < 1 || strlen(inputtext) > 8) return SendClientMessage(playerid, 0xAFAFAFAA, "Texto Invalido.");
  240. else
  241. {
  242. format(string, sizeof(string), "Você mudou o texto de sua placa para '%s'.", inputtext);
  243. SendClientMessage(playerid, 0x33CCFFAA, string);
  244. GetPlayerPos(playerid, X, Y, Z);
  245. GetPlayerFacingAngle(playerid, angle);
  246. SetVehicleNumberPlate(GetPlayerVehicleID(playerid), inputtext);
  247. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  248. GetPlayerPos(playerid, X, Y, Z);
  249. SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
  250. SetVehicleZAngle(GetPlayerVehicleID(playerid), angle);
  251. PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), 0);
  252. SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z+2);
  253. format(string, 256, "Administrador RCON %s mudou a placa d seu veiculo para \'%s'/.",sendername,inputtext);
  254. ProxDetector(20.0,playerid,string,ROXINHO,ROXINHO,ROXINHO,ROXINHO,ROXINHO);
  255. }
  256. }
  257. return 1;
  258. }
Advertisement
Add Comment
Please, Sign In to add comment