Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 3 minutes ago, cocowen said: most function is shared whats the different from using function from client or server , do it same ? or client just work for local player On client side functions return true or false, depeding on it was successful or not. (For example: attach returns true if objects attached successfully, and false if not) But on server side (almost) always returns true, even if it failed. (because it returns the result of triggerClientEvent) Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 12 minutes ago, Patrick said: On client side functions return true or false, depeding on it was successful or not. (For example: attach returns true if objects attached successfully, and false if not) But on server side (almost) always returns true, even if it failed. (because it returns the result of triggerClientEvent) if i set attach from localplayer client , other player will see the attached object ,too? Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 2 minutes ago, cocowen said: if i set attach from localplayer client , other player will see the attached object ,too? If you attach object on client-side? No, others can't see it, only the client. Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 Just now, Patrick said: If you attach object on client-side? No, others can't see it, only the client. ok , i understand ,thanks u local object = createObject(371, 0, 0, 0) setElementDimension(object,1) pAttach:attach(object, element, "backpack", 0, -0.15, 0, 90, 0, 0) WARNING: pAttach\client.lua:265: Bad argument @ 'isElementOnScreen' [Expected element at argument 1] i set object to dim 1 , but it keep output this error Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 1 hour ago, cocowen said: ok , i understand ,thanks u local object = createObject(371, 0, 0, 0) setElementDimension(object,1) pAttach:attach(object, element, "backpack", 0, -0.15, 0, 90, 0, 0) WARNING: pAttach\client.lua:265: Bad argument @ 'isElementOnScreen' [Expected element at argument 1] i set object to dim 1 , but it keep output this error I can't reproduce it, can you send me a proper example resource? ... btw the problem is the ped (element), not the 'object'. Where 'element' defined, and is it on server or client side? Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 2 minutes ago, Patrick said: I can't reproduce it, can you send me a proper example resource? maybe i already find the problem: i destroy the ped ? so let info in table of pattach missed it ? Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 2 minutes ago, cocowen said: maybe i already find the problem: i destroy the ped ? so let info in table of pattach missed it ? You have to detach objects first with detachAll. (I'll fix it in next release) Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 29 minutes ago, Patrick said: You have to detach objects first with detachAll. (I'll fix it in next release) yes , another question i trans from boneattach to pattch ,bind a weapon ak on player's right hand , when player hold the ak , its work nice ,but when its aim , the rotation is wrong , but its works find in boneattach , not sure if there is something need to do in pattach , do pattach fit for weapon? Just now, cocowen said: yes , another question i trans from boneattach to pattch ,bind a weapon ak on player's right hand , when player hold the ak , its work nice ,but when its aim , the rotation is wrong , but its works find in boneattach , not sure if there is something need to do in pattach , do pattach fit for weapon? by the way ,i use right-hand , not weapon bone Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 Just now, cocowen said: yes , another question i trans from boneattach to pattch ,bind a weapon ak on player's right hand , when player hold the ak , its work nice ,but when its aim , the rotation is wrong , but its works find in boneattach , not sure if there is something need to do in pattach , do pattach fit for weapon? pAttach and bone_attach use different parameters (different bone IDs / offsets), you have to reposition them. It isn't enough to just copy/paste them. For weapons mostly you have to use: addCommandHandler("testweapon", function(player) local object = createObject(356, 0, 0, 0) exports.pAttach:attach(object, player, "weapon", 0, 0, 0, 0, 0, 0) end) Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 Just now, Patrick said: pAttach and bone_attach use different parameters (different bone IDs / offsets), you have to reposition them. It isn't enough to just copy/paste them. For weapons mostly you have to use: addCommandHandler("testweapon", function(player) local object = createObject(356, 0, 0, 0) exports.pAttach:attach(object, player, "weapon", 0, 0, 0, 0, 0, 0) end) thanks u weapon bone is work nice , seems there are basic work of this bone 1 Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 1 hour ago, Patrick said: You have to detach objects first with detachAll. (I'll fix it in next release) @cocowen Probably fixed, can you try with latest version? download here Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 1 hour ago, Patrick said: @cocowen Probably fixed, can you try with latest version? download here do not need detachAll anymore? just detach ? Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 Just now, cocowen said: do not need detachAll anymore? just detach ? No need detachAll before ped destroying anymore, it does it automatically for you. But test it please, the warning still appears or not? Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 6 minutes ago, Patrick said: No need detachAll before ped destroying anymore, it does it automatically for you. But test it please, the warning still appears or not? tested ,seems no error now ! thanks u but need to destroy the object by myself? Link to comment
Moderators Patrick Posted April 19, 2021 Author Moderators Share Posted April 19, 2021 1 minute ago, cocowen said: but need to destroy the object by myself? yes Link to comment
cocowen Posted April 19, 2021 Share Posted April 19, 2021 1 minute ago, Patrick said: yes ok ,thats ok now , i will destroy the object , nice work Link to comment
cocowen Posted May 10, 2021 Share Posted May 10, 2021 hey , patrick there is a new question i want to ask , i use pAttach:attach from serverside pAttach:attach(object,targetElement,"weapon", 0, 0, 0, 0, -30, 0) debug the targetElement as ped NH_Attach attachWeapon to:elem:ped[100]00012848 object:elem:object[1939]00012849 but the pAttach get Wrong message as pAttach\client.lua:38: Expected element at argument 2, got userdata00012848 i debug at serverside attach function in exports.lua , find cache[element][1] become userdata cache[element][1]:userdata: 0A9BC968 i am really confused , why it have been changed from ped to userdata Link to comment
Moderators Patrick Posted May 10, 2021 Author Moderators Share Posted May 10, 2021 7 minutes ago, cocowen said: hey , patrick there is a new question i want to ask , i use pAttach:attach from serverside pAttach:attach(object,targetElement,"weapon", 0, 0, 0, 0, -30, 0) debug the targetElement as ped NH_Attach attachWeapon to:elem:ped[100]00012848 object:elem:object[1939]00012849 but the pAttach get Wrong message as pAttach\client.lua:38: Expected element at argument 2, got userdata00012848 i debug at serverside attach function in exports.lua , find cache[element][1] become userdata cache[element][1]:userdata: 0A9BC968 i am really confused , why it have been changed from ped to userdata Is ped (targetElement) created on server-side? Link to comment
cocowen Posted May 10, 2021 Share Posted May 10, 2021 Just now, Patrick said: Is ped (targetElement) created on server-side? yes , i use createPed on server-side to create and manage ped Link to comment
Moderators Patrick Posted May 10, 2021 Author Moderators Share Posted May 10, 2021 Just now, cocowen said: yes , i use createPed on server-side to create and manage ped Show me the code or send me a test resource. Link to comment
cocowen Posted May 10, 2021 Share Posted May 10, 2021 (edited) function creature:create(skin,x,y,z,r) --outputDebugString("TRY CREATE creature "); local o = {} setmetatable(o,self); self.__index = self; self.source = createPed(skin,x,y,z,r); setElementParent(self.source,otherElements) -- bind to parent for data system return o; end here is the create part , and used by this function human:create(skin,x,y,z,r,holdweapon,walkingstyle local o = creature:create(skin,x,y,z,r) self.__index = self; setmetatable(o,self); local humanped = o:getElement() ... Attach:attachWeapon(humanped,modelID ... end function creature:getElement() return self.source; end its really really confused because seems only melee weapon have bug seems differents resource use create ped have error , create ped onResourceStart have bug i use setTimer to make createped more slowly and its works now ,so confused Edited May 10, 2021 by cocowen Link to comment
FernandoMTA Posted May 27, 2021 Share Posted May 27, 2021 Awesome resource! thank you 1 Link to comment
Weaita Posted July 10, 2021 Share Posted July 10, 2021 This script is amazing , I had been wanting to create new things for a while but the limitations and bugs of the bone_attach they made it difficult for me. I just have a question, it's possible to fix this little bug? Objects attached to a skin don't keep the brightness of that skin. I think it's a MTA limitation but I mention it in case it has a solution. Pics about the issue: ( The head is a custom object exported with Normals ) Same here, 12:00 PM, the collision surface affect the skin brightness but not the parachute attached 1 Link to comment
Moderators Patrick Posted July 10, 2021 Author Moderators Share Posted July 10, 2021 4 hours ago, Weaita said: I just have a question, it's possible to fix this little bug? Objects attached to a skin don't keep the brightness of that skin. I think it's a MTA limitation but I mention it in case it has a solution. Maybe it is possible somehow to get ped's brightness and modify parachute's with shaders, but I have no idea how could you do it. Btw do you use the latest pAttach release? Don't you have bugs while attaching objects to player's head? ... I mean wierd movement / rotation offsets Link to comment
Weaita Posted July 10, 2021 Share Posted July 10, 2021 12 hours ago, Patrick said: Btw do you use the latest pAttach release? Don't you have bugs while attaching objects to player's head? ... I mean wierd movement / rotation offsets Latest release, no problem at all. Although I only used the script on my local server 12 hours ago, Patrick said: Maybe it is possible somehow to get ped's brightness and modify parachute's with shaders, but I have no idea how could you do it. It would be great, it's a small problem but in certain situations it causes a lot of annoyance Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now