Jump to content

boneAttach


Axel

Recommended Posts

Posted (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 by Guest
Posted
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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Any error(s) on debug script? is bone_attach resource running?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 

Posted

The script with the command is server side, right? because addCommandHandler doesn't has 'thePlayer' argument on client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Works perfect here, the burger get's attached to my hand.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Oh, you should set the object interior ;).

P.S: You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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?

Posted

Set a timer to destroy the burger?

P.S: I would suggest to make a table with the burger objects.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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) 
  

:D

Edit: Were can i see a list with all the objects?

Posted

What about map editor? it has objects list.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...