SimulatePlayerInputGait
DocsSimulatePlayerInputGait(player, amount, gaitType, rotationSpeed, p4, p5)Description
This is to make the player walk without accepting input.
Call this native every frame so you can control the direction of your ped.
Parameters
| Name | Type | Description |
|---|---|---|
player | Player | The player to target (always your local player id). |
amount | float | For game pads, using anything less than 1.0 will make it partially press analog controls (like sticks/triggers). |
gaitType | int | Value in increments of 100's. 2000, 500, 300, 200, etc. Set to -1 if you want your ped to walk forever. |
rotationSpeed | float | Determines the counterclockwise rotation angle when walking. |
p4 | BOOL | Always true |
p5 | BOOL | Always false |
Quick Snippet: Get Playerplayer
playerUse this to get the local player ID or a target player's server ID.
-- Get the local player index (client-side)
local playerId = PlayerId()
-- Get the local player's server ID (for server events)
local serverId = GetPlayerServerId(playerId)
print("Player ID: " .. playerId)
print("Server ID: " .. serverId)
-- Get player ped from a server ID:
-- local targetPed = GetPlayerPed(GetPlayerFromServerId(targetServerId))Returns
voidThis native does not return a value.
Examples
Official
SimulatePlayerInputGait(Game.Player.Handle, 1f, 100, 1f, 1, 0); //Player will go forward for 100ms
SimulatePlayerInputGait(Game.Player.Handle, 1f, -1, 0f, 1, 0); //Player will go straight forward forever, stop when facing walls or obstacles.