Jump to content

[Duda] destruir objeto pegado al jugador


KaMi

Recommended Posts

¡ Hola ! hace poco hice un arma que dispara explosivos. Pensé en agregarle un objeto en forma de decoración usando el resource bone attach. Todo fue bien hasta que me di cuenta que, cuando el jugador moría, el objeto se quedaba pegado y no se destruía. Acá tienen el código 

function activArmas( player )

if (getElementData (player, "Armactivada") == false) then

setElementData (player, "Armactivada", true) 
outputChatBox( "Activaste el arma", player, 100, 0, 0 )

else

setElementData (player, "Armactivada", false) 
outputChatBox( "Desactivaste el arma", player, 100, 0, 0 )

    end
end
addCommandHandler("activar", activArmas)


local frascote = {}

function setObjectInWeapon( previousWeaponID, currentWeaponID )


if (getElementData (source, "Armactivada") == true) then
if ( currentWeaponID == 31 ) then





exports.bone_attach:attachElementToBone(frascote[source],source,12,-0.09,0,-0.03,0,2,40)










elseif ( previousWeaponID == 31 ) then


exports.bone_attach:detachElementFromBone( frascote[source] )
destroyElement( frascote[source] )

 




         end
    end
end
addEventHandler("onPlayerWeaponSwitch", root, setObjectInWeapon)








function wast()
if (getElementData (source, "Armactivada") == true) then



destroyElement( frascote[source] ) --Acá es donde tengo mi duda.




     end
end
addEventHandler("onPlayerWasted", root, wast)

Muchas gracias :D

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