FiveMobileFiveMobile

Эта страница ещё не переведена на русский. Показана английская версия.

Resources and Lua scripts

A resource is a folder inside resources/ with a meta.xml that describes what it contains.

meta.xml

<meta>
    <info author="Your name" description="Welcome message" version="1.0.0" type="script"/>
    <script src="server.lua" type="server"/>
    <script src="client.lua" type="client"/>
</meta>
  • type="server": runs on the server only. Logic, database, economy, security.
  • type="client": sent to the player's phone and runs there. UI, effects, player input.

Golden rule: anything involving money, items or permissions stays on the server. The client can be modified; the server can't.

First script

server.lua:

addEventHandler("onPlayerJoin", root, function()
    outputChatBox("Welcome, " .. getPlayerName(source) .. "!", source, 255, 200, 0)
end)

onPlayerJoin fires when someone joins; source is the player who joined.

Commands

addCommandHandler("heal", function(player)
    setElementHealth(player, 100)
    outputChatBox("Health restored.", player)
end)

Start, stop and reload

In the server console:

start welcome
restart welcome
stop welcome

That way you update one system without kicking players out of the others.

Player-facing text

FiveMobile is multilingual (русский, português, English, Indonesia, español). Avoid hard-coding text: keep messages in a translation file per language and pick by the player's language. Your server is ready for players worldwide from day one.