Sure! Below is a Lua script for SAMP 0.3.7 that allows a player to teleport to a placed map marker by typing a command. The script is entirely in English and displays an on-screen message when the teleportation is successful.
-- Teleport to Map Marker Script for SAMP 0.3.7
-- This script allows players to teleport to their placed map marker.
-- Function to handle the teleport command
function cmd_gotomarker(playerid)
-- Get the player's map marker coordinates
local x, y, z = GetPlayerMapMarker(playerid)
if x and y and z then
-- Teleport the player to the marker coordinates
SetPlayerPos(playerid, x, y, z + 1) -- Add 1 to Z to prevent falling through the ground
-- Send a success message to the player
SendClientMessage(playerid, 0x00FF00FF, "Teleport successful!")
-- Display an on-screen notification
GameTextForPlayer(playerid, "~g~Teleport successful!", 3000, 3)
else
-- If no marker is placed, inform the player
SendClientMessage(playerid, 0xFF0000FF, "You have not placed a map marker.")
end
end
-- Register the "/gotomarker" command
RegisterCommand("gotomarker", cmd_gotomarker)
Explanation:
- GetPlayerMapMarker(playerid): Retrieves the coordinates of the map marker placed by the player.
- SetPlayerPos(playerid, x, y, z): Teleports the player to the specified coordinates.
- SendClientMessage(playerid, color, message): Sends a chat message to the player.
- GameTextForPlayer(playerid, text, time, style): Displays an on-screen game text for the player.
Usage:
- Place a Map Marker: Open your map in the game and place a marker at your desired teleport location.
- Use the Command: Type
/gotomarker in the chat.
- Teleportation: You will be teleported to the location of the marker.
- Notification: A message "Teleport successful!" will be displayed on your screen.
Notes:
- Ensure that your SAMP server supports Lua scripting and that all necessary modules are installed.
- The script adds 1 to the Z-coordinate (
z + 1) to prevent the player from spawning below the ground level.
- All messages are in English, as per your request.
Installation:
- Save the Script: Copy the script into a file named
teleport.lua.
- Upload to Server: Place the
teleport.lua file into your server's Lua scripts directory.
- Load the Script: Modify your server configuration to load the
teleport.lua script on startup.
- Restart Server: Restart your SAMP server to apply the changes.
Assistance:
If you encounter any issues or need further customization, feel free to ask!
Happy gaming and enjoy your new teleportation script!