SetPedGravity: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→See Also) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
bool setPedGravity ( ped thePed, float gravity ) | bool setPedGravity ( ped thePed, float gravity ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[ped]]:setGravity|gravity|getPedGravity}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 22: | Line 23: | ||
local success = setPedGravity ( thePlayer, tonumber ( level ) ) -- Set the gravity | local success = setPedGravity ( thePlayer, tonumber ( level ) ) -- Set the gravity | ||
if not success then -- Check if setPlayerGravity was false (not successful) | if not success then -- Check if setPlayerGravity was false (not successful) | ||
outputConsole( "Failed to set | outputConsole( "Failed to set ped gravity", thePlayer ) -- If success is false, meaning gravity could not be set, this message will show | ||
end | end | ||
end | end | ||
Line 30: | Line 31: | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions|server}} | ||
[[ru:setPedGravity]] | [[ru:setPedGravity]] |
Latest revision as of 22:36, 6 September 2024
This function sets the gravity level of a ped.
Syntax
bool setPedGravity ( ped thePed, float gravity )
OOP Syntax Help! I don't understand this!
- Method: ped:setGravity(...)
- Variable: .gravity
- Counterpart: getPedGravity
Required Arguments
- thePed: The ped whose gravity to change.
- level: The level of gravity (default is 0.008).
Returns
Returns true if the gravity was successfully set, false otherwise
Example
This example allows the user to type a command to change their gravity:
function consoleSetPlayerGravity ( thePlayer, commandName, level ) if thePlayer and level then local success = setPedGravity ( thePlayer, tonumber ( level ) ) -- Set the gravity if not success then -- Check if setPlayerGravity was false (not successful) outputConsole( "Failed to set ped gravity", thePlayer ) -- If success is false, meaning gravity could not be set, this message will show end end end addCommandHandler ( "setplayergravity", consoleSetPlayerGravity )
See Also
- getPedGravity
- reloadPedWeapon
- setPedChoking
- setPedGravity
- setPedWearingJetpack
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle