Here is a simple example of a Lua script for MTA (Multi Theft Auto):

-- Create a command to display a welcome message
addCommandHandler('welcome', function(player)
    outputChatBox('Welcome to MTA, ' .. getPlayerName(player) .. '!')
end)

-- Create a timer to display a message every 5 seconds
setTimer(function()
    outputChatBox('Hello, world!')
end, 5000, 0)

-- Event handler for player joining
addEventHandler('onPlayerJoin', root, function()
    outputChatBox('A new player has joined the server!')
end)

This script creates a command called '/welcome' that displays a welcome message to the player who uses it. It also creates a timer that displays the message 'Hello, world!' every 5 seconds. Additionally, it adds an event handler for when a player joins the server, which displays a message announcing the new player.

MTA Lua Script Example: Welcome Message, Timer, and Player Join Event

原文地址: https://www.cveoy.top/t/topic/bVhd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录