0 jugando
Descargar
Tiroteo en una escalera oscura en Mafia II

Documentación

Referencia de funciones

Todas las funciones de la API. A la izquierda, búsqueda y filtro por lado: servidor, cliente o página.

Events

Players

players.all
All players on the server (an array of Player).
players.get
A player by id.
players.count
How many players are on the server.
player.id
The player's number on the server (a property). Freed when the player leaves.
player.name
The player's nickname from the launcher (a property).
player:isValid
Is the player still on the server? A Player object outlives the player leaving, but its methods stop doing anything.
player:setSkin
Changes the character's model. Everyone sees it.
player:getSkin
The player's current model ("" is the default model).
player:setAppearance
Dresses the player as one of MafiaM's characters with its shape sliders. Everyone sees it.
player:getAppearance
The player's model and its shape sliders (an empty table for a plain model).
characters.models
MafiaM's characters: { {name, gender, body, about}, ... }. gender: "male" or "female" for one kind only.
characters.sliders
The shape sliders by group: { face = {...}, body = {...}, legs = {...} }, each { id, name, gender }.
characters.skin
A look as a skin string: characters.skin("MP_H007", { nw = 40 }) → "MP_H007+nw=40". characters.parse(skin) gives the model and sliders back.
characters.preview
Tries a look on in this player's game only (an appearance editor's window); endPreview brings back the skin the server gave.
player:setPosition
Teleports the player.
player:getPosition
Where the player is now (updated 20 times a second). nil until they are in the world.
player:kick
Disconnects the player with a message.
player:hasPermission
Does the player's group have this permission? Groups and their permissions are in m2o_server.ini ([groups] moderator = kick, players; admin = *), players get them by name from [admins] or from your mode: player:setGroup("admin") (e.g. after an account login), player:getGroup().
player:setDimension
Puts the player in a dimension (FiveM's routing buckets): players and vehicles only see those in the same one. 0 = the shared world.
player:getDimension
The player's dimension.
player:setDiscordPresence
One player's own Discord status (the same fields); nil = back to the world's.
players.getByName
A player by nickname (any case), or nil. Client scripts also have players.all() (ids), players.getName(id), players.isStreamed(id), players.getPosition(id).
player:getPing
The round trip to the player, in milliseconds.
player:getMoveMode
How the player moves: "stand", "walk", "run", "sprint", or "vehicle" when in one.
player:isInVehicle
Whether the player sits in a vehicle (player:getVehicle() gives which).
player:setFightStyle
The player's fist-fight style, for everyone: "KugnfuStyle", "HeavyStyle", "LightStyle" ("" = the normal one).
player:getAddress
The player's IP address.
player:getLicense
Who the player is, whatever name they play under: 40 hex digits, the same on every server and every time they come back.
player:getSteamId
The SteamID64 of the Steam account logged in on the player's PC, "" if Steam wasn't running.
player:setControlStyle
What the player's controls allow: no shooting, walking only, fists only... Only that player; stays after respawning. "" = everything.
player:getControlStyle
The player's control style ("" = everything allowed).

Money

World

world.setTraffic
Turns cars and pedestrians on or off for all players.
world.setPolice
Police and wanted levels. Off: there are no police officers and crimes don't make you wanted.
world.getSeason
"summer" (the 50s) or "winter" (the 40s). Set in m2o_server.ini.
world.setWeather
Weather and time of day for everyone: one of the game's weather templates.
world.getWeather
The weather template set with setWeather.
world.setTime
The time of day for everyone: the city's light, the sky, the street lamps. It keeps running at the time scale.
world.getTime
The time of day now; nil if setTime wasn't used (the games keep their own).
world.setTimeScale
How fast the day goes: game minutes in a real minute. 1 = real time (default), 30 = a whole day in 48 minutes, 0 = the clock stands still.
world.getTimeScale
Game minutes in a real minute (see setTimeScale).
world.getTime
The time of day this player sees (the server's, or their own setLocalTime); nil if nobody set it.
world.setLocalTime
A time of day for this player only, for example inside a building or in a dream; setLocalTime(nil) gives them the server's again.
world.setNameTags
Names over players' heads (on by default).
world.setHealthBars
Health bars under the names.
world.setInteriors
The city's interiors - shops, bars, diners, apartments, garages: "free" (the default) - their doors open for anyone and nobody runs them: no shopkeepers, no shop menus, no tills to rob; use them as your mode likes. "closed" - shut. "game" - as in single player (shopkeepers, buying, robberies). world.getInteriors() tells the mode.
world.addPassage
A passage: at its entrance (from, within radius - 1.2 m by default) the player presses its key ("E" by default) - or, with key = false, just walks in - the screen fades and they come out at `to`, facing heading (radians). The hint ("[E] text") shows over the entrance. It's the player's own game that takes them through, at once; the server hears of it in "playerPassage". world.removePassage(id).
world.setDoorLocked
Locks (true) or unlocks (false) the city's door nearest to that spot (within 1.5 m) for every player: locked, nobody opens or kicks it in; unlocked, it opens even when the interiors are "closed". world.resetDoor(x, y, z) leaves it to the interiors mode again, world.isDoorLocked(x, y, z) → true / false / nil.
world.getNearestDoor
The city's door nearest to a point (within radius, 3 m by default): where it is and whether it's locked; nil if there's none. A shop's, a bar's, an apartment's - those of the interiors the game has loaded around you.
world.setWalkByDefault
On foot players walk; a quick tap on Shift switches to a jog and back, holding Shift sprints. On by default; false = the game's own controls (always jogging).
world.setDiscordPresence
What players' Discord shows while they play here (Rich Presence): details, state, largeImage, largeText, smallImage, smallText, buttons (up to 2 {label, url}), appId (your own Discord application; default: MafiaM's). {server}, {players}, {maxPlayers}, {name} are filled in.
physics.raycast
What a ray from one point to another hits first (the game's physics: walls, ground, cars, people). entity is "player" or "vehicle" with its id when it hit one.

Objects

Vehicles

vehicles.create
Creates a car all players see. The driver controls it, everyone else sees it move.
vehicles.all
All of the server's cars.
vehicles.get
A car by id.
vehicle:getDriver
Who is driving (seat 0).
vehicle:getOccupants
Everyone in the car: a table seat → player (0 is the driver).
vehicle:getPassengers
The passengers (everyone but the driver).
vehicle:getPosition
Where the car is (as its driver reports).
vehicle:setPosition
Moves the car (for everyone, the driver included).
vehicle:destroy
Removes the car for everyone.
player:getVehicle
Which of the server's cars the player is sitting in.
player:getVehicleSeat
The player's seat in the car: 0 is the driver, 1 and up are passengers.
player:isDriver
Is the player driving one of the server's cars?
vehicle:setDimension
Puts a vehicle in a dimension: only players in the same one see it.
vehicle:getDimension
The vehicle's dimension.
player:warpIntoVehicle
Seats the player at once, no walk or animation (seat 0 = driver). player:putInVehicle(vehicle, seat, atOnce) walks to the door unless atOnce.
vehicle:getFreeSeats
The free seats (0 = driver). Also vehicle:getSeatCount() and vehicle:isSeatFree(seat). nil until a player's game has shown that model.
vehicle:setHandling
Changes this car's handling (mass, engine, gears, suspension, brakes...) at once, while it drives too. Only the fields given change.
vehicle:getHandling
All the car's handling fields: its model's (cars.json) with what setHandling changed over them.
vehicle:resetHandling
The car's handling back to its model's.
vehicles.getModelHandling
A car model's own handling (from cars.json next to the server).
vehicles.getModelInfo
A car model's name and paint jobs: { model, name, colors = { {code, primary, secondary}, ... }, ... }.
vehicle:setPlate
The vehicle's number plate, for everyone (6 characters, like "M2O-77").
vehicle:getPlate
The plate set with setPlate (nil: the game's own).
vehicle:setColor
Paints the vehicle, for everyone: a colour of the game's palette (numbers from 0); a second colour makes it two-tone.
vehicle:setEngine
Starts or stops the engine, for everyone.
vehicle:setBeacon
The beacon lights (police, ambulance...), for everyone.
vehicle:setSiren
The siren, for everyone.
vehicle:setHorn
Holds the horn, for everyone.
vehicle:setDirt
How dirty it is, 0 (clean) to 1, for everyone.
vehicle:setFuel
Fuel in the tank, for everyone.
vehicle:setLocked
Locks the doors (nobody gets in), for everyone.
vehicle:setHoodOpen
Opens / closes the hood, for everyone.
vehicle:setTrunkOpen
Opens / closes the trunk, for everyone.
vehicle:setSpeedLimit
A speed limiter, for everyone; nil takes it off.
vehicle:repair
Repairs and cleans the vehicle, for everyone.
vehicle:explode
Blows the vehicle up, for everyone.
vehicle:getSpeed
How fast it goes (from its driver's game).
vehicle:getVelocity
Its velocity, meters per second.
vehicle:setPaint
Two-tone paint: two colours of the game's palette (the same as setColor with two). For everyone.
vehicle:setTuning
Engine tuning, as in the game's garage (the model's tuning table). For everyone.
vehicle:setWheel
The wheels of an axle (0 = front pair, 1 = rear pair) to another wheel model - one the game has loaded, i.e. on some car nearby (wheel_civ02, wheel_civ04..09, wheel_univers_d / _n / _s, wheel_truckciv01 / 02). For everyone.
vehicle:setTyre
One tyre (0..3). For everyone.
vehicle:setWindowOpen
Rolls a seat's window down / up (0 = driver). For everyone.
vehicle:setDoorUnlatched
The door's latch lets go: it opens a little and swings as the car moves (0 = the driver's). For everyone.
vehicle:setBusDoorsOpen
A bus's doors. For everyone.
vehicle:setTrunkLocked
Locks the trunk. For everyone.
vehicle:setPartRemoved
Takes a part off (doors, hood, bumpers... by the model's part number) or puts it back. For everyone.
vehicle:setHeadlightsOff
Keeps the headlights off. For everyone.
vehicle:setBodyDamage
Body damage, in the game's units. For everyone.
vehicle:setEngineDamage
Engine damage, in the game's units (smoke, stalling). For everyone.
vehicle:setExplosionProof
The vehicle doesn't blow up. For everyone.
vehicle:setTyresProof
Bulletproof tyres. For everyone.
vehicle:setDamageResistance
How much damage it takes (the game's resistance). For everyone.
vehicle:setFrozen
Holds the vehicle where it is (a showroom...). For everyone.
vehicle:setRadio
The radio: a station of the game (names not found yet), on / off. For everyone.
vehicle:attachTo
Links the vehicle to another one (the game's LinkToEntity: towing...). detach() undoes it. For everyone.
vehicle:detach
Unlinks the vehicle. For everyone.
vehicle:revEngine
The rev-up effect (sound and engine shake); false stops it. For everyone.
vehicle:playAnimation
One of the vehicle's own animations (a convertible's roof...). For everyone.
vehicle:stopAnimation
Stops it. For everyone.
vehicle:getNative
What the server set under a key ("plate", "color", "window0"...), or nil.
vehicle:callNative
Calls one of the game's own functions (see the Natives page, C_WrapperCar) on this vehicle in everyone's game who sees it, once.
vehicle:setNative
Like callNative, but kept under key: whoever comes near later gets it too, and it's applied again if the game re-creates the vehicle. clearNative(key) forgets it.
vehicle:clearNative
Forgets a native kept with setNative (what it did stays until something changes it).

Data

Resources

Timers

Debugging

Own character

Camera

Interface (HTML)

Interface (ImGui)

Page (JavaScript)

Health

Weapons

Client events

Chat

Character

HUD

Security

NPCs

Blips

Labels

Bans

Animations

Natives

Keys