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
cAPI.SetPlayerPedModelChanges 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.SetPlayerPedModel("mp_female")cAPI.SetPedScale
cAPI.SetPedScaleSets the scale of a ped entity.
Parameters:
ped(number): Ped entity handlenum(number): Scale multiplier (default: 1.0)
Example:
cAPI.SetPedScale(PlayerPedId(), 1.2) -- 20% largercAPI.SetPlayerScale
cAPI.SetPlayerScaleSets player scale based on character height from appearance data.
Example:
cAPI.SetPlayerScale() -- Uses height from gCharAppearencecAPI.SetPlayerAppearence
cAPI.SetPlayerAppearenceApplies 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.SetPlayerAppearence()cAPI.SetPlayerDefaultModel
cAPI.SetPlayerDefaultModelSets the player model to the stored default model.
Example:
cAPI.SetPlayerDefaultModel()cAPI.ReloadSkin
cAPI.ReloadSkinReloads 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.ReloadSkin()cAPI.SetPlayerWhistle
cAPI.SetPlayerWhistleConfigures player whistle characteristics from appearance data.
Example:
cAPI.SetPlayerWhistle()cAPI.FixStuckAmmoClothingPiece
cAPI.FixStuckAmmoClothingPieceFixes stuck ammunition and pants clothing pieces on MP models.
Example:
cAPI.FixStuckAmmoClothingPiece()cAPI.IsModelMp
cAPI.IsModelMpChecks if a ped is using a multiplayer model.
Parameters:
ped(number): Ped entity handle
Returns:
boolean: True if using MP model
Example:
if cAPI.IsModelMp(PlayerPedId()) then
print("Player is using MP model")
endAnimations & Interactions
cAPI.TaskScriptedAnim
cAPI.TaskScriptedAnimPlays scripted animations with proper setup.
Parameters:
scriptedAnimName(string): Animation name ("eat")
Example:
cAPI.TaskScriptedAnim("eat") -- Play eating animationHealth & Stats Management
cAPI.VaryPedHealth
cAPI.VaryPedHealthVaries ped health instantly or over time.
Parameters:
ped(number): Ped entity handlevariation(number): Health change amountvariationTime(number, optional): Time in seconds for gradual change
Example:
cAPI.VaryPedHealth(PlayerPedId(), 50) -- Instant heal
cAPI.VaryPedHealth(PlayerPedId(), 100, 10) -- Heal 100 over 10 secondscAPI.VaryPedStamina
cAPI.VaryPedStaminaVaries ped stamina instantly or over time.
Parameters:
ped(number): Ped entity handlevariation(number): Stamina change amount (-1000.0 to 1000.0)variationTime(number, optional): Time in seconds for gradual change
Example:
cAPI.VaryPedStamina(PlayerPedId(), 200) -- Instant stamina boost
cAPI.VaryPedStamina(PlayerPedId(), -50, 5) -- Drain 50 stamina over 5 secondscAPI.VaryPedCore
cAPI.VaryPedCoreVaries ped core values (health/stamina cores) instantly or over time.
Parameters:
ped(number): Ped entity handlecore(number): Core type (0 = health, 1 = stamina)variation(number): Core change amountvariationTime(number, optional): Time in seconds for gradual changegoldenEffect(boolean, optional): Show golden effect
Example:
cAPI.VaryPedCore(PlayerPedId(), 0, 50) -- Heal health core
cAPI.VaryPedCore(PlayerPedId(), 1, -25, 3) -- Drain stamina core over 3 secondsPlayer-Specific Health Functions
cAPI.VaryPlayerHealth(variation, variationTime)
cAPI.VaryPlayerHealth(variation, variationTime)cAPI.VaryPlayerStamina(variation, variationTime)
cAPI.VaryPlayerStamina(variation, variationTime)cAPI.VaryPlayerCore(core, variation, variationTime, goldenEffect)
cAPI.VaryPlayerCore(core, variation, variationTime, goldenEffect)Convenience functions that apply health/stamina/core changes to the player.
Example:
cAPI.VaryPlayerHealth(100, 5) -- Heal 100 HP over 5 seconds
cAPI.VaryPlayerStamina(50) -- Instant stamina boost
cAPI.VaryPlayerCore(0, 25) -- Heal health corecAPI.SetHealth
cAPI.SetHealthSets player health to specific amount.
Parameters:
amount(number): Health value to set
Example:
cAPI.SetHealth(200)cAPI.GetHealth
cAPI.GetHealthGets current player health.
Returns:
number: Current health value
Example:
local health = cAPI.GetHealth()
print("Current health:", health)Health State Management
cAPI.SaveHealth
cAPI.SaveHealthSaves current health and stamina values for later restoration. Its a cached data only
cAPI.ReturnLastStatus
cAPI.ReturnLastStatusRestores previously saved health and stamina values.
Example:
cAPI.SaveHealth() -- Save current state
-- ... do something that changes health ...
cAPI.ReturnLastStatus() -- Restore saved statePlayer State Management
cAPI.IsPlayerLassoed
cAPI.IsPlayerLassoedChecks if player is currently lassoed.
Returns:
boolean: True if player is lassoed
Example:
if cAPI.IsPlayerLassoed() then
print("Player is lassoed!")
endcAPI.TeleportPlayerToWaypoint
cAPI.TeleportPlayerToWaypointTeleports 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:
cAPI.TeleportPlayerToWaypoint()Enhanced Teleportation Functions
cAPI.TeleportPlayer
cAPI.TeleportPlayerAdvanced 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
cAPI.TeleportPlayerWithGroundZTeleports player using the advanced ground detection system.
Parameters:
position(table): Destination coordinates
Wanted System
cAPI.AddWantedTime
cAPI.AddWantedTimeSets or adds wanted status with time duration.
Parameters:
wanted(boolean): Wanted statustime(number): Duration in minutes
Features:
Extends existing wanted time
Syncs with server
Updates player state
Example:
cAPI.AddWantedTime(true, 10) -- Wanted for 10 minutes
cAPI.AddWantedTime(false) -- Clear wanted statuscAPI.IsWanted
cAPI.IsWantedChecks if player is currently wanted.
Returns:
boolean: True if player is wanted
Example:
if cAPI.IsWanted() then
print("Player is wanted by law!")
endError Handling and Best Practices
Performance Considerations
Use
cAPI.ReloadSkin()sparingly due to timeout protectionCache health/stamina values when possible
Avoid frequent appearance updates
Common Patterns
-- Health management with restoration
cAPI.SaveHealth()
-- ... perform actions that modify health ...
cAPI.ReturnLastStatus()
-- Safe skin reload with error handling
cAPI.ReloadSkin() -- Handles timeout automatically
-- Wanted system usage
if cAPI.IsWanted() then
cAPI.AddWantedTime(true, 5) -- Add 5 more minutes
else
cAPI.AddWantedTime(true, 10) -- Set 10 minute wanted level
endLast updated