Jump to content

Sniper Alpha HELP!


Evan

Recommended Posts

hi guys i am making my own mta sa dayz server so i decided to add more weapons on it and yes the weapons wokrs but when i try to aim the sniper it goes bug.

 

but i already try this

local alpha = 255 bindKey ( "aim_weapon", "both", function ( _, state ) if getPedWeaponSlot ( localPlayer ) == 6 then if ( state == "down" ) then alpha = 0 elseif ( state == "up" ) then alpha = 255 end for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do if isElementAttachedToBone ( v ) then local id = getElementModel ( v ) if ( id == 2584 )  setElementAlpha ( v, alpha ) end end end end end )

Link to comment

I have been through the same problem, what you can do is after you replaced skins for everything at the very bottom add this

engineImportTXD(engineLoadTXD("sniper.txd"), 358);

Here is the file you need https://mega.nz/#!ApQCnajL!slnMQfp9uvWMT2NGT2S3LsjtAwpZ8eA-aznaLWs0iB4

Make sure it's being replaced after you applied the skins.

You can replace the sniper crosshair inside the sniper.txd as you please.

Also what you said you tried has nothing to do with the crosshair it's a thing (already existent in DayZ), to hide the backpack when crouch.

Link to comment

That's the problem with the model rather than the sniper.

Before you do anything make sure you apply this skin for every weapon then apply the skins you want.

So what I did was something like this (This will hide the default skin of the weapon):

for i = 355, 358 do
    local tex = engineLoadTXD("alpha.txd");
	engineImportTXD(tex, i);
	local mod = engineLoadDFF("alpha.dff", i);
	engineReplaceModel(mod, i);
end

After this you can do this, so you still have a scope.

engineImportTXD(engineLoadTXD("sniper.txd"), 358);

Here are all the files you need: https://mega.nz/#!QoQDkTZL!ib2Db_zAZOCRoot-eW6vBtGN879-E2p7qu2NSgglQg8

 

Hope I helped you.

Link to comment
addEventHandler("onClientResourceStart", resourceRoot, function()
    for i = 355, 358 do
        local tex = engineLoadTXD("alpha.txd");
        engineImportTXD(tex, i);
        local mod = engineLoadDFF("alpha.dff", i);
        engineReplaceModel(mod, i);
    end
    engineImportTXD(engineLoadTXD("sniper.txd"), 358);
    --And here apply your skins!
end);

Like this, also take a picture after you apply my script to see what's wrong, also we need to see how you replace the weapons in order to see why the weapon is still showing.

Edited by Tekken
-
Link to comment

its still bug bro

https://imgur.com/a/MVbzH

 

here is the code

 

