Advertisement
fenixgaming7

Criação De Veiculo Em Dialog

Aug 21st, 2022 (edited)
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.67 KB | None | 0 0
  1. //BY Sistema MrThúúG
  2. #include <a_samp>
  3. #include <zcmd>
  4. #define Lista_Carros        "mSelection/carros.txt" //Pasta + Instalação Final Do Sistema.
  5. #include <mSelection> //Precisa Dessa Include
  6.  
  7. //============[DEFINES]================
  8. new VeiculoCriado[MAX_PLAYERS];
  9. new CriouCarro[MAX_PLAYERS];
  10. new veiculosmList = mS_INVALID_LISTID;
  11. //=======================================
  12.  
  13. //===========[PUBLICS]===================
  14. public OnGameModeInit()
  15. {
  16.     veiculosmList = LoadModelSelectionMenu(Lista_Carros);
  17. }
  18. public OnPlayerConnect(playerid)
  19. {
  20.     CriouCarro[playerid] = 0;
  21.     VeiculoCriado[playerid] = 0;
  22.     return 1;
  23. }
  24. public OnPlayerDisconnect(playerid, reason)
  25. {
  26.     if(CriouCarro[playerid] == 1)
  27.     {
  28.         DestroyVehicle(VeiculoCriado[playerid]);
  29.         VeiculoCriado[playerid] = INVALID_VEHICLE_ID;
  30.         CriouCarro[playerid] = 0;
  31.     }
  32.     return 1;
  33. }
  34. //=================================================
  35.  
  36. //==============[COMANDO+PUBLIC MSelection+INSTALAÇÃO NO FINAL.]
  37. CMD:cv(playerid)
  38. {
  39.     if(IsPlayerConnected(playerid))
  40.     {
  41.         if(CriouCarro[playerid] == 1)
  42.         {
  43.             DestroyVehicle(VeiculoCriado[playerid]);
  44.             VeiculoCriado[playerid] = INVALID_VEHICLE_ID;
  45.             CriouCarro[playerid] = 0;
  46.             SendClientMessage(playerid, 0xE6E6E6E6, "Seu veiculo anterior foi destruido.");
  47.             ShowModelSelectionMenu(playerid, veiculosmList, "Escolha seu novo carro", 50, 0x000000AA);
  48.             TogglePlayerControllable(playerid,0);
  49.         }
  50.         else
  51.         {
  52.             ShowModelSelectionMenu(playerid, veiculosmList, "Escolha seu carro", 50, 0x000000AA);
  53.             TogglePlayerControllable(playerid,0);
  54.         }
  55.     }
  56.     return 1;
  57. }
  58.  
  59. public OnPlayerModelSelection(playerid, response, listid, modelid)
  60. {
  61.     if(listid == veiculosmList)
  62.     {
  63.         if(response)
  64.         {
  65.             new Float:X, Float:Y, Float:Z, Float:Angle;
  66.             GetPlayerPos(playerid, X, Y, Z);
  67.             GetPlayerFacingAngle(playerid, Angle);
  68.             VeiculoCriado[playerid] = AddStaticVehicleEx(modelid, X, Y, Z, Angle, -1, -1, -1);
  69.             PutPlayerInVehicle(playerid, VeiculoCriado[playerid], 0);
  70.             LinkVehicleToInterior(VeiculoCriado[playerid], GetPlayerInterior(playerid));
  71.             SetVehicleVirtualWorld(VeiculoCriado[playerid], GetPlayerVirtualWorld(playerid));
  72.             CriouCarro[playerid] = 1;
  73.             TogglePlayerControllable(playerid,1);
  74.         }
  75.     }
  76.     else
  77.     SendClientMessage(playerid, 0xE6E6E6E6, "Você cancelou o menu de carros!");
  78.     TogglePlayerControllable(playerid,1);
  79.     return 1;
  80. }
  81.  
  82.  
  83.  
  84. //Dentro da pasta scriptfiles crie uma pasta chamada mSelection e dentro dela crie um arquivo chamado carros.txt e cole o //code abaixo no arquivo.
  85. /*
  86. Código:
  87. 400 -16.0 0.0 -35.0
  88. 401 -16.0 0.0 -35.0
  89. 402 -16.0 0.0 -35.0
  90. 404 -16.0 0.0 -35.0
  91. 560 -16.0 0.0 -35.0
  92. 405 -16.0 0.0 -35.0
  93. 410 -16.0 0.0 -35.0
  94. 411 -16.0 0.0 -35.0
  95. 412 -16.0 0.0 -35.0
  96. 413 -16.0 0.0 -35.0
  97. 415 -16.0 0.0 -35.0
  98. 418 -16.0 0.0 -35.0
  99. 419 -16.0 0.0 -35.0
  100. 422 -16.0 0.0 -35.0
  101. 424 -16.0 0.0 -35.0
  102. 426 -16.0 0.0 -35.0
  103. 429 -16.0 0.0 -35.0
  104. 434 -16.0 0.0 -35.0
  105. 436 -16.0 0.0 -35.0
  106. 439 -16.0 0.0 -35.0
  107. 442 -16.0 0.0 -35.0
  108. 444 -16.0 0.0 -35.0
  109. 445 -16.0 0.0 -35.0
  110. 451 -16.0 0.0 -35.0
  111. 458 -16.0 0.0 -35.0
  112. 459 -16.0 0.0 -35.0
  113. 461 -16.0 0.0 -35.0
  114. 462 -16.0 0.0 -35.0
  115. 463 -16.0 0.0 -35.0
  116. 466 -16.0 0.0 -35.0
  117. 467 -16.0 0.0 -35.0
  118. 468 -16.0 0.0 -35.0
  119. 474 -16.0 0.0 -35.0
  120. 475 -16.0 0.0 -35.0
  121. 478 -16.0 0.0 -35.0
  122. 479 -16.0 0.0 -35.0
  123. 480 -16.0 0.0 -35.0
  124. 481 -16.0 0.0 -35.0
  125. 483 -16.0 0.0 -35.0
  126. 487 -16.0 0.0 -35.0
  127. 491 -16.0 0.0 -35.0
  128. 492 -16.0 0.0 -35.0
  129. 496 -16.0 0.0 -35.0
  130. 500 -16.0 0.0 -35.0
  131. 506 -16.0 0.0 -35.0
  132. 507 -16.0 0.0 -35.0
  133. 508 -16.0 0.0 -35.0
  134. 517 -16.0 0.0 -35.0
  135. 518 -16.0 0.0 -35.0
  136. 521 -16.0 0.0 -35.0
  137. 522 -16.0 0.0 -35.0
  138. 527 -16.0 0.0 -35.0
  139. 533 -16.0 0.0 -35.0
  140. 534 -16.0 0.0 -35.0
  141. 535 -16.0 0.0 -35.0
  142. 536 -16.0 0.0 -35.0
  143. 541 -16.0 0.0 -35.0
  144. 542 -16.0 0.0 -35.0
  145. 545 -16.0 0.0 -35.0
  146. 549 -16.0 0.0 -35.0
  147. 550 -16.0 0.0 -35.0
  148. 551 -16.0 0.0 -35.0
  149. 554 -16.0 0.0 -35.0
  150. 555 -16.0 0.0 -35.0
  151. 558 -16.0 0.0 -35.0
  152. 559 -16.0 0.0 -35.0
  153. 560 -16.0 0.0 -35.0
  154. 561 -16.0 0.0 -35.0
  155. 562 -16.0 0.0 -35.0
  156. 565 -16.0 0.0 -35.0
  157. 566 -16.0 0.0 -35.0
  158. 567 -16.0 0.0 -35.0
  159. 572 -16.0 0.0 -35.0
  160. 573 -16.0 0.0 -35.0
  161. 575 -16.0 0.0 -35.0
  162. 576 -16.0 0.0 -35.0
  163. 579 -16.0 0.0 -35.0
  164. 580 -16.0 0.0 -35.0
  165. 581 -16.0 0.0 -35.0
  166. 585 -16.0 0.0 -35.0
  167. 587 -16.0 0.0 -35.0
  168. 588 -16.0 0.0 -35.0
  169. 589 -16.0 0.0 -35.0
  170. 600 -16.0 0.0 -35.0
  171. 602 -16.0 0.0 -35.0
  172. 603 -16.0 0.0 -35.0
  173. 604 -16.0 0.0 -35.0
  174. 605 -16.0 0.0 -35.0
  175. */
  176.  
  177. //REFERENCIA: https://portalsamp.com/thread-1786-post-6874.html
  178. //BY FENIXGAMING
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement