Skip to content

world.isRuleEnabled

Returns whether a world rule is on: one of the game’s own features that the server can switch for everyone.

Renamed in 0.28 from world.rule; see renamed names.

world.isRuleEnabled(name: WorldRuleName): boolean
Name Type Description
name WorldRuleName The rule’s name; see the table below.

true when the rule is on.

gamemodes/my-mode.ts
import { server, world } from "nativemp";
if (!world.isRuleEnabled("wanted")) server.log("No police on this server.");
Rule The game’s own feature
pause The pause menu, which stops the player’s game and its entities for everyone
slowmotion Adrenaline pills and the stunt camera’s slow motion
cheats Typed cheat codes
replay The replay recorder
playerDied The wasted and busted sequence: fade, warp, time skip, weapon loss
farewarps Trip skip, taxi, bus and train fares
saving Save pickups and the save menu
story Story missions, phone calls, cutscenes and mission markers
stats Skills, hunger, fat and muscle
property Girlfriends, buying property and its income
interiormarkers The enter and exit markers of shops and mission interiors
helpmessages Single-player help tips and stat messages
stuntbonus Unique stunt jump bonuses
wanted Wanted levels and the police
gangwars Gang wars and territory
emergency Ambulances and fire trucks answering calls
pickups The game’s own weapon, armour, health and bribe pickups, and dropped money
garages Pay ‘n’ Spray, mod garages, the bomb shop and garages
ambientvehicles Ambient trains, planes overhead and boats
sidejobs Vigilante, taxi, races, schools, minigames and casinos
collectibles Tags, horseshoes, oysters, photo spots and stunt jumps
shops Clothes, barbers, tattoos, food and Ammu-Nation
npcdrops Dead NPCs drop their weapons and money (needs pickups on). On by default
nametags Players’ names, health and armour above their heads. On by default
owncarcap Each wanted player’s game keeps its own police car count, instead of sharing one with wanted players nearby
ambientlife The game’s ambient scripts: bar, casino, strip club and shop staff and their patrons, the army bases’ and airports’ gates. On by default
vending Vending machines: $1 for a drink, +30 health when it is finished. With stats on, a drink also adds calories (health and fat)
streetfood Vendors at food carts and hotdog vans: $1 for food, +50 health (and calories with stats on). A vendor serves again 30 seconds after a buyer leaves
gym The gyms’ bench, bike, dumbbells and treadmill, one player at a time. With stats on, a finished session adds muscle or stamina
petrolcap GTA:SA’s instant vehicle kill when a bullet hits its petrol cap. On by default; off makes it ordinary body damage

Everything except npcdrops, nametags, ambientlife and petrolcap starts off, unless the server’s [rules] in server.ini turns it on.

A test server can start with rules=testing under [server] (or --rules testing): every rule is on except the ten that fight a shared session (pause, slowmotion, cheats, replay, playerDied, farewarps, saving, story, stats, property) and owncarcap, which keep their defaults. A [rules] line still wins over it. A gamemode sees the result here and can change any rule with world.setRule.