Jump to content

problem bone_attach in skin CJ


#RooTs

Recommended Posts

Hello. can someone tell me, is it possible to fix this error? 
is it possible to fix the error this in skin 0 / cj?
local Timer = {}
Bribe = {}

function xMain_()
	for index,v in ipairs (getElementsByType("player")) do
		getArmor(v)
	end
end
addEventHandler("onResourceStart", resourceRoot, xMain_);

function getArmor(v)
	if not isElement(v) then return end
	Timer[v] = setTimer(
	function(player)
		if isElement(player) then
		local Armor = getPlayerArmor ( player );
		local x,y,z = getElementPosition ( player );
		local Name = getPlayerName ( player );
			if ( Armor >= 1 ) then
				if Bribe[player] and isElement(Bribe[player]) then return end		
				Bribe[player] = createObject(1242,x,y,z);
				setObjectScale ( Bribe[player], 1.9 )
				local value = getPlayerArmor(player)*100/255*140/100
				setElementAlpha ( Bribe[player], 255 )
				setElementCollisionsEnabled(Bribe[player],false)
				exports.bone_attach:attachElementToBone(Bribe[player],player,3,0,0.05,0,3,-3,0) -- bone attack
				--attachElements (Bribe[player],player,-0.0,0.0,0.3) ;
			elseif ( Armor == 0 and Bribe[player] and isElement(Bribe[player]) ) then
				destroyElement(Bribe[player]);
				Bribe[player] = nil
			end
		end
	end
	,1000,0,v);
end

addEventHandler("onPlayerJoin",root, function ( )
   getArmor(source);
end);

addEventHandler("onPlayerQuit",root, function ( )
	if Timer[source] and isTimer(Timer[source]) then 
		killTimer(Timer[source]); 
		Timer[source] = nil
	end;
	if Bribe[source] and isElement(Bribe[source]) then
		destroyElement(Bribe[source]);
		Bribe[source] = nil
	end
end );

 

Edited by #RooTs
Link to comment

try to use the latest version of this resource (here), it doesnt happens to me 

 yeah, happened now, but only in bone id 3, if we change the bone for any other number (1~20) we will not experience that

Bone IDs:
1: head
2: neck
3: spine
4: pelvis
5: left clavicle
6: right clavicle
7: left shoulder
8: right shoulder
9: left elbow
10: right elbow
11: left hand
12: right hand
13: left hip
14: right hip
15: left knee
16: right knee
17: left ankle
18: right ankle
19: left foot
20: right foot

 

Edited by iDannz [Breno]
Link to comment
1 hour ago, iDannz [Breno] said:

try to use the latest version of this resource (here), it doesnt happens to me 

 yeah, happened now, but only in bone id 3, if we change the bone for any other number (1~20) we will not experience that


Bone IDs:
1: head
2: neck
3: spine
4: pelvis
5: left clavicle
6: right clavicle
7: left shoulder
8: right shoulder
9: left elbow
10: right elbow
11: left hand
12: right hand
13: left hip
14: right hip
15: left knee
16: right knee
17: left ankle
18: right ankle
19: left foot
20: right foot

 

Look the video. on the other characters it works perfectly

Link to comment

When the ID: 0 character model began to be used on DayZ servers, all people had such a problem. It was decided by the fact that you need to replace the bone number to which you need to attach the object you need, if I'm not mistaken, then the valid number will be 7

Link to comment
46 minutes ago, XaskeL said:

When the ID: 0 character model began to be used on DayZ servers, all people had such a problem. It was decided by the fact that you need to replace the bone number to which you need to attach the object you need, if I'm not mistaken, then the valid number will be 7

I will do checks with getElementModel on exports.

any other ideas?

Link to comment

you can use > getPedBonePosition

Example

Bribe = createObject(1242,0, 0, 0);
setElementCollisionsEnabled(Bribe ,false)
setObjectScale (Bribe,1.5)


addEventHandler('onClientRender', root, function()
if ( getPlayerArmor ( localPlayer )>= 1 ) then
local sx, sy, sz = getPedBonePosition(localPlayer,3)
local rx,ry,rz = getElementRotation(localPlayer)
setElementPosition(Bribe ,sx-rx, sy-ry, sz+0.1)
setElementRotation(Bribe,0,0,rz)
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...