Skip to content

Command helpers

Helpers that build and check command text, so api.ban("user", "RDM", "7d") sends ban user RDM 7d.

Every helper checks its arguments before anything is sent (a bad duration or team raises ValueError straight away) and, by default, raises :class:~oxrpy.CommandFailedError if the server says the command didn't work. Pass check=False to get the result back instead.

With :class:~oxrpy.AsyncOxfordAPI every helper returns a coroutine: await api.kick(...).

CommandHelpers

Mixed into the clients. Each method sends one command with :meth:run_command.

kick

kick(player, reason=None, *, check=True)

Move someone out of your server, showing the reason. Staff can't be kicked.

ban

ban(user, reason=None, duration=None, *, check=True)

Ban someone, in the server or not. duration is "30m", "12h", "7d", "1d12h", a timedelta or seconds; leave it out for a permanent ban. Reasons can be up to 200 characters.

unban

unban(user, *, check=True)

Lift someone's ban.

jail

jail(player, seconds=None, *, check=True)

Jail someone as an arrest would, for 10 to 3,600 seconds (or the usual sentence).

release

release(player, *, check=True)

Release someone from jail.

wanted

wanted(players, level, *, check=True)

Set a wanted level from 0 to 3. players can be a name, all, team:Civilian…

pm

pm(players, message, *, check=True)

Send a private message, shown with your server's name and logo.

resolve_modcall

resolve_modcall(case_id, *, check=True)

Mark a mod call (help request) as handled. The CaseId is in ModCalls.

rank

rank(user, rank, *, check=True)

Put someone on the staff with a rank (its name or Id, e.g. "Admin"), or change it.

unrank

unrank(user, *, check=True)

Take someone off the staff, whatever their rank.

group_add

group_add(user, group, *, check=True)

Add someone to one of your groups (AdvancedServer).

group_remove

group_remove(user, group, *, check=True)

Take someone out of one of your groups (AdvancedServer).

set_team

set_team(player, team, *, check=True)

Put someone on a team, ignoring team limits and locks.

respawn

respawn(players, *, check=True)

Respawn them (the load command).

revive

revive(players, *, check=True)

Get anyone downed back up.

teleport

teleport(players, to_player, *, check=True)

Teleport them next to another player (the tp command).

teleport_to_vehicle

teleport_to_vehicle(players, owner, *, check=True)

Teleport them next to another player's vehicle (the tocar command).

set_invincible

set_invincible(players, invincible=True, *, check=True)

Make them unable to be hurt by weapons (or able to again), until they leave.

give

give(players, tool, *, check=True)

Give a RoleplayKit tool: megaphone, firestarter, lectern, flag or staffcuffs.

despawn_vehicle

despawn_vehicle(player, *, check=True)

Put someone's vehicle away (the despawn command).

remove_vehicle

remove_vehicle(plate_or_player, *, check=True)

Remove a vehicle by registration ("RJ75 FLK") or by its owner.

spawn_vehicle

spawn_vehicle(player, custom_vehicle_id, *, check=True)

Spawn one of your FleetKit custom vehicles in front of them.

repair

repair(player, *, check=True)

Fully repair someone's vehicle, tyres included.

refuel

refuel(player, *, check=True)

Fill someone's tank or battery.

set_time

set_time(hour, *, check=True)

Set the clock to an hour from 0 to 24 (13.5 is 13:30).

lock_time

lock_time(locked=True, *, check=True)

Stop the clock (or start it again with locked=False).

set_weather

set_weather(weather, *, check=True)

Clear, Rain, Snow or Thunderstorm.

lock_weather

lock_weather(locked=True, *, check=True)

Stop the weather changing by itself (or let it again with locked=False).

announce

announce(message, *, check=True)

An announcement to everyone.

team_announce

team_announce(team, message, *, check=True)

An announcement to one team.

alert

alert(message, style='normal', *, check=True)

An alert to everyone, style "normal", "yellow" or "red".

set_message

set_message(message, *, check=True)

Pin a message on everyone's screen until it's removed.

remove_message

remove_message(*, check=True)

Remove the pinned message.

countdown

countdown(seconds, *, check=True)

Show everyone a countdown. 0 stops it.

speed_limit

speed_limit(mph, *, check=True)

Limit every vehicle to 5-200 MPH (RoleplayKit). None or 0 lifts it.

create_incident

create_incident(team, priority, x, z, text, *, check=True)

Open a control-room incident at x, z (studs) for an emergency team, priority 1-3. The new incident's ID is in the result's Message.

assign_incident

assign_incident(incident_id, player, *, check=True)

Send a unit to an incident.

close_incident

close_incident(incident_id, *, check=True)

Close an incident.

radio

radio(team, message, *, check=True)

A radio message from Control to an emergency team.

start_callout

start_callout(team, key, *, check=True)

Start a Fire or Highways callout by its key (RoleplayKit; list_callouts shows keys).

ambulance_callout

ambulance_callout(player=None, *, check=True)

A patient callout for that paramedic, or the first one free (RoleplayKit).

list_callouts

list_callouts(*, check=True)

The callouts you can start, with their keys, in the result's Message.

stop_fires

stop_fires(*, check=True)

Put out every fire and end every fire callout (RoleplayKit).

set_setting

set_setting(name, value, *, check=True)

Change a Server Management setting. value is sent as JSON, so pass Python values: api.set_setting("TeamLimits", {"Police": 8}). Lists and objects replace the whole value.

new_join_code

new_join_code(*, check=True)

Replace the join code with a new random one. The new code is in Message.

queue_remove

queue_remove(user, *, check=True)

Take someone out of the join queue.

queue_front

queue_front(user, *, check=True)

Move someone to the front of the join queue.

clear_placeables

clear_placeables(player='all', *, check=True)

Pick up one person's cones, signs and other placed items, or everyone's.

shutdown

shutdown(*, check=True)

Shut the server down, sending everyone to a public server.

format_duration

format_duration(duration)

Turn "7d", "1d12h", timedelta(hours=12) or a number of seconds into the ban command's duration. None or "permanent" gives "permanent".