SetPedFrozen: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
{{Deprecated}}
Please use [[setElementFrozen]]
This function freezes (or un-freezes) a pedestrian, meaning they cannot move, jump, aim, shoot, etcetera.
This function freezes (or un-freezes) a pedestrian, meaning they cannot move, jump, aim, shoot, etcetera.



Revision as of 15:44, 2 October 2011

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.


Please use setElementFrozen

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

Syntax

[lua,N]
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.

Returns

Returns true if the frozen state was set successfully, or false if invalid arguments were passed.

Example

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

function toggleFreeze ( sourcePlayer )
    local frozen = getPedFrozen ( sourcePlayer )
    setPedFrozen ( sourcePlayer, not frozen )
end
addCommandHandler ( "togglefreeze", toggleFreeze )

See Also