addEventHandler("onClientResourceStart", resourceRoot, function()
    for i = 355, 358 do
        local tex = engineLoadTXD("armas/alpha.txd");
        engineImportTXD(tex, i);
        local mod = engineLoadDFF("armas/alpha.dff", i);
        engineReplaceModel(mod, i);
    end
    engineImportTXD(engineLoadTXD("armas/sniper.txd"), 358);
    txd = engineLoadTXD("armas/ak107.txd", 2725 )
        engineImportTXD(txd, 2725)
        dff = engineLoadDFF("armas/ak107.dff", 2725 )
        engineReplaceModel(dff, 2725)
        
        txd = engineLoadTXD("armas/m4.txd", 2468 )
        engineImportTXD(txd, 2468)
        dff = engineLoadDFF("armas/m4.dff", 2468 )
        engineReplaceModel(dff, 2468)
        
        txd = engineLoadTXD("armas/aks.txd", 3000 )
        engineImportTXD(txd, 3000)
        dff = engineLoadDFF("armas/aks.dff", 3000 )
        engineReplaceModel(dff, 3000)
        
        txd = engineLoadTXD("armas/mk48.txd", 2571 )
        engineImportTXD(txd, 2571)
        dff = engineLoadDFF("armas/mk48.dff", 2571 )
        engineReplaceModel(dff, 2571)
        
        txd = engineLoadTXD("armas/as50.txd", 2731 )
        engineImportTXD(txd, 2731)
        dff = engineLoadDFF("armas/as50.dff", 2731 )
        engineReplaceModel(dff, 2731)
        
        txd = engineLoadTXD("armas/acr.txd", 2747 )
        engineImportTXD(txd, 2747)
        dff = engineLoadDFF("armas/acr.dff", 2747 )
        engineReplaceModel(dff, 2747)
        
        txd = engineLoadTXD("armas/g36sd.txd", 2751 )
        engineImportTXD(txd, 2751)
        dff = engineLoadDFF("armas/g36sd.dff", 2751 )
        engineReplaceModel(dff, 2751)
        
        txd = engineLoadTXD("armas/m4a1holo.txd", 2742 )
        engineImportTXD(txd, 2742)
        dff = engineLoadDFF("armas/m4a1holo.dff", 2742 )
        engineReplaceModel(dff, 2742)
        
        txd = engineLoadTXD("armas/sa58acog.txd", 2745 )
        engineImportTXD(txd, 2745)
        dff = engineLoadDFF("armas/sa58acog.dff", 2745 )
        engineReplaceModel(dff, 2745)
        
        txd = engineLoadTXD("armas/svdcamo.txd", 2730 )
        engineImportTXD(txd, 2730)
        dff = engineLoadDFF("armas/svdcamo.dff", 2730 )
        engineReplaceModel(dff, 2730)
        
        txd = engineLoadTXD("armas/cz550.txd", 2732 )
        engineImportTXD(txd, 2732)
        dff = engineLoadDFF("armas/cz550.dff", 2732 )
        engineReplaceModel(dff, 2732)
        
        txd = engineLoadTXD("armas/dmr.txd", 2733 )
        engineImportTXD(txd, 2733)
        dff = engineLoadDFF("armas/dmr.dff", 2733 )
        engineReplaceModel(dff, 2733)
        
        txd = engineLoadTXD("armas/kvsk.txd", 2734 )
        engineImportTXD(txd, 2734)
        dff = engineLoadDFF("armas/kvsk.dff", 2734 )
        engineReplaceModel(dff, 2734)
        
        txd = engineLoadTXD("armas/m24.txd", 2735 )
        engineImportTXD(txd, 2735)
        dff = engineLoadDFF("armas/m24.dff", 2735 )
        engineReplaceModel(dff, 2735)
        
        txd = engineLoadTXD("armas/m249saw.txd", 2748 )
        engineImportTXD(txd, 2748)
        dff = engineLoadDFF("armas/m249saw.dff", 2748 )
        engineReplaceModel(dff, 2748)
        
        txd = engineLoadTXD("armas/m107.txd", 2737 )
        engineImportTXD(txd, 2737)
        dff = engineLoadDFF("armas/m107.dff", 2737 )
        engineReplaceModel(dff, 2737)
        
        txd = engineLoadTXD("armas/m40a3.txd", 2738 )
        engineImportTXD(txd, 2738)
        dff = engineLoadDFF("armas/m40a3.dff", 2738 )
        engineReplaceModel(dff, 2738)
        
        txd = engineLoadTXD("armas/m14.txd", 2726 )
        engineImportTXD(txd, 2726)
        dff = engineLoadDFF("armas/m14.dff", 2726 )
        engineReplaceModel(dff, 2726)
        
        txd = engineLoadTXD("armas/jng90.txd", 2729 )
        engineImportTXD(txd, 2729)
        dff = engineLoadDFF("armas/jng90.dff", 2729 )
        engineReplaceModel(dff, 2729)
        
        txd = engineLoadTXD("armas/m240.txd", 2728 )
        engineImportTXD(txd, 2728)
        dff = engineLoadDFF("armas/m240.dff", 2728 )
        engineReplaceModel(dff, 2728)
        
        txd = engineLoadTXD("armas/akmgp.txd", 2724 )
        engineImportTXD(txd, 2724)
        dff = engineLoadDFF("armas/akmgp.dff", 2724 )
        engineReplaceModel(dff, 2724)
        
        txd = engineLoadTXD("armas/g36k.txd", 2708 )
        engineImportTXD(txd, 2708)
        dff = engineLoadDFF("armas/g36k.dff", 2708 )
        engineReplaceModel(dff, 2708)
        
        txd = engineLoadTXD("armas/beneli.txd", 349  )
        engineImportTXD(txd, 349 )
        dff = engineLoadDFF("armas/beneli.dff", 349  )
        engineReplaceModel(dff, 349 )
        
        txd = engineLoadTXD("armas/fnscar.txd", 2644 )
        engineImportTXD(txd, 2644)
        dff = engineLoadDFF("armas/fnscar.dff", 2644 )
        engineReplaceModel(dff, 2644)
        
        txd = engineLoadTXD("armas/leeenfield.txd", 2562 )
        engineImportTXD(txd, 2562)
        dff = engineLoadDFF("armas/leeenfield.dff", 2562 )
        engineReplaceModel(dff, 2562)
        
        txd = engineLoadTXD("armas/bow.txd", 2565 )
        engineImportTXD(txd, 2565)
        dff = engineLoadDFF("armas/bow.dff", 2565 )
        engineReplaceModel(dff, 2565)
        
        txd = engineLoadTXD("armas/m1911.txd", 2767 )
        engineImportTXD(txd, 2767)
        dff = engineLoadDFF("armas/m1911.dff", 2767 )
        engineReplaceModel(dff, 2767)
        
        txd = engineLoadTXD("armas/g17.txd", 2749 )
        engineImportTXD(txd, 2749)
        dff = engineLoadDFF("armas/g17.dff", 2749 )
        engineReplaceModel(dff, 2749)
        
        txd = engineLoadTXD("armas/mp5.txd", 2750 )
        engineImportTXD(txd, 2750)
        dff = engineLoadDFF("armas/mp5.dff", 2750 )
        engineReplaceModel(dff, 2750)
        
        --txd = engineLoadTXD("armas/1014.txd", 1700 )
        --engineImportTXD(txd, 1700)
        --dff = engineLoadDFF("armas/1014.dff", 1700 )
        --engineReplaceModel(dff, 1700)
        
        --txd = engineLoadTXD("armas/lee.txd", 1661 )
        --engineImportTXD(txd, 1661)
        --dff = engineLoadDFF("armas/lee.dff", 1661 )
        --engineReplaceModel(dff, 1661)
        
        --txd = engineLoadTXD("armas/dmr.txd", 1725 )
        --engineImportTXD(txd, 1725)
        --dff = engineLoadDFF("armas/dmr.dff", 1725 )
        --engineReplaceModel(dff, 1725)
        
        --txd = engineLoadTXD("armas/m14.txd", 1719 )
        --engineImportTXD(txd, 1719)
        --dff = engineLoadDFF("armas/m14.dff", 1719 )
        --engineReplaceModel(dff, 1719)
        
        --txd = engineLoadTXD("armas/sa58cco.txd", 1738 )
        --engineImportTXD(txd, 1738)
        --dff = engineLoadDFF("armas/sa58cco.dff", 1738 )
        --engineReplaceModel(dff, 1738)
        
        --txd = engineLoadTXD("armas/sa58p.txd", 1745 )
        --engineImportTXD(txd, 1745)
        --dff = engineLoadDFF("armas/sa58p.dff", 1745 )
        --engineReplaceModel(dff, 1745)
        
        --txd = engineLoadTXD("armas/sa58vacog.txd", 1747 )
        --engineImportTXD(txd, 1747)
        --dff = engineLoadDFF("armas/sa58vacog.dff", 1747 )
        --engineReplaceModel(dff, 1747)
        
        --txd = engineLoadTXD("armas/sa58v.txd", 1748 )
        --engineImportTXD(txd, 1748)
        --dff = engineLoadDFF("armas/sa58v.dff", 1748 )
        --engineReplaceModel(dff, 1748)
        
        --txd = engineLoadTXD("armas/mosin.txd", 1749 )
        --engineImportTXD(txd, 1749)
        --dff = engineLoadDFF("armas/mosin.dff", 1749 )
        --engineReplaceModel(dff, 1749)
        
        txd = engineLoadTXD("backpack/bag.txd", 1248 )
        engineImportTXD(txd, 1248)
        dff = engineLoadDFF("backpack/bag.dff", 1248 )
        engineReplaceModel(dff, 1248)
        
        txd = engineLoadTXD("backpack/drybagblack.txd", 1575 )
        engineImportTXD(txd, 1575)
        dff = engineLoadDFF("backpack/drybagblack.dff", 1575 )
        engineReplaceModel(dff, 1575)
        
        txd = engineLoadTXD("backpack/drybagblue.txd", 1830 )
        engineImportTXD(txd, 1830)
        dff = engineLoadDFF("backpack/drybagblue.dff", 1830 )
        engineReplaceModel(dff, 1830)
        
        txd = engineLoadTXD("backpack/drybaggreen.txd", 1831 )
        engineImportTXD(txd, 1831)
        dff = engineLoadDFF("backpack/drybaggreen.dff", 1831 )
        engineReplaceModel(dff, 1831)
        
        txd = engineLoadTXD("backpack/drybagred.txd", 1832 )
        engineImportTXD(txd, 1832)
        dff = engineLoadDFF("backpack/drybagred.dff", 1832 )
        engineReplaceModel(dff, 1832)
        
        txd = engineLoadTXD("backpack/drybagwhite.txd", 1252 )
        engineImportTXD(txd, 1252)
        dff = engineLoadDFF("backpack/drybagwhite.dff", 1252 )
        engineReplaceModel(dff, 1252)
        
        txd = engineLoadTXD("backpack/drybagyellow.txd", 2000 )
        engineImportTXD(txd, 2000)
        dff = engineLoadDFF("backpack/drybagyellow.dff", 2000 )
        engineReplaceModel(dff, 2000)
        
        txd = engineLoadTXD("backpack/coyote.txd", 2405 )
        engineImportTXD(txd, 2405)
        dff = engineLoadDFF("backpack/coyote.dff", 2405 )
        engineReplaceModel(dff, 2405)
        
        txd = engineLoadTXD("backpack/coyotedesert.txd", 2410 )
        engineImportTXD(txd, 2410)
        dff = engineLoadDFF("backpack/coyotedesert.dff", 2410 )
        engineReplaceModel(dff, 2410)
        
        txd = engineLoadTXD("backpack/coyotecamo.txd", 2406 )
        engineImportTXD(txd, 2406)
        dff = engineLoadDFF("backpack/coyotecamo.dff", 2406 )
        engineReplaceModel(dff, 2406)
        
        txd = engineLoadTXD("backpack/mountaingreen.txd", 1833 )
        engineImportTXD(txd, 1833)
        dff = engineLoadDFF("backpack/mountaingreen.dff", 1833 )
        engineReplaceModel(dff, 1833)
        
        txd = engineLoadTXD("backpack/mountainblue.txd", 1834 )
        engineImportTXD(txd, 1834)
        dff = engineLoadDFF("backpack/mountainblue.dff", 1834 )
        engineReplaceModel(dff, 1834)
        
        txd = engineLoadTXD("backpack/mountainred.txd", 1835 )
        engineImportTXD(txd, 1835)
        dff = engineLoadDFF("backpack/mountainred.dff", 1835 )
        engineReplaceModel(dff, 1835)
        
        txd = engineLoadTXD("backpack/nationz.txd", 1836 )
        engineImportTXD(txd, 1836)
        dff = engineLoadDFF("backpack/nationz.dff", 1836 )
        engineReplaceModel(dff, 1836)
        
end);      

