Jump to content

What is wrong here?


mcer

Recommended Posts

 function LowBloodAnim() 
    local getplayer = getPlayerName(sourcePlayer) 
    if getElementHealth ( sourcePlayer ) <= 20 then 
    if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then 
    setPedAnimation ( sourcePlayer, "crack", "crckidle1", -1, true, true, false ) 
    end 
    end 
    end 

It's serverside.

Link to comment
  • MTA Team

He is asking, how does that function execute..? With command? event?..Etc..

EDIT: You must define sourcePlayer.. Example:

function say (sourcePlayer) 
end 
addCommandHandler ( "hello", say ) 

Edited by Guest
Link to comment
  • MTA Team
function LowBloodAnim(sourcePlayer) 
    local getplayer = getPlayerName(sourcePlayer) 
    if getElementHealth ( sourcePlayer ) <= 20 then 
    if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then 
    setPedAnimation ( sourcePlayer, "crack", "crckidle1", -1, true, true, false ) 
    end 
    end 
    end 
addCommandHandler ( "anim", LowBloodAnim ) 
  

Link to comment

Look (Clientside).

  
    addEventHandler('onClientResourceStart',resourceRoot, 
    function () 
    Shocking1() 
    end 
    ) 
     
      
             function Shocking1() 
      setTimer ( 
        function  (  ) 
            local anim = {getPedAnimation( localPlayer )} 
                if getElementHealth ( localPlayer ) <= 20 then 
                if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then 
                addEventHandler("onClientRender", getRootElement(), ShockWinGui) 
                setPedAnimation ( localPlayer, "crack", "crckidle1", -1, true, true, false ) 
            end 
       else 
            if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then 
            setPedAnimation( localPlayer, false) 
            removeEventHandler("onClientRender", getRootElement(), ShockWinGui) 
                end 
            end 
         end,500,0 
      ) 
     end 
  

It set the anim only for the client... The other players can't see it.

Link to comment
  • MTA Team
addEventHandler('ResourceStart',resourceRoot, 
    function () 
    Shocking1() 
    end 
    ) 
    
      
             function Shocking1() 
for i,v in ipairs(getElementsByType("player")) do 
      setTimer ( 
        function  (  ) 
            local anim = {getPedAnimation( v )} 
                if getElementHealth ( v ) <= 20 then 
                if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then 
                setPedAnimation ( v, "crack", "crckidle1", -1, true, true, false ) 
            end 
       else 
            if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then 
            setPedAnimation( v, false) 
                end 
            end 
         end,500,0 
      ) 
     end 
end 

It would be something like that,.Im from my cell, Maybe wrong somewhere,Try it..Anyway there are event handlers a bit strange there...Is it your script?

Link to comment
addEventHandler('ResourceStart',resourceRoot, 
    function () 
    Shocking1() 
    end 
    ) 
    
      
             function Shocking1() 
for i,v in ipairs(getElementsByType("player")) do 
      setTimer ( 
        function  (  ) 
            local anim = {getPedAnimation( v )} 
                if getElementHealth ( v ) <= 20 then 
                if not ( anim[1] == "crack" and anim[2] =="crckidle1" ) then 
                setPedAnimation ( v, "crack", "crckidle1", -1, true, true, false ) 
            end 
       else 
            if ( anim[1] == "crack" and anim[2] == "crckidle1" ) then 
            setPedAnimation( v, false) 
                end 
            end 
         end,500,0 
      ) 
     end 
end 

It would be something like that,.Im from my cell, Maybe wrong somewhere,Try it..Anyway there are event handlers a bit strange there...Is it your script?

Don't work and no errors in Debugscript. :/

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...