EngineUnloadIFP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
{{Disabled|Function disabled. It doesn't exist anymore, use [[DestroyElement|destroyElement]] to unload IFP.}}
__NOTOC__
__NOTOC__
This function unloads an animation library loaded by [[engineLoadIFP]].
This function unloads an animation library loaded by [[engineLoadIFP]].
Line 15: Line 16:


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


Line 25: Line 31:


function stopanimation()
function stopanimation()
engineUnloadIFP(ifp)
  if ifp then
    engineUnloadIFP(ifp)
    setPedAnimation(localPlayer)
  end
end
end


addCommandHandler("stopanimation", stopanimation)
addCommandHandler("stopanimation", stopanimation)
</syntaxhighlight>
</syntaxhighlight>
 
</section>
meta.xml
<section name="meta.xml" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
<info author="lukry" version="1.0" type="script" />
<meta>
<script src="animation/animation.lua" />
  <info author="lukry" version="1.0" type="script" />
<file src="animation/data/ani.ifp" />
  <script src="animation.lua" type="client" />
  <file src="data/ani.ifp" />
</meta>
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Latest revision as of 21:04, 18 June 2018

Dialog-warning.png Function has been disabled.

Reason/Note: Function disabled. It doesn't exist anymore, use destroyElement to unload IFP.


This function unloads an animation library loaded by engineLoadIFP.

Syntax

bool engineLoadIFP ( element ifp ) 

Required Arguments

Returns

Returns true if the IFP file has been unloaded succesfully, false otherwise.

Example

Click to collapse [-]
animation.lua
local localPlayer = getLocalPlayer()
local ifp = nil

function setanimation()
  ifp = engineLoadIFP("data/ani.ifp")
  if ifp then
    setPedAnimation(localPlayer, "ANIMATIONBLOCK", "animation1")
  end
end

addCommandHandler("animation", setanimation)

function stopanimation()
  if ifp then
    engineUnloadIFP(ifp)
    setPedAnimation(localPlayer)
  end
end

addCommandHandler("stopanimation", stopanimation)
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