Axel Posted March 12, 2012 Share Posted March 12, 2012 (edited) I'm trying to make a short function to attach a object to my player with the bone_attach script.. function burger() burger1 = createObject(2880,0,0,0) exports.bone_attach:attachElementToBone(burger1,source,12,0,0,0,0,-90,0) end addCommandHandler("bu",burger) Am i an idiot or something were changed from the new version.. Edited March 12, 2012 by Guest Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 function burger (thePlayer) --x,y,z=getElementPosition(thePlayer) burger1 = createObject ( 2880, 0, 0, 0 ) exports.bone_attach:attachElementToBone ( burger1, thePlayer, 12, 0, 0, 0, 0, -90, 0 ) end addCommandHandler ( "bu", burger ) Your error(s): 1: You forgot about 'thePlayer' in the function . 2: You forgot to rename 'source' to 'thePlayer. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Still.. i tryed that way before.. i was trying the getElementPosition.. Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 Any error(s) on debug script? is bone_attach resource running? Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Yes the ressource is running, it works with ped = createPed(105,0,0,3) burger = createObject(2880,0,0,0) exports.bone_attach:attachElementToBone(burger,ped,12,0,0,0,0,-90,0) Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 The script with the command is server side, right? because addCommandHandler doesn't has 'thePlayer' argument on client side. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 I tryed it serverside and even clientside, nothing.. Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 Works perfect here, the burger get's attached to my hand. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Ye i noticed now.. stupid me.. i was in an interior.. realy stupid Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 Oh, you should set the object interior . P.S: You're welcome. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Thanks, now i want to introduce it in the item-system, i did it fine but the burger doesn't dissapear after usage.. elseif (itemID==8) then -- sandwich giveHealth(source, 50) exports.global:applyAnimation(source, "food", "eat_burger", 4000, false, true, true) toggleAllControls(source, true, true, true) exports.global:sendLocalMeAction(source, " mananca un sandwich.") takeItemFromSlot(source, itemSlot) burger1 = createObject ( 2880, 0, 0, 0 ) exports.bone_attach:attachElementToBone ( burger1, source, 12, 0, 0, 0, 0, -90, 0 ) Got a idea or something how to make it dissapear after the animation is finished? Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 Set a timer to destroy the burger? P.S: I would suggest to make a table with the burger objects. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Hmm.. but i want to make more objects.. Link to comment
Axel Posted March 12, 2012 Author Share Posted March 12, 2012 Nvm i succeded: elseif (itemID==8) then -- sandwich giveHealth(source, 50) exports.global:applyAnimation(source, "food", "eat_burger", 4000, false, true, true) toggleAllControls(source, true, true, true) exports.global:sendLocalMeAction(source, " mananca un sandwich.") takeItemFromSlot(source, itemSlot) local burger1 = createObject ( 2880, 0, 0, 0 ) exports.bone_attach:attachElementToBone ( burger1, source, 12, 0, 0, 0, 0, -90, 0 ) function destroy() destroyElement(burger1) end setTimer(destroy,2000,1) Edit: Were can i see a list with all the objects? Link to comment
Castillo Posted March 12, 2012 Share Posted March 12, 2012 What about map editor? it has objects list. 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