PPC_DefPlanes.inc 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This file holds an array of defined Planes, used in the /Plane dialog
  2. enum TPlane
  3. {
  4. PlaneName[50], // Holds the name of the Plane
  5. PlaneModel // Holds the model-ID of the Plane
  6. }
  7. new APlanes[][TPlane] =
  8. {
  9. {"Andromada", 592}, {"AT400", 577}, {"Beagle", 511}, {"Cargobob", 548}, // ID 0, 1, 2, 3
  10. {"Cropduster", 512}, {"Dodo", 593}, {"Hunter", 425}, {"Hydra", 520}, // ID 4, 5, 6, 7
  11. {"Leviathan", 417}, {"Maverick", 487}, {"Nevada", 553}, {"Police Maverick", 497}, // ID 8, 9, 10, 11
  12. {"Raindance", 563}, {"Rustler", 476}, {"SAN News Maverick", 488}, {"Seasparrow", 447}, // ID 12, 13, 14, 15
  13. {"Shamal", 519}, {"Skimmer", 460}, {"Sparrow", 469}, {"Stuntplane", 513} // ID 16, 17, 18, 19
  14. };
  15. // This function creates a list of Planes, starting from the FirstPlane and automatically shows the dialog
  16. PlaneList_Create(playerid)
  17. {
  18. // Setup local variables
  19. new Counter, PlaneList[500], DialogTitle[128];
  20. // Only add 10 Planes to the list, starting from the FirstPlane
  21. for (new i = APlayerData[playerid][DialogPlaneFirstPlane]; i < sizeof(APlanes); i++)
  22. {
  23. // Increase a counter (which holds the number of Planes that have been added to the list
  24. Counter++;
  25. // Check if the maximum hasn't been reached yet
  26. if (Counter <= 10)
  27. {
  28. // Add the Planename to the list
  29. if (strlen(PlaneList) == 0) // If this is the start of the list (no Planes have been added yet)
  30. format(PlaneList, 500, "%s", APlanes[i][PlaneName]); // Add the name of the Plane at the start of the Planelist
  31. else
  32. format(PlaneList, 500, "%s%s%s", PlaneList, "\n", APlanes[i][PlaneName]); // Add the name of the next Plane to the list on the next line
  33. }
  34. else // 10 Planes have been added to the list (now Counter = 11)
  35. {
  36. // Add an empty line and "Next..." to the list to let the player know there are more Planes to choose from
  37. format(PlaneList, 500, "%s%s%s", PlaneList, "\n \n", TXT_DialogEntryNext);
  38. // Also stop the For-loop
  39. break;
  40. }
  41. }
  42. // Construct the title for the dialog (to include a page number)
  43. format(DialogTitle, 128, TXT_DialogPlaneTitle, (APlayerData[playerid][DialogPlaneFirstPlane] / 10) + 1);
  44. // Ask which Plane the player wants to have by showing the dialog
  45. ShowPlayerDialog(playerid, DialogPlane, DIALOG_STYLE_LIST, DialogTitle, PlaneList, TXT_DialogButtonSpawn, TXT_DialogButtonCancel);
  46. return 1;
  47. }