Skip to content
GAMPEONCreate
New project
Preview: this works today, but details can still change.

Your first resource

This walkthrough builds a resource that greets every player who joins. It takes about ten minutes. If you prefer to describe what you want and let an AI write the code, follow Your first game with AI instead. Both paths end with the same files.

resources/
greeter/
fxmanifest.lua
server.lua
client.lua

The folder name is the resource name. Use lowercase letters, digits, _ and -.

fxmanifest.lua
name 'greeter'
version '0.1.0'
description 'Greets players'
server_script 'server.lua'
client_script 'client.lua'

See Manifest for all directives.

server.lua
RegisterNetEvent('greeter:hello')
AddEventHandler('greeter:hello', function(name)
-- source is the player who sent the event. Never trust the name blindly.
if type(name) ~= 'string' or #name > 32 then return end
print(('Player %d says hello as %s'):format(source, name))
TriggerClientEvent('greeter:welcome', source, ('Welcome, %s!'):format(name))
end)
client.lua
RegisterNetEvent('greeter:welcome')
AddEventHandler('greeter:welcome', function(text)
print(text)
end)
CreateThread(function()
Wait(1000)
TriggerServerEvent('greeter:hello', 'Alex')
end)

Install the editor setup once. Your editor then knows every GAMPEON function, warns about typos and shows the documentation on hover. Functions that do not exist in GAMPEON, such as GTA natives, are marked as unknown.

Put the folder into the resources/ folder of a server folder, add ensure greeter to server.cfg and start gampeon-server. It runs your resource without the game, with fake players:

test.cfg
set sv_requireJoinToken false
ensure greeter
gp_fakeplayer client Alex
gp_fakeplayer waitclient 1 greeter
gp_wait 1500
quit
Terminal window
gampeon-server --data ./server-data --no-stdin +exec test.cfg

The output shows [greeter] Player 1 says hello as Alex from the server and [client 1/greeter] Welcome, Alex! from the fake player’s client script.

Report a problem with this pageOther ways to give feedback