Link to comment

here is it 

 

elementWeaponRaplace = {} 
function weaponReplace ( previousWeaponID, currentWeaponID ) 
local weapon1 = getElementData(source,"currentweapon_1") 
if not weapon1 then return end 
local ammoData1,weapID1 = getWeaponAmmoType(weapon1) 
local x,y,z = getElementPosition(source) 
local rx,ry,rz = getElementRotation(source) 
          if currentWeaponID == weapID1 then 
           if elementWeaponRaplace[source] then 
            detachElementFromBone(elementWeaponRaplace[source]) 
            destroyElement(elementWeaponRaplace[source]) 
            elementWeaponRaplace[source] = false 
           end 
           if weapon1 == "M14" then 
           elementWeaponRaplace[source] = createObject(2726,x,y,z) 
           elseif weapon1 == "SVD Camo" then 
           elementWeaponRaplace[source] = createObject(2730,x,y,z) 
           elseif weapon1 == "AS50" then 
           elementWeaponRaplace[source] = createObject(2731,x,y,z)
           elseif weapon1 == "CZ 550" then 
           elementWeaponRaplace[source] = createObject(2732,x,y,z)
           elseif weapon1 == "DMR" then 
           elementWeaponRaplace[source] = createObject(2733,x,y,z)
           elseif weapon1 == "KVSK" then 
           elementWeaponRaplace[source] = createObject(2734,x,y,z)
           elseif weapon1 == "M24" then 
           elementWeaponRaplace[source] = createObject(2735,x,y,z)
           elseif weapon1 == "M249 SAW" then 
           elementWeaponRaplace[source] = createObject(2748,x,y,z)
           elseif weapon1 == "M107" then 
           elementWeaponRaplace[source] = createObject(2737,x,y,z)
           elseif weapon1 == "M4A03" then 
           elementWeaponRaplace[source] = createObject(2738,x,y,z)
           elseif weapon1 == "JNG-90" then 
           elementWeaponRaplace[source] = createObject(2729,x,y,z) 
           elseif weapon1 == "M240" then 
           elementWeaponRaplace[source] = createObject(2728,x,y,z)  
           elseif weapon1 == "AK-107" then 
           elementWeaponRaplace[source] = createObject(2725,x,y,z) 
           elseif weapon1 == "AKS" then 
           elementWeaponRaplace[source] = createObject(3000,x,y,z) 
           elseif weapon1 == "G36K" then 
           elementWeaponRaplace[source] = createObject(2708,x,y,z) 
           elseif weapon1 == "M4" then 
           elementWeaponRaplace[source] = createObject(2468,x,y,z) 
           elseif weapon1 == "Lee Enfield" then 
           elementWeaponRaplace[source] = createObject(2562,x,y,z) 
           elseif weapon1 == "FN SCAR" then 
           elementWeaponRaplace[source] = createObject(2644,x,y,z) 
           elseif weapon1 == "MK48" then 
           elementWeaponRaplace[source] = createObject(2571,x,y,z) 
           elseif weapon1 == "Crossbow" then 
           elementWeaponRaplace[source] = createObject(2565,x,y,z) 
           elseif weapon1 == "ACR" then 
           elementWeaponRaplace[source] = createObject(2747,x,y,z)
           elseif weapon1 == "G36C SD" then 
           elementWeaponRaplace[source] = createObject(2751,x,y,z)
           elseif weapon1 == "G17" then 
           elementWeaponRaplace[source] = createObject(2749,x,y,z)    
           elseif weapon1 == "M4A1 Holo" then 
           elementWeaponRaplace[source] = createObject(2742,x,y,z) 
           elseif weapon1 == "SA-58V ACOG" then 
           elementWeaponRaplace[source] = createObject(2745,x,y,z) 
           elseif weapon1 == "M9 SD" then 
           elementWeaponRaplace[source] = createObject(2766,x,y,z) 
           elseif weapon1 == "M1911" then 
           elementWeaponRaplace[source] = createObject(2767,x,y,z) 
           end 
           if elementBackpack[source] then 
            attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,179,90,180) 
           else 
            attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,179,90,180) 
           end 
          elseif previousWeaponID == weapID1 then 
           detachElementFromBone(elementWeaponRaplace[source]) 
           destroyElement(elementWeaponRaplace[source]) 
           elementWeaponRaplace[source] = false 
          end 
