SetPedDoingGangDriveby: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Client function}} __NOTOC__ This function sets the driveby state of a ped. ==Syntax== <syntaxhighlight lang="lua"> bool setPedDoingGangDriveby ( ped ped, bool state ) </syntaxhighlight> ===Required Arguments=...)
(No difference)

Revision as of 23:42, 2 May 2009

This function sets the driveby state of a ped.

Syntax

bool setPedDoingGangDriveby ( ped ped, bool state )

Required Arguments

  • ped: the PED element whose state is to be changed
  • state: the new visibility state

Returns

Returns true if the driveby state could be changed, false otherwise.

Example

This example turns on driveby mode when the local player types '/driveby'.

function setDoingDriveby ( )
        -- we check if the gui element is visible
        if getPedWeapon ( getLocalPlayer () ) == 0 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, false )

See Also