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.

176 lines
5.7 KiB

  1. // -----------------------------------------------------------------------------
  2. // Example Filterscript for the new SF Building 1
  3. // ----------------------------------------------
  4. // By Matite in February 2015
  5. //
  6. //
  7. // This script creates the new SF Building 1 object and removes the existing
  8. // GTASA building object.
  9. //
  10. // Warning...
  11. // This script uses a total of:
  12. // * 3 objects = 1 for the replacement land object, 1 for the outside object
  13. // and 1 for the inside object
  14. // * Enables the /sfb command to teleport the player to the SF Building 1
  15. // -----------------------------------------------------------------------------
  16. // -----------------------------------------------------------------------------
  17. // -----------------------------------------------------------------------------
  18. // Includes
  19. // --------
  20. // SA-MP include
  21. #include <a_samp>
  22. // -----------------------------------------------------------------------------
  23. // Defines
  24. // -------
  25. // Used for messages sent to the player
  26. #define COLOR_MESSAGE_YELLOW 0xFFDD00AA
  27. // -----------------------------------------------------------------------------
  28. // Variables
  29. // ---------
  30. // Stores the created object numbers of the replacement building objects so
  31. // they can be destroyed when the filterscript is unloaded
  32. new SFBuilding1Object1; // Land object
  33. new SFBuilding1Object2; // Outside object
  34. new SFBuilding1Object3; // Inside object
  35. // -----------------------------------------------------------------------------
  36. // Callbacks
  37. // ---------
  38. public OnPlayerCommandText(playerid, cmdtext[])
  39. {
  40. // Check command text
  41. if (strcmp("/sfb", cmdtext, true, 4) == 0)
  42. {
  43. // Set the interior
  44. SetPlayerInterior(playerid, 0);
  45. // Set player position and facing angle
  46. SetPlayerPos(playerid, -2706.56, 870.91 + random(2), 71.86);
  47. SetPlayerFacingAngle(playerid, 180);
  48. // Fix camera position after teleporting
  49. SetCameraBehindPlayer(playerid);
  50. // Send a gametext message to the player
  51. GameTextForPlayer(playerid, "~b~~h~SF Building!", 3000, 3);
  52. // Exit here
  53. return 1;
  54. }
  55. // Exit here (return 0 as the command was not handled in this filterscript)
  56. return 0;
  57. }
  58. public OnFilterScriptInit()
  59. {
  60. // Display information in the Server Console
  61. print("\n");
  62. print(" |---------------------------------------------------");
  63. print(" |--- SF Building 1 Filterscript");
  64. print(" |-- Script v1.01");
  65. print(" |-- 10th February 2015");
  66. print(" |---------------------------------------------------");
  67. // Create the SF Building 1 Land object
  68. SFBuilding1Object1 = CreateObject(19600, -2719.02, 861.211, 72.1562, 0, 0, 0);
  69. // Display information in the Server Console
  70. print(" |-- SF Building 1 Land object created");
  71. // Create the SF Building 1 Outside object
  72. SFBuilding1Object2 = CreateObject(19598, -2719.02, 861.211, 72.1562, 0, 0, 0);
  73. // Display information in the Server Console
  74. print(" |-- SF Building 1 Outside object created");
  75. // Create the SF Building 1 Inside object
  76. SFBuilding1Object3 = CreateObject(19599, -2719.02, 861.211, 72.1562, 0, 0, 0);
  77. // Display information in the Server Console
  78. print(" |-- SF Building 1 Inside object created");
  79. print(" |---------------------------------------------------");
  80. // Loop
  81. for (new i = 0; i < MAX_PLAYERS; i++)
  82. {
  83. // Check if the player is connected and not a NPC
  84. if (IsPlayerConnected(i) && !IsPlayerNPC(i))
  85. {
  86. // Remove default GTASA SF Building and LOD map objects for the player
  87. // (so any player currently ingame does not have to rejoin for them
  88. // to be removed when this filterscript is loaded)
  89. RemoveBuildingForPlayer(i, 9510, -2719.02, 861.211, 72.1562, 250.0); // Building
  90. RemoveBuildingForPlayer(i, 9671, -2719.02, 861.211, 72.1562, 250.0); // LOD
  91. RemoveBuildingForPlayer(i, 715, -2693.24, 852.60, 71.74, 8.0); // Tree (casts a shadow inside)
  92. }
  93. }
  94. // Exit here
  95. return 1;
  96. }
  97. public OnFilterScriptExit()
  98. {
  99. // Check for valid object
  100. if (IsValidObject(SFBuilding1Object1))
  101. {
  102. // Destroy the SF Building 1 Land object
  103. DestroyObject(SFBuilding1Object1);
  104. // Display information in the Server Console
  105. print(" |---------------------------------------------------");
  106. print(" |-- SF Building 1 Land object destroyed");
  107. }
  108. // Check for valid object
  109. if (IsValidObject(SFBuilding1Object2))
  110. {
  111. // Destroy the SF Building 1 Outside object
  112. DestroyObject(SFBuilding1Object2);
  113. // Display information in the Server Console
  114. print(" |-- SF Building 1 Outside object destroyed");
  115. }
  116. // Check for valid object
  117. if (IsValidObject(SFBuilding1Object3))
  118. {
  119. // Destroy the SF Building 1 Inside object
  120. DestroyObject(SFBuilding1Object3);
  121. // Display information in the Server Console
  122. print(" |-- SF Building 1 Inside object destroyed");
  123. }
  124. // Display information in the Server Console
  125. print(" |---------------------------------------------------");
  126. print(" |-- SF Building 1 Filterscript Unloaded");
  127. print(" |---------------------------------------------------");
  128. // Exit here
  129. return 1;
  130. }
  131. public OnPlayerConnect(playerid)
  132. {
  133. // Remove default GTASA SF Building and LOD map objects for the player
  134. RemoveBuildingForPlayer(playerid, 9510, -2719.02, 861.211, 72.1562, 250.0); // Building
  135. RemoveBuildingForPlayer(playerid, 9671, -2719.02, 861.211, 72.1562, 250.0); // LOD
  136. RemoveBuildingForPlayer(playerid, 715, -2693.24, 852.60, 71.74, 8.0); // Tree (casts a shadow inside)
  137. // Exit here (return 1 so this callback is handled in other scripts too)
  138. return 1;
  139. }