GetPedVoice: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added an example and deleted needs example warning.)
Line 14: Line 14:


==Example==  
==Example==  
This example creates a command (/getvoice) that prints to chatbox your ped voice.
This example creates a command (/getvoice) that prints to chatbox your ped voice type and name.
<section name="Example" class="client" show="true">
<section name="Example" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 03:57, 13 September 2017

Gets the current voice of a ped.

Syntax

string string getPedVoice ( ped thePed )

Required Arguments

  • thePed: the ped to get the voice of.

Returns

If successul, returns the current voice type name and the voice name of the ped (see ped voices for possible names). Returns false in case of failure.

Example

This example creates a command (/getvoice) that prints to chatbox your ped voice type and name.

Click to collapse [-]
Example
addCommandHandler ( "getvoice",
	function ()
		local voicetype, voicename = getPedVoice(localPlayer)
		outputChatBox ( "Your ped voice type is " .. tostring(voicetype) .. " and voice name is ".. tostring(voicename).."." )
	end
)

See Also