SetPedDoingGangDriveby: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 18: | Line 18: | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
This example turns on driveby mode when the local player types ''driveby'' in the console. | This example turns on driveby mode when the local player types ''driveby'' in the console. | ||
<syntaxhighlight lang="lua">function setDoingDriveby ( ) | <syntaxhighlight lang="lua">function setDoingDriveby() | ||
-- we check if local player isn't currently doing a gang driveby | -- we check if local player isn't currently doing a gang driveby | ||
if not isPedDoingGangDriveby ( | if not isPedDoingGangDriveby(localPlayer) then | ||
-- if he got driveby mode off, turn it on | -- if he got driveby mode off, turn it on | ||
setPedWeaponSlot ( | setPedWeaponSlot(localPlayer, 4 ) | ||
setPedDoingGangDriveby ( | setPedDoingGangDriveby(localPlayer, true) | ||
else | else | ||
-- otherwise, turn it off | -- otherwise, turn it off | ||
setPedWeaponSlot ( | setPedWeaponSlot(localPlayer, 0) | ||
setPedDoingGangDriveby ( | setPedDoingGangDriveby(localPlayer, false) | ||
end | end | ||
end | end | ||
addCommandHandler ( "driveby", setDoingDriveby )</syntaxhighlight> | addCommandHandler("driveby", setDoingDriveby)</syntaxhighlight> | ||
</section> | </section> | ||
Revision as of 22:42, 26 March 2021
This function sets the driveby state of a ped.
Syntax
bool setPedDoingGangDriveby ( ped thePed, bool state )
Required Arguments
- thePed: The ped element whose state is to be changed.
- state: A boolean value representing the drive-by state, true meaning enabled and false disabled.
Returns
Returns true if the driveby state could be changed, false otherwise.
Example
Click to collapse [-]
ClientThis example turns on driveby mode when the local player types driveby in the console.
function setDoingDriveby() -- we check if local player isn't currently doing a gang driveby if not isPedDoingGangDriveby(localPlayer) then -- if he got driveby mode off, turn it on setPedWeaponSlot(localPlayer, 4 ) setPedDoingGangDriveby(localPlayer, true) else -- otherwise, turn it off setPedWeaponSlot(localPlayer, 0) setPedDoingGangDriveby(localPlayer, false) end end addCommandHandler("driveby", setDoingDriveby)
See Also
- 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