GetPlayerTask: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getPlayerTask ( player thePlayer, string priority, int type )
string getPlayerTask ( player thePlayer, string priority, int type, [int index = 0] )
</syntaxhighlight>
</syntaxhighlight>


Line 11: Line 11:
*'''priority''': A string determining which block of tasks you want to retrieve it from. (must be "priority" or "secondary")
*'''priority''': A string determining which block of tasks you want to retrieve it from. (must be "priority" or "secondary")
*'''type''': An integer value representing the task-type (or slot) you want to get the task from.
*'''type''': An integer value representing the task-type (or slot) you want to get the task from.
===Optional Arguments===
*'''index''': An integer value representing how many sub-tasks to go through. (-1 to get the simplest task)


===Returns===
===Returns===

Revision as of 22:36, 17 October 2006

This function is used to get the current task-name of a certain type for a player.

Syntax

string getPlayerTask ( player thePlayer, string priority, int type, [int index = 0] )

Required Arguments

  • thePlayer: The player whose task you want to retrieve.
  • priority: A string determining which block of tasks you want to retrieve it from. (must be "priority" or "secondary")
  • type: An integer value representing the task-type (or slot) you want to get the task from.

Optional Arguments

  • index: An integer value representing how many sub-tasks to go through. (-1 to get the simplest task)

Returns

Returns a string representing the name of the player's task of that type.

Example

This example blows up any vehicle a specified player targets (aims at)

addCommandHandler ( "task", "task" )
function task ( source, key, priority, type )
  task = getPlayerTask ( source, priority, type )
  taskName = "none"
  if ( task ) then
    taskName = task
  end
  outputChatBox ( getClientName ( source ) .. "'s " .. priority .. "(" .. type .. ") task is: " .. taskName )
end    

See Also