EngineLoadIFP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:


==Example==
==Example==
animation.lua
<section name="animation.lua" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setanimation()
function setanimation()
engineLoadIFP("data/ani.ifp")
  if engineLoadIFP("data/ani.ifp") then
setPedAnimation(getLocalPlayer(), "ANIMATIONBLOCK", "animation1")
    setPedAnimation(getLocalPlayer(), "ANIMATIONBLOCK", "animation1")
  end
end
end


addCommandHandler("animation", setanimation)
addCommandHandler("animation", setanimation)
</syntaxhighlight>
</syntaxhighlight>
</section>
<section name="meta.xml" class="server" show="true">
<syntaxhighlight lang="lua">
<meta>
  <info author="lukry" version="1.0" type="script" />


meta.xml
  <script src="animation.lua" type="client" />
<syntaxhighlight lang="lua">
  <file src="data/ani.ifp" />
<info author="lukry" version="1.0" type="script" />
</meta>
<script src="animation/animation.lua" />
<file src="animation/data/ani.ifp" />
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Engine_functions}}
{{Engine_functions}}

Revision as of 13:12, 10 December 2010

This function loads an animation library (IFP) file into GTA.

  • This function does not replace animations yet, you can only use the animations that are inside the IFP with setPedAnimation.
  • To use this correctly, you need to use an IFP file with new animation blocks with different names than existing ones.


This is a client side function. Be sure to transfer your IFP file by including it in the meta file.

Syntax

ifp engineLoadIFP ( string ifp_file ) 

Required Arguments

  • ifp_file: The filepath to the IFP file you want to load

Returns

Returns an IFP element if the IFP file loaded, false otherwise.

Example

Click to collapse [-]
animation.lua
function setanimation()
  if engineLoadIFP("data/ani.ifp") then
    setPedAnimation(getLocalPlayer(), "ANIMATIONBLOCK", "animation1")
  end
end

addCommandHandler("animation", setanimation)
Click to collapse [-]
meta.xml
<meta>
  <info author="lukry" version="1.0" type="script" />

  <script src="animation.lua" type="client" />
  <file src="data/ani.ifp" />
</meta>

See Also