Instalar com o sampctl
sampctl package install krustowski/crazy-race-life-2
Execute na pasta do seu projeto. O sampctl baixa o pacote e as dependências dele.
Depende de 1 pacote
README.md
CrazyRaceLife2 (CRL2)
A GTA SA:MP/open.mp freeroam gamemode scripted in the Pawn lang with SQL (SQLite) connector built-in.
Live servers:
Features
- Admin Zone
- Game editors (property, race and trucking point editting tools)
- Admin levels 0 to 5 (+ RCON)
- Granularity for commands
- ATM for banking services
- At least one ATM per city/town/village
- Combat Missions (experimental)
- Business robbery with numerous NPC shooters
- Briefcase picking for money exchange ($50k per a Briefcase) at the mission end
- Deathmatch Minigame
- Custom arena in the woods
- "Legal" player killing, no wanted level added per kill
- 4-minute long matches, 45-second interval before a match for players to join
- Localization
- English + Czech + Bosnian (partly, WIP)
- NPC drivers
- 5x Taxi driver per big city + 5x Taxi driver around whole map (20 in total)
- 5x Trucking driver
- 2x Race driver
- Personal cellphone
- Accessed easily via the
KEY_YESkey (Y usually) - Send private messages directly to a player
- Check bank account balance
- Call a service (car mechanic, pizza delivery, a taxi ride, ...)
- Accessed easily via the
- Prizes
- Tiki ($10M) and Pumpkin ($1.5M) pickups
- Hidden on pick up automatically
- Quests
- Onboarding and achievement checklist for new players, with cash rewards
- Defined in the database, progress saved per player
- Replaced the former tutorial (
/tutis now an alias for/quest)
- Racing
- Custom races all across the map
- Air, ground and naval
- Stunts
- Rampage Missions
- 5-minute long clashes with NPCs on the street
- Real Estate
- Custom spawn point
- Custom vehicle attached (including the modifitaions)
- Custom safehouse
- Up to 7 properties per player
- Save custom skins (up to 5 per property)
- Rob Missions
- Robberz team: hold LALT/LSHIFT by a commercial property to rob it for up to 20 seconds
- Robberies chain into one mission until 5 minutes pass without one
- Taxi Missions
- Ad-hoc NPC spawned for a player
- Randomized customer locations and targets
- Increased commissions for the taxi rides with done count
- Areas of operation: LV, SF, LS, or whole map
- Tow Missions
- Car impound service
- Bonus for a new vehicle model (per mission)
- Increased commission for the tow mission count and distance from SF Docks
- Teams
- Custom salary per team
- Special commands available
- Custom weapons
- Team chat using the exclamation mark at the beginning of a message (e.g.
!message)
- Trucking Missions
- 15+ trucking points (petrol stations etc)
- Custom missions
- Weighted commission/bonus per done mission/delivery
Preview
On Connect (authorized spawn)
^ A player spawned at their set spawn-point after a registration/logging-in.
Racing
^ Racing point right after registration into the race. Showing the racing point pickup with the racing point name 3DText text. The first checkpoint starts the race when entered.
Real Estate
^ The exterior of every common personal property shows the entrance point (white arrow pickup), the offer point (green/red house pickup according to the occupance state of such property), and custom vehicle attached.
^ The common interior shows 4 pickups in total: shirt pickup (to change the skin), pills pickup (to deposit/withdraw owned drugz and stuff), heart pickup (to gain full HP and armour), and the exit pickup (to exit the property interior).
^ The custom interior is an ad-hoc built interior (very limited occurance). Pickups are places to custom points, allowing the secondary exit(s) as well.
^ Custom black market entrypoint in a custom interior.
^ The commercial property exterior example. Occupied state is indicated via the 3DText text with the tenant's name. This property can still be outbought by another player though.
Taxi Missions
^ A random customer to take the taxi ride.
^ A random target generated by the customer.
^ A random destination shown when a new customer enters the taxi cab.
Tow Missions
^ A random tow mission attempt stats while a vehicle being towed.
Trucking Missions
^ The trucking mission details shown in the right bottom corner. The marked truck in the picture indicates that the mission is "paused" as the player has to drive it to continue the mission.
^ Detail of a detached trailer (decomposing in the sea waters). Custom information text is shown until the trailer is reattached back to the truck registered for the mission.
How to build and run
The gamemode runs on an open.mp server, or on r2 samp, which the live server uses. Its NPC drivers are open.mp's server-side NPCs, so a plain SA-MP 0.3.7 server (samp03svr) cannot load it: it lacks the NPC_* natives.
The steps below set up a server of your own in a directory of its own, ~/crl2-server here. The NPC drivers will be running, and the server will send each player's join and leave over HTTP to a webhook that forwards them to a Telegram chat.
1. Get the prerequisites
- sampctl, which fetches the Pawn compiler and the dependencies:
dnf install sampctl, or a release from Southclaws/sampctl. - The open.mp server: the Linux x86 archive from the open.mp releases, extracted to
~/crl2-server. Itscomponents/must includeNPCs.so, the NPC component. This repo is tested on open.mp 1.5.8.3079. - 32-bit libraries, because
omp-serveris a 32-bit program:dnf install glibc.i686 libgcc.i686 libatomic.i686on Fedora. On Debian or Ubuntu, rundpkg --add-architecture i386, thenapt install libc6:i386 libgcc-s1:i386 libatomic1:i386. - crashdetect (optional): the plugin from AmyrAhmady/crashdetect, in
~/crl2-server/plugins/. It adds stack traces to run time errors in the log. - For the webhook: adnanh/webhook (
go install github.com/adnanh/webhook@latest, or a release binary), pluscurl,jq, and a Telegram bot token from @BotFather. - python3, only to build the optional airline filterscript.
2. Set the compile-time options
Two settings are compiled into the .amx. The repository holds the live server's values, so change both for a server of your own, and keep these two edits out of your commits:
R2_SERVERin src/support/includes.pwn: set it tofalsefor open.mp.#define R2_SERVER falseWhen it is
true, a trailer is attached to each trucking NPC's cab. An open.mp NPC cannot get into a cab with a trailer attached, so the trucks would never move.truealso adds two adverts that only make sense on the live servers. See docs/servers.md.WEBHOOK_URLin src/support/http.pwn: where the server POSTs the join and leave messages. It points at the live CRL2 webhook, so an unchanged build would report your players to the CRL2 Telegram chat. Set it to your own webhook from step 6. Write it ashost[:port]/pathwith nohttp://in front, the form the PawnHTTP()native takes, and use a plain-HTTP address:static const WEBHOOK_URL[] = "127.0.0.1:9000/hooks/samp-webhook-player";To run without a webhook, point it at a port nothing listens on, such as
127.0.0.1:9/. Each message then fails, and the failure only goes to the log.
3. Build
sampctl ensure # fetches the dependencies in pawn.json and the compiler
make build # or: sampctl build
This writes gamemodes/crl2.amx. make build DEBUG=1 builds it with the debug output on.
To add the optional airline, two AT-400 NPCs flying between Las Venturas and San Fierro, also build its filterscript:
make airline # filterscripts/airline.amx and npcmodes/recordings/AIR_*.rec
4. Fill the server directory
SERVER=~/crl2-server
mkdir -p $SERVER/gamemodes $SERVER/filterscripts $SERVER/npcmodes/recordings $SERVER/scriptfiles
cp gamemodes/crl2.amx $SERVER/gamemodes/
cp npcmodes/recordings/*.rec $SERVER/npcmodes/recordings/
cp filterscripts/airline.amx $SERVER/filterscripts/ # only with the airline
The NPC drivers replay recorded routes, the NPC_TRACK_RACE_*, NPC_TRACK_TAXI_* and NPC_TRACK_TRUCK_* files in npcmodes/recordings/. The airline plays its own AIR_* files. Without the recordings, the drivers have no route to drive.
5. Create the database
The gamemode opens crl2_data.db in the server's scriptfiles/ directory. Build it from the migrations with the goose binary that comes with the repository:
./utils/goose -dir ./sql/migrations sqlite3 $SERVER/scriptfiles/crl2_data.db up
Run the same command again whenever you pull new migrations. Note that make migrate updates crl2_data.db in the repository root, not the one in your server directory. If the server log shows no such table, the migrations never reached the database the server opened.
6. Set up the webhook
When a player joins or leaves, the gamemode POSTs a form field named payload that holds JSON:
payload={"nickname":"Player","state":"connected","reason":""}
payload={"nickname":"Player","state":"disconnected","reason":"left"}
On a join, reason is empty. On a leave, it is crash, left or kick/ban. NPCs send nothing. configs/webhook.json defines the hook samp-webhook-player for adnanh/webhook. The hook passes the nickname, state and reason to configs/webhook.sh, which sends them to a Telegram chat.
Copy both files out of the repository, so that the bot token can never end up in a commit:
mkdir -p ~/crl2-webhook cp configs/webhook.json configs/webhook.sh ~/crl2-webhook/ chmod +x ~/crl2-webhook/webhook.shIn
~/crl2-webhook/webhook.json, setexecute-commandto the script's absolute path. The copy still says/home/user/configs/webhook.sh.In
~/crl2-webhook/webhook.sh, setTELEGRAM_TOKENto the bot token andTELEGRAM_GROUPto the ID of the chat to post to. To find that ID, add the bot to the chat, send a message there, and run the command below. Group IDs are negative.curl -s "https://api.telegram.org/bot<token>/getUpdates" | jq '.result[].message.chat.id'Start the webhook. It listens on port 9000 and serves the hook at
/hooks/samp-webhook-player. When it runs on the game server's host, bind it to loopback so that nobody else can post to your chat:webhook -hooks ~/crl2-webhook/webhook.json -ip 127.0.0.1 -verbose &If it runs on another host, leave out
-ip, or put a reverse proxy in front of it, and setWEBHOOK_URL(step 2) to that host.Send a test message the same way the server does. It should show up in the Telegram chat.
curl -d 'payload={"nickname":"Test","state":"connected","reason":""}' \ http://127.0.0.1:9000/hooks/samp-webhook-player
7. Configure the server
Merge these settings into ~/crl2-server/config.json. The file that comes with the release has many more settings, and those can stay as they are.
{
"name": "CrazyRaceLife2",
"max_players": 100,
"max_bots": 50,
"network": {
"port": 7777
},
"rcon": {
"password": "<a password of your own>"
},
"pawn": {
"main_scripts": ["crl2"],
"side_scripts": ["filterscripts/airline"],
"legacy_plugins": ["crashdetect.so"]
}
}
max_playersmust be at most 100. The gamemode's player arrays have 100 slots (MAX_PLAYERS), and NPCs take their player IDs from the top of that range.max_botsis the NPC limit. At start the gamemode creates 27 driver NPCs: 2 race drivers, 20 taxi drivers and 5 truck drivers. Missions create more while they run: taxi and pizza customers, rampage gunmen, and over 20 NPCs for a combat mission. The live server uses 50. Add 2 if you run the airline. Once the limit is reached,NPC_Createfails, and the NPCs it was meant to create are simply missing.side_scriptsis only needed with the airline. Droplegacy_pluginsif you don't use crashdetect.
If you use a SA-MP style server.cfg instead, the same settings are hostname, maxplayers 100, maxnpc 50, port 7777, rcon_password, gamemode0 crl2, filterscripts airline and plugins crashdetect.so.
8. Start the server and check it
cd ~/crl2-server && ./omp-server
Check the console output (also written to log.txt) for these lines:
Connected to database successfully![npc:join] [NPC]race_drv0 has joined the server, and the same fortaxi_drv0–taxi_drv19andtruck_drv0–truck_drv4.- When a player joins or leaves,
Webhook [playerid N]: HTTP OK.HTTP <code>instead means the server could not reach the webhook.
Connect to 127.0.0.1:7777 with a SA-MP 0.3.7 or open.mp client and register an account. To become an admin, log in with /rcon login <password>, which passes every admin check, then give your account an admin level with /lvl [playerID] [0-5].
To stop the server, type exit into its console. It may ignore Ctrl+C.
Updating
To update the server, pull and run make build, then copy gamemodes/crl2.amx into ~/crl2-server/gamemodes/. Apply any new migrations with the goose command from step 5. Then restart the gamemode with gmx in the server console, or with /restart in game.
Tests, Docker and more
make tests runs the test suite on ./omp-server in the repository root, against a database built fresh from the migrations. It needs omp-server, components/ and a server.cfg there, where server.cfg is a copy of configs/test_server.cfg. To run the server in Docker with compose.yml, see docs/getting-started.md. That page also covers the build options and the airline in more detail.
Vademecum
Command List
/acc --- game account info dump
/admins --- lists admins online
/afk --- (un)sets the Away-From-Keyboard state
/animoff --- clears all animations
/bank --- lists banking subcommands
/cmd --- lists available commands for player
/credits --- shows gamemode credits and version
/dance --- enables special animations (dancing)
/deal --- lists subcommands for dealerz
/drug --- toggles the Drug Mission (Dealerz only)
/deathmatch --- lists subcommands for the deathmatch module
/drugz --- lists substances in pockets
/dwarp --- teleports the player in vehicle to racing the common location
/fix --- repairs the player's vehicle
/fork --- toggles the forklift controls (while driving a forklift)
/fuel --- buys a fill-up at the nearest petrol station
/givecash --- sends cash to other player
/hd --- (un)sets the HUD layout for the HD (widescreen) GTA SA
/help --- lists helper information
/hide --- (un)hides the player on map
/kill --- to commit suicide
/lay --- enables special animations (laying)
/locale --- shows the language list for localization
/locate --- dumps the actual player's coordinates
/lock --- locks the player's vehicle
/phone --- shows the phone call menu
/pm --- sends the private message to other player
/port --- enables to warp to special locations on map
/prizes --- dumps the information about Tiki and Pumpkin prizes
/property --- lists subcommands for property handling
/quest --- lists the quests and your progress
/race --- lists subcommands for racing module
/rules --- dumps the server rules information
/scores --- shows the High Scores table
/search --- special command for Policemen
/skydive --- enables to skydive from random locations
/taxi --- starts a Taxi mission
/tow --- starts a Tow mission
/text --- sends a public message to other player
/truck --- enables/disables the Trucking missions
/tut --- same as /quest
/unlock --- unlocks the player's vehicle
/wanted --- shows the wanted list of online players
Admin Command List
Each level includes the commands of the levels below it. Admins logged in over RCON pass every level check.
Level 1
/acmd --- lists admin commands per level
/admincol --- changes the player color according
/casino --- teleports the admin into the casino
/ccmd --- prints the /cam usage (unfinished)
/clear --- flushes the chat
/combat --- lists the combat missions, or aborts the active one
/flip --- flips and repairs a player's car
/hp --- sets the 100 HP + armour to player
/nitro --- sets the nitrous level to player
Level 2
/cam --- lists subcommands for camera view
/countdown --- sets the seconds to start the countdown
/get --- warps the player to admin
/goto --- warps the admin to player
/skin --- sets the skin for player
Level 3
/crime --- plays the crime sound (Police T-Code), experimental
/drunk --- sets the drunk level to a player
/elevator --- operates the Admin elevator
/kick --- kicks the player from server
/packet --- prints the packet loss per player
/radio --- toggles the internet radio stream
/reset --- resets cash for a player
/spectate --- sets the spectate mode on a player
/vehicle --- spawns a vehicle by ID
/weapon --- sets a vehicle to a player
/weapons --- sets the weapons pack to player
Level 4
/ban --- bans the player (via IP)
/edit --- shows a dialog window with all common editors
/fakechat --- sends the fake chat as a player
/lvl --- sets the Admin level to player
/npcrec --- records an NPC route, or stops the recording
/restart --- sets the countdown for 60 seconds to restart the server
Real Estate
Each property ID has to be unique server-wide. It is recommended to use 5-digit format like 40605, where:
4stands for the greater zone ID06stands for a district/block ID (incremented)05stands for a property ID within the same district/block
Greater zone IDs:
1 - San Fierro
2 - Desert
3 - Las Venturas
4 - Countryside, Farms
5 - Los Santos
Development
omp for Linux
-h "95.216.7.113" -p "39876" -n "krusty" -g "C:\\Program Files (x86)\\Rockstar Games\\GTA San Andreas\\"
Manual NPC Connect
The gamemode creates its own NPC drivers (see How to build and run). For testing, the legacy SA-MP NPC client can also attach a bot by hand:
./samp-npc -h "127.0.0.1" -p "39876" -n "[NPC]taxi" -m "taxi"
Webhook to Telegram
gamemode-ompgamemode-sampgta-san-andreasomp-gamemodeopen-mpopenmp-gamemodepawnpawnosamp-gamemode
Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página