end 
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace )
elementWeaponBack = {}
elementWeaponBackM = {}
function weaponSwitchBack ( previousWeaponID, currentWeaponID ) 
local weapon1 = getElementData(source,"currentweapon_1")
local weapon2 = getElementData(source,"currentweapon_2") 
if not weapon1 and not weapon2 then return end
local ammoData1,weapID1 = getWeaponAmmoType(weapon1)
local ammoData2,weapID2 = getWeaponAmmoType(weapon2) 
local x,y,z = getElementPosition(source)
local rx,ry,rz = getElementRotation(source) 
            if currentWeaponID == weapID2 then
                setElementData ( source, "selectedWeapon",weapon2)
            elseif currentWeaponID == weapID1 then
                setElementData ( source, "selectedWeapon",weapon1)
            elseif currentWeaponID == weapID3 then
                setElementData ( source, "selectedWeapon",weapon3)
            end
            if getElementData ( source, "usingGrenadeThrower" ) then
                toggleControl ( source, 'fire', true )
                setElementData ( source, "usingGrenadeThrower", false )
            end
            
    if previousWeaponID == weapID1 then
        ----------- Destruir Arma Quando Morrer ou Deslogar Sen�o Ela Fica no Ar -------------
        if elementWeaponBack[source] then
            detachElementFromBone(elementWeaponBack[source])
            destroyElement(elementWeaponBack[source])
            elementWeaponBack[source] = false
        end
          if weapon1 == "M14" then 
           elementWeaponBack[source] = createObject(2726,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "SVD Camo" then 
           elementWeaponBack[source] = createObject(2730,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "AS50" then 
           elementWeaponBack[source] = createObject(2731,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "CZ 550" then 
           elementWeaponBack[source] = createObject(2732,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "DMR" then 
           elementWeaponBack[source] = createObject(2733,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "KVSK" then 
           elementWeaponBack[source] = createObject(2734,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "M24" then 
           elementWeaponBack[source] = createObject(2735,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "M249 SAW" then 
           elementWeaponBack[source] = createObject(2748,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "M107" then 
           elementWeaponBack[source] = createObject(2737,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "M4A03" then 
           elementWeaponBack[source] = createObject(2738,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "JNG-90" then 
           elementWeaponBack[source] = createObject(2729,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "M240" then 
           elementWeaponBack[source] = createObject(2728,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875)
           elseif weapon1 == "AK-107" then 
           elementWeaponBack[source] = createObject(2725,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "AKS" then 
           elementWeaponBack[source] = createObject(3000,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "MK48" then 
           elementWeaponBack[source] = createObject(2571,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "M4" then 
           elementWeaponBack[source] = createObject(2468,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "Lee Enfield" then 
           elementWeaponBack[source] = createObject(2562,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "G36K" then 
           elementWeaponBack[source] = createObject(2708,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "FN SCAR" then 
           elementWeaponBack[source] = createObject(2644,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "Crossbow" then 
           elementWeaponBack[source] = createObject(2565,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "ACR" then 
           elementWeaponBack[source] = createObject(2747,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "G36C SD" then 
           elementWeaponBack[source] = createObject(2751,x,y,z)
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "G17" then 
           elementWeaponBack[source] = createObject(2749,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875)        
           elseif weapon1 == "M4A1 Holo" then 
           elementWeaponBack[source] = createObject(2742,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "SA-58V ACOG" then 
           elementWeaponBack[source] = createObject(2745,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "M9 SD" then 
           elementWeaponBack[source] = createObject(2766,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           elseif weapon1 == "M1911" then 
           elementWeaponBack[source] = createObject(2767,x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           else 
           elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1),x,y,z) 
           setObjectScale(elementWeaponBack[source],0.875) 
           end 
           if elementBackpack[source] then 
            attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.31,-0.1,0,270,-90)
           else 
            attachElementToBone(elementWeaponBack[source],source,3,0.19,-0.11,-0.1,0,270,10) 
           end 
          elseif currentWeaponID == weapID1 then 
           detachElementFromBone(elementWeaponBack[source]) 
           destroyElement(elementWeaponBack[source]) 
           elementWeaponBack[source] = false  
          end 
end
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchBack )

Link to comment

Ok the script I gave you should work it's exactly how I made mine.

And I know what is the problem.

This time do it like this:

addEventHandler("onClientResourceStart", resourceRoot, function()
    --!!!! APPLY YOUR SKINS HERE FIRST !!!!!
    --!!!! APPLY YOUR SKINS HERE FIRST !!!!!
    --!!!! APPLY YOUR SKINS HERE FIRST !!!!!
    for i = 355, 358 do
        local tex = engineLoadTXD("alpha.txd");
        engineImportTXD(tex, i);
        local mod = engineLoadDFF("alpha.dff", i);
        engineReplaceModel(mod, i);
    end
    engineImportTXD(engineLoadTXD("sniper.txd"), 358);
end);

 

Link to comment

is that no bugs anymore ? what "apply your skins here" you mean ? 

this one ? 

--->?       for i = 355, 358 do
        local tex = engineLoadTXD("armas/alpha.txd");
        engineImportTXD(tex, i);
        local mod = engineLoadDFF("armas/alpha.dff", i);
        engineReplaceModel(mod, i);
    end
    engineImportTXD(engineLoadTXD("armas/sniper.txd"), 358);
    txd = engineLoadTXD("armas/ak107.txd", 2725 )
        engineImportTXD(txd, 2725)
        dff = engineLoadDFF("armas/ak107.dff", 2725 )
        engineReplaceModel(dff, 2725)

 

 

or should i do like this ?

 

 

  1. addEventHandler("onClientResourceStart", resourceRoot, function()
  2. for i = 355, 358 do
            local tex = engineLoadTXD("armas/alpha.txd");
            engineImportTXD(tex, i);
            local mod = engineLoadDFF("armas/alpha.dff", i);
            engineReplaceModel(mod, i);
        end
        engineImportTXD(engineLoadTXD("armas/sniper.txd"), 358);
        txd = engineLoadTXD("armas/ak107.txd", 2725 )
            engineImportTXD(txd, 2725)
            dff = engineLoadDFF("armas/ak107.dff", 2725 )
            engineReplaceModel(dff, 2725)
  3. for i = 355, 358 do
  4. local tex = engineLoadTXD("alpha.txd");
  5. engineImportTXD(tex, i);
  6. local mod = engineLoadDFF("alpha.dff", i);
  7. engineReplaceModel(mod, i);
  8. end
  9. engineImportTXD(engineLoadTXD("sniper.txd"), 358);
  10. end);

 

 

or should i put the DFF and TXD in diffrent folders ?

Link to comment

so like this ? 

 

  1. addEventHandler("onClientResourceStart", resourceRoot, function()

        txd = engineLoadTXD("armas/beneli.txd", 349  )
        engineImportTXD(txd, 349 )
        dff = engineLoadDFF("armas/beneli.dff", 349  )
        engineReplaceModel(dff, 349 )
        
        txd = engineLoadTXD("armas/fnscar.txd", 2644 )
        engineImportTXD(txd, 2644)
        dff = engineLoadDFF("armas/fnscar.dff", 2644 )
        engineReplaceModel(dff, 2644)
        
        txd = engineLoadTXD("armas/leeenfield.txd", 2562 )
        engineImportTXD(txd, 2562)
        dff = engineLoadDFF("armas/leeenfield.dff", 2562 )
        engineReplaceModel(dff, 2562)

  1. for i = 355, 358 do
  2. local tex = engineLoadTXD("alpha.txd");
  3. engineImportTXD(tex, i);
  4. local mod = engineLoadDFF("alpha.dff", i);
  5. engineReplaceModel(mod, i);
  6. end
  7. engineImportTXD(engineLoadTXD("sniper.txd"), 358);
  8. end);

i try that i add all but still! the weapon appear sometimes :( bro i want my sniper has different crosshairs on them like i add VIP weapon and i want to have its own sniper crosshair

Link to comment

Try this

bindKey ( "aim_weapon", "down", function ( ) -- set the alpha of the gun to 0 when the localPlayer is aiming.
	if getPedWeapon(localPlayer) ~= 34 then return end -- check if he has a sniper.
	local wep = getElementData(localPlayer,"currentweapon_1")
	setElementAlpha( wep, 0 )
	iprint("1")
end )

bindKey ( "aim_weapon", "up", function ( )
	if getPedWeapon(localPlayer) ~= 34 then return end
	local wep = getElementData(localPlayer,"currentweapon_1")
	setElementAlpha( wep, 255 )
	iprint("2")
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...