Jump to content

Hide weapon model


RandomRambo

Recommended Posts

Hello guys.

I just tryed to do more weapons on DayZ mode.
I downloaded some random DayZ mode and found system for weapons on 1 id.

Tryed to move this function in my mode and I did it.

Everything is good,but if I take this gun (which I added on 1 id with another model) I get 2 models in my hand (1 basic and 1 mine) (btw it's secondary melee weapon).

How I can hide basic model of gun If I take weapon which I added on this same ID?Help,please.
There is the function:
 

elementWeaponRaplace = {} 
elementWeaponRaplace2 = {} 
raplaceSettings = { 
	["Hatchet Of God"] = { twohand = false, model = 2326 }, 	
	
}

function weaponReplace ( 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) 
	local curweap
	if currentWeaponID == weapID1 then
		curweap = weapon1
	elseif currentWeaponID == weapID2 then
		curweap = weapon2
	end
	if isElement(elementWeaponRaplace[source]) then 
        detachElementFromBone(elementWeaponRaplace[source]) 
        destroyElement(elementWeaponRaplace[source]) 
        elementWeaponRaplace[source] = false 
    end 
	if isElement(elementWeaponRaplace2[source]) then 
        detachElementFromBone(elementWeaponRaplace2[source]) 
        destroyElement(elementWeaponRaplace2[source]) 
        elementWeaponRaplace2[source] = false 
    end 
    if curweap and raplaceSettings[curweap] then
        elementWeaponRaplace[source] = createObject(raplaceSettings[curweap].model,x,y,z) 
		setElementData(source,"weaponSwithModel",elementWeaponRaplace[source])
		attachElementToBone(elementWeaponRaplace[source],source,12,0,0,0,180,90,180) 
		if raplaceSettings[curweap].twohand then
			elementWeaponRaplace2[source] = createObject(raplaceSettings[curweap].model,x,y,z) 
			attachElementToBone(elementWeaponRaplace2[source],source,11,0,0.05,0,180,100,0) 
		end
    end 
end 
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponReplace )

weaponModels = {
	----
	["Hatchet Of God"] = { coords = {14,0.11,0,0,180,90,270}, coords2 = {14,0.11,0,0,180,90,270}, id = 4, model = 2326},
	----
}

 

Link to comment
12 hours ago, XaskeL said:

Thanks but I need everyone can see changed model (not only me)

12 hours ago, XaskeL said:

I checked ur script,u just hide models with empty dff but if I do this, original model of melee weapon (I have gun on original model) will hide too,am I right?

Link to comment
17 minutes ago, RandomRambo said:

Thanks but I need everyone can see changed model (not only me)

I checked ur script,u just hide models with empty dff but if I do this, original model of melee weapon (I have gun on original model) will hide too,am I right?

You need to remove the required object identifiers from the table.

Link to comment
  • Tut locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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