GetPlayerSimplestTask: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(fixed silly example mistake)
m (Visual improvement)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
This function is used to get the name of a specified players current simplest task.
{{Client function}}
{{Deprecated|getPedSimplestTask}}
 
This function is used to get the name of a specified players current simplest [[task]].<br>
'''DP2 note:''' Don't call this on players that have not spawned. This will crash the client.


==Syntax==
==Syntax==
Line 8: Line 12:


===Required Arguments===
===Required Arguments===
*'''thePlayer''': The [[player]] whose task you want to retrieve.
*'''thePlayer''': The [[player]] whose [[task]] you want to retrieve.


===Returns===
===Returns===
Returns a string representing the name of the player's simplest, active task.
Returns a string representing the name of the player's simplest, active [[task]].


==Example==
==Example==
This example prints the name of a players simplest task to the chat, when they use the "simplest_task" command
This example prints the name of a players simplest task to the chat, when they use the "sTask" command.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "simplest_task", "task" )
function showSTask ()
function task ( source, key )
   local thetask = getPlayerSimplestTask ( getLocalPlayer() )
   task = getPlayerSimplestTask ( source )
   outputChatBox ( getPlayerName ( getLocalPlayer() ) .. "'s simplest task is: " .. thetask )
   outputChatBox ( getClientName ( source ) .. "'s simplest task is: " .. task )
end
end  
addCommandHandler ( "sTask", showSTask )
 
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 10:54, 26 June 2014

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 getPedSimplestTask instead.


This function is used to get the name of a specified players current simplest task.
DP2 note: Don't call this on players that have not spawned. This will crash the client.

Syntax

string getPlayerSimplestTask ( player thePlayer )

Required Arguments

  • thePlayer: The player whose task you want to retrieve.

Returns

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

Example

This example prints the name of a players simplest task to the chat, when they use the "sTask" command.

function showSTask ()
  local thetask = getPlayerSimplestTask ( getLocalPlayer() )
  outputChatBox ( getPlayerName ( getLocalPlayer() ) .. "'s simplest task is: " .. thetask )
end
addCommandHandler ( "sTask", showSTask )

See Also