Player/Ped Methods

Overview

This documentation covers the Client API (cAPI) functions available in the FRP Framework. The API provides essential functionality for player interactions, world manipulation, UI elements, and game mechanics.

Table of Contents

  • Character Management

  • Player Model & Appearance

  • Animations & Interactions

  • Health & Stats Management

  • Player State Management

  • Wanted System

  • Sickness System


Character Management

Player Model & Appearance

cAPI.SetPlayerPedModel

Changes the player's ped model with proper loading and cleanup.

Parameters:

  • model (string): Model name to set

Features:

  • Validates model before loading

  • Handles model loading wait

  • Sets random outfit variation

  • Fixes stuck ammo clothing pieces

  • Cleans up model from memory

Example:

cAPI.SetPedScale

Sets the scale of a ped entity.

Parameters:

  • ped (number): Ped entity handle

  • num (number): Scale multiplier (default: 1.0)

Example:

cAPI.SetPlayerScale

Sets player scale based on character height from appearance data.

Example:

cAPI.SetPlayerAppearence

Applies the complete character appearance including scale and outfits.

Features:

  • Applies appearance for MP models

  • Sets outfit presets for custom models

  • Updates player scale

Example:

cAPI.SetPlayerDefaultModel

Sets the player model to the stored default model.

Example:

cAPI.ReloadSkin

Reloads the player's skin with timeout protection and health preservation.

Features:

  • 5-second timeout between reloads

  • Saves and restores health/stamina

  • Updates appearance and scale

  • Shows timeout error if called too frequently

Example:

cAPI.SetPlayerWhistle

Configures player whistle characteristics from appearance data.

Example:

cAPI.FixStuckAmmoClothingPiece

Fixes stuck ammunition and pants clothing pieces on MP models.

Example:

cAPI.IsModelMp

Checks if a ped is using a multiplayer model.

Parameters:

  • ped (number): Ped entity handle

Returns:

  • boolean: True if using MP model

Example:


Animations & Interactions

cAPI.TaskScriptedAnim

Plays scripted animations with proper setup.

Parameters:

  • scriptedAnimName (string): Animation name ("eat")

Example:


Health & Stats Management

cAPI.VaryPedHealth

Varies ped health instantly or over time.

Parameters:

  • ped (number): Ped entity handle

  • variation (number): Health change amount

  • variationTime (number, optional): Time in seconds for gradual change

Example:

cAPI.VaryPedStamina

Varies ped stamina instantly or over time.

Parameters:

  • ped (number): Ped entity handle

  • variation (number): Stamina change amount (-1000.0 to 1000.0)

  • variationTime (number, optional): Time in seconds for gradual change

Example:

cAPI.VaryPedCore

Varies ped core values (health/stamina cores) instantly or over time.

Parameters:

  • ped (number): Ped entity handle

  • core (number): Core type (0 = health, 1 = stamina)

  • variation (number): Core change amount

  • variationTime (number, optional): Time in seconds for gradual change

  • goldenEffect (boolean, optional): Show golden effect

Example:

Player-Specific Health Functions

cAPI.VaryPlayerHealth(variation, variationTime)

cAPI.VaryPlayerStamina(variation, variationTime)

cAPI.VaryPlayerCore(core, variation, variationTime, goldenEffect)

Convenience functions that apply health/stamina/core changes to the player.

Example:

cAPI.SetHealth

Sets player health to specific amount.

Parameters:

  • amount (number): Health value to set

Example:

cAPI.GetHealth

Gets current player health.

Returns:

  • number: Current health value

Example:

Health State Management

cAPI.SaveHealth

Saves current health and stamina values for later restoration. Its a cached data only

cAPI.ReturnLastStatus

Restores previously saved health and stamina values.

Example:


Player State Management

cAPI.IsPlayerLassoed

Checks if player is currently lassoed.

Returns:

  • boolean: True if player is lassoed

Example:

cAPI.TeleportPlayerToWaypoint

Teleports player to the active waypoint on the map.

Features:

  • Handles vehicle passengers

  • Uses ground detection

  • Shows error if no waypoint set

  • Uses advanced teleportation system

Example:

Enhanced Teleportation Functions

cAPI.TeleportPlayer

Advanced teleportation with collision detection and ground finding.

Parameters:

  • position (table): Coordinates {x, y, z, w}

  • variation (number, optional): Random offset range

Features:

  • Ground Z detection

  • Collision loading

  • Native teleport system

  • Random position variation

cAPI.TeleportPlayerWithGroundZ

Teleports player using the advanced ground detection system.

Parameters:

  • position (table): Destination coordinates


Wanted System

cAPI.AddWantedTime

Sets or adds wanted status with time duration.

Parameters:

  • wanted (boolean): Wanted status

  • time (number): Duration in minutes

Features:

  • Extends existing wanted time

  • Syncs with server

  • Updates player state

Example:

cAPI.IsWanted

Checks if player is currently wanted.

Returns:

  • boolean: True if player is wanted

Example:

Error Handling and Best Practices

Performance Considerations

  • Use cAPI.ReloadSkin() sparingly due to timeout protection

  • Cache health/stamina values when possible

  • Avoid frequent appearance updates

Common Patterns

Last updated