joedajoester Posted November 2, 2011 Share Posted November 2, 2011 Hi, i need a script that when a object gets damages it will disappear when it gets damaged like with a gun, how would i make a object dissappear or fall when it gets damage? I attempted using parts of kwksnd 's titan script when you shoot all 3 of the cores. I just need a script that enables objects that are created with scripts and disappear when damaged. this is the part of the script i found on wiki. https://wiki.multitheftauto.com/wiki/SetElementData Thanks Link to comment
Castillo Posted November 2, 2011 Share Posted November 2, 2011 function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement and getElementType(hitElement) == "object") then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) This should destroy the object you've just shoot at. Link to comment
joedajoester Posted November 2, 2011 Author Share Posted November 2, 2011 Hi, i used the script like this (below) and nothing happens, the object is created but i shoot at it and nothing happens. object = createObject (2976, 2, 2, 2) function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement and getElementType(hitElement) == "object") then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) Please help with this someone Link to comment
Castillo Posted November 2, 2011 Share Posted November 2, 2011 object = createObject (2976, 2, 2, 2) function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement and getElementType(hitElement) == "object" and hitElement == object) then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) Link to comment
qaisjp Posted November 3, 2011 Share Posted November 3, 2011 object = createObject (2976, 2, 2, 2) function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement == object) then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) Link to comment
joedajoester Posted November 4, 2011 Author Share Posted November 4, 2011 Still dont work it creates the object and nothing happens i keep shooting it and nothing. Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 o1 = createObject (2976, 2, 2, 2) function objectHit(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement == o1) then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, objectHit) 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