GetPedSimplestTask: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
{{Client function}}
{{Client function}}
This function is used to get the name of a specified ped's current simplest [[task]].<br>
This function is used to get the name of a specified ped's current simplest [[task]].<br>
{{Note|See [[getPedTask]] to get a all tasks.}}
{{Note|See [[getPedTask]] to get a ped's task.}}


==Syntax==
==Syntax==
Line 16: Line 16:


==Example==
==Example==
This example prints the name of a player's simplest task to the chat, when they use the "sTask" command.
This example prints the name of a player's simplest task to the chat, when they use the "simplestTask" command.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function showSTask ()
function showSimplestTask()
  local thetask = getPedSimplestTask ( getLocalPlayer() )
    local taskName = getPedSimplestTask(localPlayer)
  outputChatBox ( getPlayerName ( getLocalPlayer() ) .. "'s simplest task is: " .. thetask )
    local playerName = getPlayerName(localPlayer)
 
    outputChatBox(playerName.."'s simplest task is: "..taskName)
end
end
addCommandHandler ( "sTask", showSTask )
addCommandHandler("simplestTask", showSimplestTask)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client_ped_functions}}
{{Client_ped_functions}}

Latest revision as of 13:58, 26 November 2021

This function is used to get the name of a specified ped's current simplest task.

[[{{{image}}}|link=|]] Note: See getPedTask to get a ped's task.

Syntax

string getPedSimplestTask ( ped thePed )

Required Arguments

  • thePed: The ped whose task you want to retrieve.

Returns

Returns a string representing the name of the ped's simplest, active task.

Example

This example prints the name of a player's simplest task to the chat, when they use the "simplestTask" command.

function showSimplestTask()
    local taskName = getPedSimplestTask(localPlayer)
    local playerName = getPlayerName(localPlayer)

    outputChatBox(playerName.."'s simplest task is: "..taskName)
end
addCommandHandler("simplestTask", showSimplestTask)

See Also