Skip to content

SCM API Documentation

Tornamic edited this page Apr 1, 2025 · 4 revisions

Opcode Documentation

Overview

This document provides detailed information about each opcode, its purpose, and the parameters it uses.


Opcodes

1D00:

  • Name: Coop.AddChatMessage
  • Description: Adds a chat message to the local player, does not send to other players, useful for debugging
  • Input:
    • %1s% - Message content (string, max length: 127 characters)
  • Note: Color embedding formats {RRGGBB} or {RRGGBBAA} can be used when applicable
  • Example:
    Coop.AddChatMessage("Hello World! {FF0000}Red {0000FF}Blue {FFFFFF66}Semitransparent {FFFFFF00}Invisible")

1D01:

  • Name: Coop.GetNetworkPlayerChar
  • Description: Returns the actor of a network player by the network player id
  • Input:
    • %1d% - Network player id (int)
  • Output:
    • %2d% - Player character (aka actor aka ped) (Char)
  • Example:
    int character = Coop.GetNetworkPlayerChar(0)
    Char.SetCoordinates(character, 954.7896, -1100.557, 23.7927)
    Task.GoStraightToCoord(character, 970.9996, -1104.479, 23.8896, MoveState.Run, 10000)

1D02:

  • Name: Coop.CollectNetworkPlayersForTheMission
  • Description: Returns the first 3 network players to be used in a mission or script
  • Output:
    • %1d% - Player character 1 (Char)
    • %2d% - Player character 2 (Char)
    • %3d% - Player character 3 (Char)
  • Example:
    $NETWORK_PLAYER[0], $NETWORK_PLAYER[1], $NETWORK_PLAYER[2] = Coop.CollectNetworkPlayersForTheMission();
    FOR $temp_int = 0 to 2
      if Coop.IsNetworkPlayerActorValid($NETWORK_PLAYER[$temp_int]) // see the opcode below
      then
        Char.ClearTasks($NETWORK_PLAYER[$temp_int])
        Char.ClearTasksImmediately($NETWORK_PLAYER[$temp_int])
        Char.SetCoordinates($NETWORK_PLAYER[$temp_int], 2509.619, -1679.898, 13.5469)
      end
    end

1D03:

  • Name: Coop.IsNetworkPlayerActorValid
  • Description: Condition, returns true if the passed character is a network player and is connected to the server
  • Input:
    • %1d% - Character (Char)
  • Example:
    if Coop.IsNetworkPlayerActorValid($NETWORK_PLAYER[0])
    then
      Coop.AddChatMessage("$NETWORK_PLAYER[0] is here and ready to play")
    end

Clone this wiki locally