Sign in to follow this  
Pikachu

[HELP] nil element

Recommended Posts

function moveCrim(theAttacker, attackerWeapon) 
        if getElementType(source) == "player" and getElementType(theAttacker) == "player" and (attackerWeapon == 33) then 
                setElementFrozen(source, true) 
                setTimer(function(source) 
                        setElementFrozen(source, false) 
                end, 5000, 1) 
        end 
end 
addEventHandler("onPlayerDamage", getRootElement(), moveCrim) 

WARNING: [gameplay]\NetGun\script.lua:5: Bad argument @ 'setElementFrozen' [Expected element at argument 1, got nil]

Help me please :'(

Share this post


Link to post

Source only works if you use it directly as the function gets runned, so with a timer, the source 'fades' away and then you can't use it anymore.

Share this post


Link to post
Source only works if you use it directly as the function gets runned, so with a timer, the source 'fades' away and then you can't use it anymore.

Is there a solution? This is the only problem I have, and REALLY need it fixed asap :(

Share this post


Link to post
function moveCrim(theAttacker, attackerWeapon) 
        if theAttacker and getElementType(theAttacker) == "player" and (attackerWeapon == 33) then 
                setElementFrozen(source, true) 
                setTimer(function(source) 
                        setElementFrozen(source, false) 
                end, 5000, 1, source) 
        end 
end 
addEventHandler("onPlayerDamage", getRootElement(), moveCrim) 

Share this post


Link to post

addEventHandler( "onPlayerDamage", root, function( attacker, attackerWeapon ) 
   if ( attacker and getElementType( attacker ) == "player" and attackerWeapon == 33 ) then 
          setElementFrozen ( source, true ) 
          setTimer( function( source ) setElementFrozen ( source, false ) end, 5000, 1, source ) 
       end 
end ) 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.