SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.3 KiB

5 years ago
  1. // -----------------------------------------------------------------------------
  2. // Example Filterscript for the LS Wells Fargo Building Object
  3. // -----------------------------------------------------------
  4. // By Matite in March 2015
  5. //
  6. //
  7. // This script creates the edited LS Wells Fargo Building object and
  8. // removes the existing GTASA building object.
  9. //
  10. // Warning...
  11. // This script uses a total of:
  12. // * 1 object = 1 for the replacement building object
  13. // * Enables the /lswf command to teleport the player to the LS Wells Fargo Building
  14. // -----------------------------------------------------------------------------
  15. // -----------------------------------------------------------------------------
  16. // -----------------------------------------------------------------------------
  17. // Includes
  18. // --------
  19. // SA-MP include
  20. #include <a_samp>
  21. // -----------------------------------------------------------------------------
  22. // Defines
  23. // -------
  24. // Used for messages sent to the player
  25. #define COLOR_MESSAGE_YELLOW 0xFFDD00AA
  26. // -----------------------------------------------------------------------------
  27. // Variables
  28. // ---------
  29. // Stores the created object number of the replacement building object so
  30. // it can be destroyed when the filterscript is unloaded
  31. new LSWellsFargoObject1; // Building object
  32. // -----------------------------------------------------------------------------
  33. // Callbacks
  34. // ---------
  35. public OnPlayerCommandText(playerid, cmdtext[])
  36. {
  37. // Check command text
  38. if (strcmp("/lswf", cmdtext, true, 5) == 0)
  39. {
  40. // Set the interior
  41. SetPlayerInterior(playerid, 0);
  42. // Set player position and facing angle
  43. SetPlayerPos(playerid, 1448.43, -1468.28, 13.82);
  44. SetPlayerFacingAngle(playerid, 92);
  45. // Fix camera position after teleporting
  46. SetCameraBehindPlayer(playerid);
  47. // Send a gametext message to the player
  48. GameTextForPlayer(playerid, "~b~~h~LS Wells Fargo!", 3000, 3);
  49. // Exit here
  50. return 1;
  51. }
  52. // Exit here (return 0 as the command was not handled in this filterscript)
  53. return 0;
  54. }
  55. public OnFilterScriptInit()
  56. {
  57. // Display information in the Server Console
  58. print("\n");
  59. print(" |---------------------------------------------------");
  60. print(" |--- LS Wells Fargo Building Filterscript");
  61. print(" |-- Script v1.01");
  62. print(" |-- 6th March 2015");
  63. print(" |---------------------------------------------------");
  64. // Create the LS Wells Fargo Building object
  65. LSWellsFargoObject1 = CreateObject(19879, 1421.38, -1477.6, 42.2031, 0, 0, 0);
  66. // Display information in the Server Console
  67. print(" |-- LS Wells Fargo Building object created");
  68. print(" |---------------------------------------------------");
  69. // Loop
  70. for (new i = 0; i < MAX_PLAYERS; i++)
  71. {
  72. // Check if the player is connected and not a NPC
  73. if (IsPlayerConnected(i) && !IsPlayerNPC(i))
  74. {
  75. // Remove default GTASA Wells Fargo Building and LOD map objects for the player
  76. // (so any player currently ingame does not have to rejoin for them
  77. // to be removed when this filterscript is loaded)
  78. RemoveBuildingForPlayer(i, 4007, 1421.38, -1477.6, 42.2031, 250.0); // Building
  79. RemoveBuildingForPlayer(i, 4009, 1421.38, -1477.6, 42.2031, 250.0); // LOD
  80. }
  81. }
  82. // Exit here
  83. return 1;
  84. }
  85. public OnFilterScriptExit()
  86. {
  87. // Check for valid object
  88. if (IsValidObject(LSWellsFargoObject1))
  89. {
  90. // Destroy the Wells Fargo Building object
  91. DestroyObject(LSWellsFargoObject1);
  92. // Display information in the Server Console
  93. print(" |---------------------------------------------------");
  94. print(" |-- LS Wells Fargo Building object destroyed");
  95. }
  96. // Display information in the Server Console
  97. print(" |---------------------------------------------------");
  98. print(" |-- LS Wells Fargo Building Filterscript Unloaded");
  99. print(" |---------------------------------------------------");
  100. // Exit here
  101. return 1;
  102. }
  103. public OnPlayerConnect(playerid)
  104. {
  105. // Remove default GTASA Wells Fargo Building and LOD map objects for the player
  106. RemoveBuildingForPlayer(playerid, 4007, 1421.38, -1477.6, 42.2031, 250.0); // Building
  107. RemoveBuildingForPlayer(playerid, 4009, 1421.38, -1477.6, 42.2031, 250.0); // LOD
  108. // Exit here (return 1 so this callback is handled in other scripts too)
  109. return 1;
  110. }