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.

138 lines
4.2 KiB

  1. // -----------------------------------------------------------------------------
  2. // Example Filterscript for Kylie's Barn Object
  3. // --------------------------------------------
  4. // By Matite in March 2015
  5. //
  6. //
  7. // This script creates the repaired Kylie's Barn Building object and removes
  8. // the existing GTASA barn object (normally this object has some collision
  9. // bugs that prevent the player from moving about inside it).
  10. //
  11. // Warning...
  12. // This script uses a total of:
  13. // * 1 object = 1 for the replacement barn object
  14. // * Enables the /kb command to teleport the player to Kylie's Barn
  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 number of the replacement barn object so
  31. // it can be destroyed when the filterscript is unloaded
  32. new KyliesBarnObject1; // Barn object
  33. // -----------------------------------------------------------------------------
  34. // Callbacks
  35. // ---------
  36. public OnPlayerCommandText(playerid, cmdtext[])
  37. {
  38. // Check command text
  39. if (strcmp("/kb", cmdtext, true, 3) == 0)
  40. {
  41. // Set the interior
  42. SetPlayerInterior(playerid, 3);
  43. // Set player position and facing angle
  44. SetPlayerPos(playerid, 292.03, 309.82, 999.55);
  45. SetPlayerFacingAngle(playerid, 88);
  46. // Fix camera position after teleporting
  47. SetCameraBehindPlayer(playerid);
  48. // Send a gametext message to the player
  49. GameTextForPlayer(playerid, "~b~~h~Kylie's Barn!", 3000, 3);
  50. // Exit here
  51. return 1;
  52. }
  53. // Exit here (return 0 as the command was not handled in this filterscript)
  54. return 0;
  55. }
  56. public OnFilterScriptInit()
  57. {
  58. // Display information in the Server Console
  59. print("\n");
  60. print(" |---------------------------------------------------");
  61. print(" |--- Kylie's Barn Filterscript");
  62. print(" |-- Script v1.01");
  63. print(" |-- 6th March 2015");
  64. print(" |---------------------------------------------------");
  65. // Create Kylie's Barn repaired object
  66. KyliesBarnObject1 = CreateObject(19881, 286.188, 307.609, 1002.01, 0, 0, 0);
  67. // Display information in the Server Console
  68. print(" |-- Kylie's Barn object created");
  69. print(" |---------------------------------------------------");
  70. // Loop
  71. for (new i = 0; i < MAX_PLAYERS; i++)
  72. {
  73. // Check if the player is connected and not a NPC
  74. if (IsPlayerConnected(i) && !IsPlayerNPC(i))
  75. {
  76. // Remove default GTASA Kylie's Barn object for the player (so any
  77. // player currently ingame does not have to rejoin for them to be
  78. // removed when this filterscript is loaded)
  79. RemoveBuildingForPlayer(i, 14871, 286.188, 307.609, 1002.01, 250.0); // Barn
  80. }
  81. }
  82. // Exit here
  83. return 1;
  84. }
  85. public OnFilterScriptExit()
  86. {
  87. // Check for valid object
  88. if (IsValidObject(KyliesBarnObject1))
  89. {
  90. // Destroy the Kylie's Barn object
  91. DestroyObject(KyliesBarnObject1);
  92. // Display information in the Server Console
  93. print(" |---------------------------------------------------");
  94. print(" |-- Kylie's Barn object destroyed");
  95. }
  96. // Display information in the Server Console
  97. print(" |---------------------------------------------------");
  98. print(" |-- Kylie's Barn Filterscript Unloaded");
  99. print(" |---------------------------------------------------");
  100. // Exit here
  101. return 1;
  102. }
  103. public OnPlayerConnect(playerid)
  104. {
  105. // Remove default GTASA Kylie's Barn object for the player
  106. RemoveBuildingForPlayer(playerid, 14871, 286.188, 307.609, 1002.01, 250.0); // Barn
  107. // Exit here (return 1 so this callback is handled in other scripts too)
  108. return 1;
  109. }