<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LulaCrackudo</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LulaCrackudo"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/LulaCrackudo"/>
	<updated>2026-04-24T09:05:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetPedAnimation&amp;diff=69763</id>
		<title>SetPedAnimation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetPedAnimation&amp;diff=69763"/>
		<updated>2021-04-08T10:42:09Z</updated>

		<summary type="html">&lt;p&gt;LulaCrackudo: Removed ElementData from Example 2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
Sets the current [[Animations|animation]] of a [[player]] or [[ped]]. Not specifying the type of animation will automatically cancel the current one.&lt;br /&gt;
{{Warning|It is possible that an animation will be cancelled if you use setElementFrozen on the ped, but this does not happen all the time.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setPedAnimation ( ped thePed [, string block = nil, string anim = nil, int time = -1, bool loop = true, bool updatePosition = true,&lt;br /&gt;
                       bool interruptable = true, bool freezeLastFrame = true, int blendTime = 250, bool retainPedState = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[ped]]:setAnimation||getPedAnimation}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed:''' the [[player]] or [[ped]] you want to apply an [[Animations|animation]] to.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''block:''' the [[Animations|animation]] block's name.&lt;br /&gt;
*'''anim:''' the name of the [[Animations|animation]] within the block.&lt;br /&gt;
*'''time:''' how long the animation will run for in milliseconds.&lt;br /&gt;
*'''loop:''' indicates whether or not the animation will loop.&lt;br /&gt;
*'''updatePosition:''' will change the actual coordinates of the ped according to the animation. Use this for e.g. walking animations.&lt;br /&gt;
*'''interruptable:''' if set to ''false'' other tasks wont be able to interupt the animation. Setting this to 'false' also gives this function more power to override other animations that are running. For example, squatting after a jump can be terminated.&lt;br /&gt;
*'''freezeLastFrame:''' if set to ''true'' after animation the last frame will be frozen, otherwise the animation will end and controls will return.&lt;br /&gt;
*'''blendTime:''' how long the animation will mixed with the previous one in milliseconds.&lt;br /&gt;
{{New items|3.0157|1.5.7|&lt;br /&gt;
*'''retainPedState:''' will restore the task which was playing before calling this function. Useful for restoring the crouch task after animation ends. This may be extended in the future to support other states/tasks.&lt;br /&gt;
|16632}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if succesful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a ped, rotates him, and makes him walk:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function makePed()&lt;br /&gt;
	local thePed = createPed(56, 1, 1, 4, 315)&lt;br /&gt;
	setPedAnimation(thePed, &amp;quot;ped&amp;quot;, &amp;quot;WOMAN_walknorm&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;makemyped&amp;quot;, makePed)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example makes the player sit down and stand up using the command /sit.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local sitting = {}&lt;br /&gt;
function toggleSit(thePlayer)&lt;br /&gt;
	if not sitting[thePlayer] then&lt;br /&gt;
		setPedAnimation(thePlayer, &amp;quot;ped&amp;quot;, &amp;quot;seat_down&amp;quot;, -1, false, false, false, false)&lt;br /&gt;
		-- Store the player state in the table&lt;br /&gt;
                sitting[thePlayer] = true&lt;br /&gt;
	else&lt;br /&gt;
		-- If you use again this command then your character stand up&lt;br /&gt;
		setPedAnimation(thePlayer)&lt;br /&gt;
                -- Delete player from table&lt;br /&gt;
		sitting[thePlayer] = nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;sit&amp;quot;, toggleSit)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.5.7-9.16632|Added retainPedState argument}}&lt;br /&gt;
&lt;br /&gt;
==Issues==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{GH_Issue|1110|retainPedState in setPedAnimation() does not work when latency reduction is set to 1}}&lt;br /&gt;
{{GH_Issue|1090|A replaced &amp;quot;weapon_crouch&amp;quot; animation gets reset to default when using setPedAnimation()}}&lt;br /&gt;
{{GH_Issue|953|setPedAnimation() &amp;quot;interrupt&amp;quot; and &amp;quot;time&amp;quot; has no effect in certain situations}}&lt;br /&gt;
{{GH_Issue|512|setPedAnimation isn't synced properly on server side}}&lt;br /&gt;
{{GH_Issue|467|Ped animations don't sync for new players}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Ped_functions}}&lt;br /&gt;
[[ru:setPedAnimation]]&lt;br /&gt;
[[HU:setPedAnimation]]&lt;/div&gt;</summary>
		<author><name>LulaCrackudo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetTableFromSql&amp;diff=67965</id>
		<title>GetTableFromSql</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetTableFromSql&amp;diff=67965"/>
		<updated>2020-12-08T10:20:00Z</updated>

		<summary type="html">&lt;p&gt;LulaCrackudo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ])&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getTableFromSql ( string/int id )﻿&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''id''': The identifier to which the table was previously saved by using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql]).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a table containing the previously saved data or an empty table.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getTableFromSql ( id )&lt;br /&gt;
	local aRow = executeSQLQuery( &amp;quot;SELECT myTable FROM `Table_System` WHERE ID=?&amp;quot;,id )&lt;br /&gt;
	if ( type ( aRow ) == &amp;quot;table&amp;quot; and #aRow == 0 ) or not aRow then return {&amp;quot;&amp;quot;} end	&lt;br /&gt;
	return fromJSON ( aRow [1] [ &amp;quot;myTable&amp;quot; ] )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableT = {}&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,resourceRoot,&lt;br /&gt;
function()&lt;br /&gt;
local table = getTableFromSql( 1 )&lt;br /&gt;
	if table then&lt;br /&gt;
		TableT = table&lt;br /&gt;
	end&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: *Rayan-Alharbi.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>LulaCrackudo</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetTableFromSql&amp;diff=67964</id>
		<title>GetTableFromSql</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetTableFromSql&amp;diff=67964"/>
		<updated>2020-12-08T10:12:18Z</updated>

		<summary type="html">&lt;p&gt;LulaCrackudo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This functionality is used to obtain saved tables using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql ])&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;table getTableFromSql ( string/int id )﻿&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
* '''id''': The identifier to which the table was previously saved by using the function ([https://wiki.multitheftauto.com/wiki/SetTableToSql SetTableToSql]).&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getTableFromSql ( id )&lt;br /&gt;
	local aRow = executeSQLQuery( &amp;quot;SELECT myTable FROM `Table_System` WHERE ID=?&amp;quot;,id )&lt;br /&gt;
	if ( type ( aRow ) == &amp;quot;table&amp;quot; and #aRow == 0 ) or not aRow then return {&amp;quot;&amp;quot;} end	&lt;br /&gt;
	return fromJSON ( aRow [1] [ &amp;quot;myTable&amp;quot; ] )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TableT = {}&lt;br /&gt;
&lt;br /&gt;
addEventHandler( &amp;quot;onResourceStart&amp;quot;,resourceRoot,&lt;br /&gt;
function()&lt;br /&gt;
local table = getTableFromSql( 1 )&lt;br /&gt;
	if table then&lt;br /&gt;
		TableT = table&lt;br /&gt;
	end&lt;br /&gt;
end )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: *Rayan-Alharbi.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>LulaCrackudo</name></author>
	</entry>
</feed>