Advertisement
Guest User

a+

a guest
Jun 9th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #include <dof2>
  5.  
  6. #define DIALOG_VENDERCARRO1 1
  7. #define DIALOG_VENDERCARRO2 2
  8. #define DIALOG_VENDERCARRO3 3
  9.  
  10. new File[50];
  11. new TCarro[MAX_PLAYERS];
  12. new CarroID[MAX_PLAYERS][3];
  13.  
  14. main() {}
  15.  
  16. public OnGameModeInit()
  17. {
  18. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  19. return 1;
  20. }
  21.  
  22. CMD:carro(playerid)
  23. {
  24. /* Como eu não tenho o criar eu to definindo os id dos veículos */
  25.  
  26. TCarro[playerid] = 3;
  27.  
  28. CarroID[playerid][0] = 0;
  29. CarroID[playerid][1] = 1;
  30. CarroID[playerid][2] = 2;
  31. return 1;
  32. }
  33.  
  34. CMD:vendercarro(playerid, params[])
  35. {
  36. new id, Preco, NumeroCarro, string[120];
  37.  
  38. if(TCarro[playerid] == -1)
  39. return SendClientMessage(playerid, -1, "| ERRO | Você não tem nenhum veículo para vender!");
  40.  
  41. if(sscanf(params, "udd", id, Preco, NumeroCarro))
  42. return SendClientMessage(playerid, -1, "| ERRO | Use: /VenderCarro [id] [Preço] [Veículo 1-10]");
  43.  
  44. if(!IsPlayerConnected(id))
  45. return SendClientMessage(playerid, -1, "| ERRO | ID não conectado!");
  46.  
  47. if(0 < NumeroCarro > 10)
  48. return SendClientMessage(playerid, -1, "| ERRO | Veículo de 1 á 10!");
  49.  
  50. if(NumeroCarro == 1)
  51. {
  52. format(File, sizeof(File), "Carros/Carro%d.ini", CarroID[playerid][0]);
  53.  
  54. format(string, sizeof(string), "Modelo: %d\nComprador: %s\nPreço: $%d", DOF2::GetInt(File, "Modelo"), Nome(id), Preco);
  55. ShowPlayerDialog(playerid, DIALOG_VENDERCARRO1, DIALOG_STYLE_MSGBOX, "Vender Carro 1", string, "Sim", "Não");
  56. return 1;
  57. }
  58. if(NumeroCarro == 2)
  59. {
  60. format(File, sizeof(File), "Carros/Carro%d.ini", CarroID[playerid][1]);
  61.  
  62. format(string, sizeof(string), "Modelo: %d\nComprador: %s\nPreço: $%d", DOF2::GetInt(File, "Modelo"), Nome(id), Preco);
  63. ShowPlayerDialog(playerid, DIALOG_VENDERCARRO2, DIALOG_STYLE_MSGBOX, "Vender Carro 2", string, "Sim", "Não");
  64. return 1;
  65. }
  66. if(NumeroCarro == 3)
  67. {
  68. format(File, sizeof(File), "Carros/Carro%d.ini", CarroID[playerid][2]);
  69.  
  70. format(string, sizeof(string), "Modelo: %d\nComprador: %s\nPreço: $%d", DOF2::GetInt(File, "Modelo"), Nome(id), Preco);
  71. ShowPlayerDialog(playerid, DIALOG_VENDERCARRO3, DIALOG_STYLE_MSGBOX, "Vender Carro 3", string, "Sim", "Não");
  72. return 1;
  73. }
  74. return 1;
  75. }
  76.  
  77. Nome(playerid)
  78. {
  79. new Name[24];
  80. GetPlayerName(playerid, Name, 24);
  81. return Name;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement