SetPedDoingGangDriveby

From Multi Theft Auto: Wiki
Revision as of 23:42, 2 May 2009 by Trjack (talk | contribs) (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=...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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