Jump to content

[HELP] nil element


Pikachu

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 :'(

Link to comment
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 :(

Link to comment
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) 

Link to comment

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 ) 
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...