### Querying Documentation Source: https://rplus.ollieee.xyz/getting-started Demonstrates how to query the documentation dynamically by performing an HTTP GET request with the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started.md?ask= ``` -------------------------------- ### API Request Example Source: https://rplus.ollieee.xyz/getting-started/getting-player-details Example of how to query the documentation dynamically by making a GET request with an 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started/getting-player-details.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/getting-the-map This example shows how to perform an HTTP GET request to query the documentation dynamically. ```http GET https://rplus.ollieee.xyz/api-methods/getting-the-map.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/event-system/events-overview Example of how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/event-system/events-overview.md?ask= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://rplus.ollieee.xyz/api-methods/getting-map-markers This example shows how to perform an HTTP GET request to a documentation URL with an 'ask' query parameter to get specific information not directly present on the page. ```http GET https://rplus.ollieee.xyz/api-methods/getting-map-markers.md?ask= ``` -------------------------------- ### Querying documentation dynamically Source: https://rplus.ollieee.xyz/api-methods/removing-listeners This example shows how to perform an HTTP GET request to a documentation page with an 'ask' query parameter to get specific information. ```http GET https://rplus.ollieee.xyz/api-methods/removing-listeners.md?ask= ``` -------------------------------- ### main.py Source: https://rplus.ollieee.xyz/getting-started/quick-start Demonstrates how to check for and handle RustError instances when API methods are not successful. ```python time = await socket.get_time() if isinstance(time, RustError): print(f"Error Occurred, Reason: {time.reason}") ``` -------------------------------- ### main.py Source: https://rplus.ollieee.xyz/command-system/commands-overview Example of how to set up and use a basic command that responds to a keyword in team chat. ```python from rustplus import RustSocket, CommandOptions, Command, ServerDetails, Command, ChatCommand options = CommandOptions(prefix="!") # Use whatever prefix you want here server_details = ServerDetails("IP", "PORT", STEAMID, PLAYERTOKEN) socket = RustSocket(server_details, command_options=options) @Command(server_details) async def hi(command : ChatCommand): await socket.send_team_message(f"Hi, {command.sender_name}") ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/getting-the-time Example of how to query the documentation dynamically using the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/getting-the-time.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/getting-team-chat Example of how to perform an HTTP GET request to query the documentation dynamically using the `ask` query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/getting-team-chat.md?ask= ``` -------------------------------- ### Query Documentation Source: https://rplus.ollieee.xyz/api-methods/sending-messages Example of how to query the documentation dynamically using an HTTP GET request with the `ask` query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/sending-messages.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/command-system/hanging-the-socket Example of how to perform an HTTP GET request to query documentation dynamically. ```http GET https://rplus.ollieee.xyz/command-system/hanging-the-socket.md?ask= ``` -------------------------------- ### Agent Instructions: Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/getting-entity-information Demonstrates how to query the documentation dynamically using an HTTP GET request with the `ask` query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/getting-entity-information.md?ask= ``` -------------------------------- ### main.py Source: https://rplus.ollieee.xyz/getting-started/quick-start Connects to a Rust server using provided details and prints the current server time. ```python import asyncio from rustplus import RustSocket, ServerDetails async def main(): server_details = ServerDetails("IP", "PORT", STEAMID, PLAYERTOKEN) socket = RustSocket(server_details) await socket.connect() print(f"It is {(await socket.get_time()).time}") await socket.disconnect() asyncio.run(main()) ``` -------------------------------- ### CommandOptions Initialization Source: https://rplus.ollieee.xyz/command-system/command-options Example of initializing CommandOptions with a prefix. ```python from rustplus import CommandOptions options = CommandOptions(prefix="!") ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/command-system/command-options Example of how to query the documentation dynamically using the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/command-system/command-options.md?ask= ``` -------------------------------- ### Python Wrapper Initialization Source: https://rplus.ollieee.xyz/getting-started/getting-player-details Example of how to initialize the RustSocket class in Python using obtained player details (IP address, port, Steam ID, and player token). ```python rust_socket = RustSocket("IPADDRESS", "PORT", 64BITSTEAMID, PLAYERTOKEN) ``` -------------------------------- ### Accessing First Member's Name Source: https://rplus.ollieee.xyz/api-methods/getting-team-info Example of how to retrieve the name of the first member of a team. ```python info = await rust_socket.get_team_info() print(info.members[0].name) ``` -------------------------------- ### Querying Documentation Dynamically Source: https://rplus.ollieee.xyz/getting-started/getting-player-details/getting-entity-ids Demonstrates how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started/getting-player-details/getting-entity-ids.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/getting-started/rustsocket Example of how to query the documentation dynamically using the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started/rustsocket.md?ask= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://rplus.ollieee.xyz/api-methods/getting-contents-of-monitors This snippet demonstrates how to perform an HTTP GET request to query the documentation dynamically with the `ask` query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/getting-contents-of-monitors.md?ask= ``` -------------------------------- ### Converting to Grid Reference Source: https://rplus.ollieee.xyz/api-methods/getting-map-markers This Python code example demonstrates how to convert map coordinates (x, y) to a grid reference using the convert_coordinates function from the rustplus library, after fetching map information. ```python from rustplus import convert_coordinates info = await rust_socket.get_info() if isinstance(info, RustError): print(f"Error Occurred, Reason: {info.reason}") grid = convert_coordinates((x, y), info.map_size) print(f"Grid Reference: {grid}") ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/getting-server-info To ask a question about the documentation, perform an HTTP GET request on the current page URL with the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/api-methods/getting-server-info.md?ask= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://rplus.ollieee.xyz/api-methods To get additional information not directly available on the page, perform an HTTP GET request with the 'ask' query parameter. ```HTTP GET https://rplus.ollieee.xyz/api-methods.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/command-system Perform an HTTP GET request on the current page URL with the `ask` query parameter to query the documentation dynamically. ```http GET https://rplus.ollieee.xyz/command-system.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/getting-started/rustsocket/rate-limiting Example of how to query the documentation dynamically using the 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started/rustsocket/rate-limiting.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://rplus.ollieee.xyz/event-system Instructions on how to perform an HTTP GET request to query the documentation dynamically using the `ask` query parameter. ```HTTP GET https://rplus.ollieee.xyz/event-system.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/cameras/camera-managers Perform an HTTP GET request on the current page URL with the `ask` query parameter to dynamically query the documentation. ```http GET https://rplus.ollieee.xyz/cameras/camera-managers.md?ask= ``` -------------------------------- ### RustSocket Constructor Source: https://rplus.ollieee.xyz/getting-started/rustsocket Example of how to construct a RustSocket object with its required and optional arguments. ```python from rustplus import RustSocket socket = RustSocket(ip, port, steam_id, player_token, command_options, raise_ratelimit_exception, ratelimit_limit, ratelimit_refill, use_proxy) ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/cameras Instructions on how to query the documentation dynamically using an HTTP GET request with the 'ask' query parameter. ```HTTP GET https://rplus.ollieee.xyz/cameras.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/getting-started/getting-player-details/fcm-listener Example of how to query the documentation dynamically using an 'ask' query parameter. ```http GET https://rplus.ollieee.xyz/getting-started/getting-player-details/fcm-listener.md?ask= ``` -------------------------------- ### Querying Documentation Dynamically Source: https://rplus.ollieee.xyz/command-system/command-decorator Demonstrates how to perform an HTTP GET request with an 'ask' query parameter to retrieve specific information from the documentation. ```http GET https://rplus.ollieee.xyz/command-system/command-decorator.md?ask= ``` -------------------------------- ### main.py Source: https://rplus.ollieee.xyz/getting-started/getting-player-details/fcm-listener Example Python code for setting up an FCM listener to receive notifications from the game server. ```python from rustplus import FCMListener import json with open("rustplus.py.config.json", "r") as input_file: fcm_details = json.load(input_file) class FCM(FCMListener): def on_notification(self, obj, notification, data_message): print(notification) FCM(fcm_details).start() ``` -------------------------------- ### Querying Documentation Source: https://rplus.ollieee.xyz/api-methods/promoting-players-to-team-leader Perform an HTTP GET request on the current page URL with the `ask` query parameter to query the documentation dynamically. ```http GET https://rplus.ollieee.xyz/api-methods/promoting-players-to-team-leader.md?ask= ``` -------------------------------- ### Send Team Message Source: https://rplus.ollieee.xyz/api-methods/sending-messages Example of sending a message to the team chat using `rust_socket.send_team_message`. ```python await rust_socket.send_team_message("Hi! This was sent with Rust+.py") ``` -------------------------------- ### Camera Manager Creation Source: https://rplus.ollieee.xyz/cameras/camera-managers Get the camera manager from the socket. The parameter is the camera ID. ```python # Get the camera manager from the socket: camera_manager = await socket.get_camera_manager("drone") # The parameter is the camera ID ``` -------------------------------- ### listeners.py Source: https://rplus.ollieee.xyz/event-system/events-overview Example Python code demonstrating how to set up listeners for various socket events (Entity, Team, Chat, Protobuf) in Rust Plus. ```python from rustplus import EntityEventPayload, TeamEventPayload, ChatEventPayload, ProtobufEvent, ChatEvent, EntityEvent, TeamEvent # You must call get_entity_info(eid) before an EntityEvent listener will receive any data. # This is to "subscribe" to the entity. @EntityEvent(server_details, 25743493) async def alarm(event: EntityEventPayload): value = "On" if event.value else "Off" print(f"Entity has been turned {value}") @TeamEvent(server_details) async def team(event: TeamEventPayload): print(f"The team leader's steamId is: {event.team_info.leader_steam_id}") @ChatEvent(server_details) async def chat(event: ChatEventPayload): print(f"{event.message.name}: {event.message.message}") @ProtobufEvent(server_details) async def proto(data: bytes): print(data) ``` -------------------------------- ### Rate Limiting Configuration Source: https://rplus.ollieee.xyz/getting-started/rustsocket/rate-limiting Example of how to configure RustPlus.py to either raise an exception or wait when rate limits are exceeded. ```python from rustplus import RustSocket # To raise exceptions when rate limits are exceeded (default) socket = RustSocket(server=server, port=port, password=password, raise_ratelimit_exception=True) # To wait until enough tokens are available socket = RustSocket(server=server, port=port, password=password, raise_ratelimit_exception=False) ``` -------------------------------- ### RustMarker Types Source: https://rplus.ollieee.xyz/api-methods/getting-map-markers This snippet lists the different types of RustMarkers and their corresponding integer values. ```text Types: Player = 1 Explosion = 2 VendingMachine = 3 CH47 = 4 CargoShip = 5 Crate = 6 GenericRadius = 7 PatrolHelicopter = 8 ``` -------------------------------- ### RustInfo Object Structure Source: https://rplus.ollieee.xyz/api-methods/getting-server-info The RustInfo object returned by rust_socket.get_info() contains the following fields. ```python class RustInfo with fields: url: str name: str map: str size: int players: int max_players: int queued_players: int seed: int ``` -------------------------------- ### RustTime Object Structure Source: https://rplus.ollieee.xyz/api-methods/getting-the-time The structure of the RustTime object returned by rust_socket.get_time(), detailing its fields. ```python class RustTime with fields: day_length: float sunrise: str sunset: str time: str raw_time: float ``` -------------------------------- ### RustContents and RustItem object structure Source: https://rplus.ollieee.xyz/api-methods/getting-contents-of-monitors This snippet shows the structure of the `RustContents` and `RustItem` objects returned by the `rust_socket.get_contents` method. ```python class RustContents with fields: protection_time: timedelta has_protection: bool contents : List[RustItem] class RustItem with fields: name: str item_id: int quantity: int is_blueprint: bool ``` -------------------------------- ### RustMap and RustMonument Data Structures Source: https://rplus.ollieee.xyz/api-methods/getting-the-map This Python code defines the structure of the RustMap and RustMonument objects returned by the `get_map_info()` method. ```python class RustMap with fields: width: int height: int jpg_image: bytes margin: int monuments : List[RustMonument] background: str class RustMonument with fields: token: str x: float y: float ``` -------------------------------- ### RustChatMessage Fields Source: https://rplus.ollieee.xyz/api-methods/getting-team-chat Defines the fields available in a `RustChatMessage` object returned by the `get_team_chat()` method. ```python class RustChatMessage with fields: steam_id: int name: str message: str colour: str time: int ``` -------------------------------- ### RustTeamInfo Data Structure Source: https://rplus.ollieee.xyz/api-methods/getting-team-info Defines the structure of the `RustTeamInfo` object, including leader Steam ID, members, and map notes. ```python class RustTeamInfo with fields: leader_steam_id: int members : List[RustTeamMember] map_notes : List[RustTeamNote] leader_map_notes : List[RustTeamNote] class RustTeamMember with fields: steam_id: int name: str x: float y: float is_online: bool spawn_time: int is_alive: bool death_time: int class RustTeamNote with fields: type: int x: float y: float icon: int colour_index: int label: string ``` -------------------------------- ### Entity Type Mapping Source: https://rplus.ollieee.xyz/api-methods/getting-entity-information Integer values for entity types are mapped to specific entity names. ```plaintext Switch = 1 Alarm = 2 StorageMonitor = 3 ``` -------------------------------- ### RustEntityInfo Object Structure Source: https://rplus.ollieee.xyz/api-methods/getting-entity-information The `RustEntityInfo` object returned by `rust_socket.get_entity_info` contains detailed information about an entity. ```python class RustEntityInfo with fields: type: int value: bool items : RustEntityInfoItem capacity: int has_protection: bool protection_expiry: int class RustEntityInfoItem with fields: item_id: int quantity: int item_is_blueprint: bool ``` -------------------------------- ### Getting Camera Frames Source: https://rplus.ollieee.xyz/cameras/camera-managers Fetch a camera frame using the camera manager. Returns a PIL Image. Use `camera_manager.has_frame_data()` to check if frame data is available. ```python camera_manager = await socket.get_camera_manager("drone") image = await camera_manager.get_frame() # PIL Image ``` -------------------------------- ### RustMarker Data Structure Source: https://rplus.ollieee.xyz/api-methods/getting-map-markers This snippet shows the fields and their types for the RustMarker object returned by rust_socket.get_markers(). It also includes the nested structures for RustColour and RustSellOrder. ```python class RustMarker with fields: id: int type: int x: float y: float steam_id: int rotation: float radius: float colour1 : RustColour colour2 : RustColour alpha: float name: str sell_orders : List[RustSellOrder] class RustColour with fields: x: float y: float z: float w: float class RustSellOrder with fields: item_id: int quantity: int currency_id: int cost_per_item: int item_is_blueprint: bool currency_is_blueprint: bool amount_in_stock: int ``` -------------------------------- ### FCM Notification Data Structure Source: https://rplus.ollieee.xyz/getting-started/getting-player-details This JSON structure represents the data received for FCM (Firebase Cloud Messaging) notifications, including details like IP address, player ID, and player token. ```json { "desc": "",se "id": "", "img": "", "ip": "", <- This is the IP "logo": "", "name": "", "playerId": "", <- This is your steam player ID "playerToken": "", <- This is your unique token "port": "", <- This is the port "type": "", "url": "" } ``` -------------------------------- ### Hang the socket Source: https://rplus.ollieee.xyz/command-system/hanging-the-socket This code snippet demonstrates how to hang the script using the `hang()` method to allow for command listening. ```python await rust_socket.hang() ``` -------------------------------- ### Promote to Team Leader Method Source: https://rplus.ollieee.xyz/api-methods/promoting-players-to-team-leader This method promotes the player in your team to the leader. ```rust rust_socket.promote_to_team_leader(steam_id: int) ``` -------------------------------- ### Resubscribing to Camera Feed Source: https://rplus.ollieee.xyz/cameras/camera-managers Resubscribe to the camera feed if the last subscription was more than 10 seconds ago. ```python if time.time() - camera_manager.time_since_last_subscribe > 10: await camera_manager.resubscribe() ``` -------------------------------- ### Basic Command Decorator Usage Source: https://rplus.ollieee.xyz/command-system/command-decorator Marks a coroutine as a command listener. The coroutine's name determines the command prefix. ```python from main import server_details @Command(server_details) async def hi(command: ChatCommand): print("Command Ran!") ``` -------------------------------- ### Command Decorator with Aliases Source: https://rplus.ollieee.xyz/command-system/command-decorator Allows multiple aliases to be registered for a single command. ```python @ChatCommand(server_details, aliases=["hello", "hey"]) async def hi(command: ChatCommand): print("Command Ran!") ``` -------------------------------- ### Controlling Drones and Cameras Source: https://rplus.ollieee.xyz/cameras/camera-managers Control drone and camera movements, including zooming and firing. Requires clearing movement after use. ```python # Check that it is possible to zoom the camera in and out if camera_manager.can_move(CameraMovementOptions.FIRE) and \ camera_manager.can_move(CameraMovementOptions.MOUSE): # Send a MovementControl action to the camera await camera_manager.send_actions([MovementControls.FIRE_PRIMARY]) # You can also send just mouse movement or both at the same time: await camera_manager.send_mouse_movement(Vector(1, 1)) await camera_manager.send_combined_movement( [MovementControls.FIRE_PRIMARY], Vector(1, 1)) await asyncio.sleep(1) # You must clear the movement after you are done # as otherwise the mouse will continue to move and the server # Will consider the mouse still clicked down await camera_manager.clear_movement() ``` -------------------------------- ### Command Decorator with Alias Function Source: https://rplus.ollieee.xyz/command-system/command-decorator Provides a flexible way to define custom alias logic using a callable function. ```python @ChatCommand(server_details, alais_func=lambda x: x.lower() == "test") async def pair(command: ChatCommand): print("Command Ran!") ``` -------------------------------- ### Unregistering a specific listener Source: https://rplus.ollieee.xyz/api-methods/removing-listeners This code snippet demonstrates how to define an entity event listener and then unregister it using the HandlerList. ```python @EntityEvent(server_details, 25743493) async def on_entity_event(payload: EntityEventPayload): await rust_socket.set_entity_value(payload.entity_id, not payload.value) EntityEventPayload.HANDLER_LIST.unregister(on_entity_event, server_details) # You can also unregister all listeners for a specific event EntityEventPayload.HANDLER_LIST.unregister_all() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.