Jump to content

[Duda con]setTimer


depato123

Recommended Posts

Posted

Hola. tengo un problema con este script

             
setTimer ( function() 
      setPedAnimation ( source, "BAR", "dnk_stndM_loop", -1, true, false, false ) 
end, 1000, 1 ) 

Me sale un error

resource/server/shops.lua:189: Bad argument @ `setPedAnimation´

Posted
source no está definido.

Perdon por no postear la funcion entera, si que esta definido

    if( shops[shopID].Articles[articleID].Health ) then 
        local h = getElementHealth( source ) 
        if( h == 100 ) then -- lololol 
            setPedChoking ( source, true ) 
            setTimer( setPedChoking, 4000, 1, source, false ) 
            triggerClientEvent( source, "destroyShopMenu", source ) 
        else 
            h = h + shops[shopID].Articles[articleID].Health 
            if( h > 100 ) then h = 100 end 
             
            setElementHealth( source, h )            
            setTimer ( function() 
                setPedAnimation ( source, "BAR", "dnk_stndM_loop", -1, true, false, false ) 
            end, 1000, 1 ) 
        end 
    elseif( shops[shopID].Articles[articleID].WeaponID ) then 
        if( shops[shopID].Articles[articleID].Ammo and tonumber( shops[shopID].Articles[articleID].Ammo ) > 1 ) then 
            giveWeapon( source, shops[shopID].Articles[articleID].WeaponID, shops[shopID].Articles[articleID].Ammo, false ) 
        else 
            giveWeapon( source, shops[shopID].Articles[articleID].WeaponID, 1, false ) 
        end 
    elseif( shops[shopID].Articles[articleID].Fuel ) then 
        local newFuel = shops[shopID].Articles[articleID].Fuel 
        if( getElementData( source, "jetpackFuel" ) ) then 
            newFuel = newFuel + tonumber( getElementData( source, "jetpackFuel" ) ) 
        end 
        if( newFuel > tonumber( get("MaxJetpackFuel") ) ) then 
            newFuel = tonumber( get( "MaxJetpackFuel" ) ) 
        end 
        setElementData( source, "jetpackFuel", newFuel ) 
    end 
end 

Posted

lineas 12 y 13

setTimer ( function()

setPedAnimation ( source, "BAR", "dnk_stndM_loop", -1, true, false, false )

end, 1000, 1 )

por

setTimer ( function(source)

setPedAnimation ( source, "BAR", "dnk_stndM_loop", -1, true, false, false )

end, 1000, 1, source )

  • Recently Browsing   0 members

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