SetPedDoingGangDriveby: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 35: Line 35:
==See Also==
==See Also==
{{Ped functions}}
{{Ped functions}}
[[ru:setPedDoingGangDriveby]]

Revision as of 18:12, 8 July 2010

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 [-]
Client

This 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 ( getLocalPlayer () ) then
                -- if he got driveby mode off, turn it on
                setPedWeaponSlot ( getLocalPlayer (), 4 )
                setPedDoingGangDriveby ( getLocalPlayer (), true )
        else
                -- otherwise, turn it off
                setPedWeaponSlot ( getLocalPlayer (), 0 )
                setPedDoingGangDriveby ( getLocalPlayer (), false )
        end
end
addCommandHandler ( "driveby", setDoingDriveby )

See Also