SetPedFrozen

From Multi Theft Auto: Wiki
Revision as of 20:52, 14 July 2009 by Fenix1053 (talk | contribs) (New page: __NOTOC__ {{Server client function}} This function freezes (or un-freezes) a pedestrian, meaning they cannot move, jump, aim, shoot, etcetera. ==Syntax== <syntaxhighlight lang="lua"> bool setPedFrozen ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function freezes (or un-freezes) a pedestrian, meaning they cannot move, jump, aim, shoot, etcetera.

Syntax

bool setPedFrozen ( ped thePed, bool frozen )

Required Arguments

  • thePed: The ped whose frozen state will be changed.
  • frozen: A bool value as to whether the ped is frozen or not.

Example

This example adds a 'togglefreeze' console command that lets players alternate their frozen state.

function toggleFreeze ( sourcePlayer, command )
    local frozen = getPedFrozen ( sourcePlayer )
    setPedFrozen ( sourcePlayer, not frozen )
end
-- add our function as a handler for "hpslap"
addCommandHandler ( "togglefreeze", toggleFreeze )

See Also