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.
1. Create the folder
Section titled “1. Create the folder”resources/ greeter/ fxmanifest.lua server.lua client.luaThe folder name is the resource name. Use lowercase letters, digits, _ and -.
2. Write the manifest
Section titled “2. Write the manifest”name 'greeter'version '0.1.0'description 'Greets players'
server_script 'server.lua'client_script 'client.lua'See Manifest for all directives.
3. Server script
Section titled “3. Server script”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)4. Client script
Section titled “4. Client script”RegisterNetEvent('greeter:welcome')
AddEventHandler('greeter:welcome', function(text) print(text)end)
CreateThread(function() Wait(1000) TriggerServerEvent('greeter:hello', 'Alex')end)5. Check it in your editor
Section titled “5. Check it in your editor”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.
6. Run it
Section titled “6. Run it”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:
set sv_requireJoinToken falseensure greetergp_fakeplayer client Alexgp_fakeplayer waitclient 1 greetergp_wait 1500quitgampeon-server --data ./server-data --no-stdin +exec test.cfgThe 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.
Next steps
Section titled “Next steps”- Events: talk between server and client safely.
- Threads: loops and timers.
- Make your game, step by step: from project to players.
- Publish to the marketplace.