Guest User

Untitled

a guest
Feb 19th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1.  
  2. CMD:buyvehicle(playerid, params[])
  3. {
  4. if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
  5.  
  6. if(IsPlayerInRangeOfPoint(playerid,5.0,328.7707,-1513.1094,36.0391))
  7. {
  8. ShowPlayerDialog(playerid, DIALOG_DSG, DIALOG_STYLE_LIST, "Buy a vehicle", "Cheap cars\nRegular cars\nExpensive cars\nBikes\nAir Vehicles","Select", "Cancel");
  9. }
  10. else SendClientMessage(playerid, COLOR_ERROR,"You are not at dealership.");
  11. return 1;
  12. }
  13.  
  14. if(dialogid == DIALOG_DSG)
  15. {
  16. if(response)
  17. {
  18. new var[1280];
  19. new coordsstring[64] = "Name\tPrice\tStock\n";
  20. if(listitem == 0)
  21. {
  22. for(new d = 0; d < sizeof(D1Info); d++)
  23. {
  24. if(D1Info[d][d1Model] >= 400)
  25. {
  26.  
  27. format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D1Info[d][d1Model] - 400], FormatNumber(D1Info[d][d1Price]), D1Info[d][d1Stock]);
  28. strcat(var, gString);
  29. }
  30. }
  31. strins(var, coordsstring, 0);
  32. ShowPlayerDialog(playerid, DIALOG_DS1, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
  33. }
  34. else if(listitem == 1)
  35. {
  36. for(new d = 0; d < sizeof(D2Info); d++)
  37. {
  38. if(D2Info[d][d2Model] >= 400)
  39. {
  40. format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D2Info[d][d2Model] - 400], FormatNumber(D2Info[d][d2Price]), D2Info[d][d2Stock]);
  41. strcat(var, gString);
  42. }
  43. }
  44. strins(var, coordsstring, 0);
  45. ShowPlayerDialog(playerid, DIALOG_DS2, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
  46. }
  47. else if(listitem == 2)
  48. {
  49. for(new d = 0; d < sizeof(D3Info); d++)
  50. {
  51. if(D3Info[d][d3Model] >= 400)
  52. {
  53. format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D3Info[d][d3Model] - 400], FormatNumber(D3Info[d][d3Price]), D3Info[d][d3Stock]);
  54. strcat(var, gString);
  55. }
  56. }
  57. strins(var, coordsstring, 0);
  58. ShowPlayerDialog(playerid, DIALOG_DS3, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
  59. }
  60. else if(listitem == 3)
  61. {
  62. for(new d = 0; d < sizeof(D4Info); d++)
  63. {
  64. if(D4Info[d][d4Model] >= 400)
  65. {
  66. format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D4Info[d][d4Model] - 400], FormatNumber(D4Info[d][d4Price]), D4Info[d][d4Stock]);
  67. strcat(var, gString);
  68. }
  69. }
  70. strins(var, coordsstring, 0);
  71. ShowPlayerDialog(playerid, DIALOG_DS4, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
  72. }
  73. else if(listitem == 4)
  74. {
  75. for(new d = 0; d < sizeof(D5Info); d++)
  76. {
  77. if(D5Info[d][d5Model] >= 400)
  78. {
  79. format(gString, sizeof(gString), "%s\t$%s\t(%d)\n", VehicleNames[D5Info[d][d5Model] - 400], FormatNumber(D5Info[d][d5Price]), D5Info[d][d5Stock]);
  80. strcat(var, gString);
  81. }
  82. }
  83. strins(var, coordsstring, 0);
  84. ShowPlayerDialog(playerid, DIALOG_DS5, DIALOG_STYLE_TABLIST_HEADERS, "Buy a car", var, "Select", "Cancel");
  85. }
  86. }
  87. }
  88. if(dialogid == DIALOG_DS1)
  89. {
  90. if(response)
  91. {
  92. CreateVeh(playerid, 1, listitem, 1);
  93. }
  94. }
  95. if(dialogid == DIALOG_DS2)
  96. {
  97. if(response)
  98. {
  99. CreateVeh(playerid, 2, listitem, 1);
  100. }
  101. }
  102. if(dialogid == DIALOG_DS3)
  103. {
  104. if(response)
  105. {
  106. CreateVeh(playerid, 3, listitem, 1);
  107. }
  108. }
  109. if(dialogid == DIALOG_DS4)
  110. {
  111. if(response)
  112. {
  113. CreateVeh(playerid, 4, listitem, 2);
  114. }
  115. }
  116. if(dialogid == DIALOG_DS5)
  117. {
  118. if(response)
  119. {
  120. CreateVeh(playerid, 5, listitem, 3);
  121. }
  122. }
Add Comment
Please, Sign In to add comment