GetPlayerTask: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 9: Line 9:
===Required Arguments===
===Required Arguments===
*'''thePlayer''': The [[player]] whose task you want to retrieve.
*'''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")
*'''priority''': A string determining which set of tasks you want to retrieve it from. This must be either "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. Types can be:
**'''PRIMARY TASKS'''
***'''0:''' TASK_PRIORITY_PHYSICAL_RESPONSE
***'''1:''' TASK_PRIORITY_EVENT_RESPONSE_TEMP
***'''2:''' TASK_PRIORITY_EVENT_RESPONSE_NONTEMP
***'''3:''' TASK_PRIORITY_PRIMARY
***'''4:''' TASK_PRIORITY_DEFAULT
**'''SECONDARY TASKS'''
***'''0:''' TASK_SECONDARY_ATTACK
***'''1:''' TASK_SECONDARY_DUCK
***'''2:''' TASK_SECONDARY_SAY
***'''3:''' TASK_SECONDARY_FACIAL_COMPLEX
***'''4:''' TASK_SECONDARY_PARTIAL_ANIM
***'''5:''' TASK_SECONDARY_IK


===Optional Arguments===
===Optional Arguments===

Revision as of 17:08, 18 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 set of tasks you want to retrieve it from. This must be either "priority" or "secondary".
  • type: An integer value representing the task-type (or slot) you want to get the task from. Types can be:
    • PRIMARY TASKS
      • 0: TASK_PRIORITY_PHYSICAL_RESPONSE
      • 1: TASK_PRIORITY_EVENT_RESPONSE_TEMP
      • 2: TASK_PRIORITY_EVENT_RESPONSE_NONTEMP
      • 3: TASK_PRIORITY_PRIMARY
      • 4: TASK_PRIORITY_DEFAULT
    • SECONDARY TASKS
      • 0: TASK_SECONDARY_ATTACK
      • 1: TASK_SECONDARY_DUCK
      • 2: TASK_SECONDARY_SAY
      • 3: TASK_SECONDARY_FACIAL_COMPLEX
      • 4: TASK_SECONDARY_PARTIAL_ANIM
      • 5: TASK_SECONDARY_IK

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 prints the name of a players task to the chat, when they use the "task" command

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