IsPlayerDoingTask

From Multi Theft Auto: Wiki
Revision as of 11:35, 30 September 2016 by Walid (talk | contribs) (Deprecated function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use isPedDoingTask instead.


This function checks if the specified player is carrying out a certain task.

Syntax

bool isPlayerDoingTask ( player thePlayer, string taskName )

Required Arguments

  • thePlayer: A player object referencing the specified player.
  • taskName: A string containing the name of the task you're checking for.

Returns

Returns true if the player is currently doing the task, false otherwise.

Example

This example checks if the player who entered the 'doingdriveby' command is doing a drive-by (clientside).

function amIDoingADriveby ()
  if ( isPlayerDoingTask ( getLocalPlayer(), "TASK_SIMPLE_GANG_DRIVEBY" ) ) then
    outputChatBox ( getPlayerName ( getLocalPlayer() ) .. " is doing a driveby!!!" )
  else
    outputChatBox ( getPlayerName ( getLocalPlayer() ) .. " is not doing a driveby" )
  end
end
addCommandHandler ( "doingdriveby", amIDoingADriveby )

See Also