IsPedDoingGangDriveby

From Multi Theft Auto: Wiki
Revision as of 09:03, 3 May 2009 by Awwu (talk | contribs) (New page: {{Server client function}} __NOTOC__ This function checks if the ped is in the driveby state. ==Syntax== <syntaxhighlight lang="lua"> bool isPedDoingGangDriveby ( ped thePed ) </syntaxhighlight> ===Required Arg...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function checks if the ped is in the driveby state.

Syntax

bool isPedDoingGangDriveby ( ped thePed )

Required Arguments

  • thePed: The ped element whose state is to be checked.

Returns

Returns true if the driveby state is enabled, 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