Moderators IIYAMA Posted November 4, 2011 Moderators Share Posted November 4, 2011 (edited) I need a script that blow up the mine when you hit him and not just remove it. Also he must take the owner of the mine as creator of the explosion. Anybody can help me? >Normal activation of mines when you walk over them. :Server addEvent ("poopoutthemine", true ) function laymine(player) local posx, posy, posz = getElementPosition ( player ) local landmine = createObject ( 1510, posx, posy, posz - .999, 0, 0, 3.18 ) local landminecol = createColSphere ( posx, posy, posz, 3 ) setElementData ( landminecol, "type", "alandmine" ) setElementData ( landminecol, "owner", player ) setElementData ( landmine, "type", "proximity" ) setElementParent ( landmine, landminecol ) end addEventHandler("poopoutthemine",getRootElement(),laymine) --DETECTS THE HIT function landminehit ( player, matchingDimension ) if ( getElementData ( source, "type" ) == "alandmine" ) then if ( getElementData ( player, "stealthmode" ) ~= "on" ) then local mineowner = getElementData ( source, "owner" ) local ownersteam = getPlayerTeam ( mineowner ) local victimteam = getPlayerTeam ( player ) if ownersteam ~= victimteam then --IS THIS PLAYER ON THE SAME TEAM AS THE GUY WHO PUT IT THERE? local posx, posy, posz = getElementPosition ( source ) createExplosion (posx, posy, posz, 8, mineowner ) setElementData ( source, "type", nil ) destroyElement ( source ) end end end end addEventHandler ( "onColShapeHit", getRootElement(), landminehit ) :Client Not much importants ------------------------------------------------------------------------------------------------ >Activation of mines when you shoot them. :Server --KILLS THE MINE WHEN SHOT addEvent ("destroylandmine", true ) function destroymine(hitElement) if (hitElement) then local damagedmine = getElementParent ( hitElement ) destroyElement ( damagedmine ) end end addEventHandler("destroylandmine",getRootElement(),destroymine) :Client --TRIGGERS THE SERVER EVENT TO DESTROY A LAND MINE ONCE IT'S SHOT function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if source == getLocalPlayer () then if (hitElement) then if ( getElementData ( hitElement, "type" ) == "proximity" ) then if minedelay ~= 1 then minedelay = 1 triggerServerEvent ("destroylandmine", getLocalPlayer (), hitElement ) endminedelay = setTimer ( minedelaystop, 400, 1, player ) end end end end end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), weaponfired ) function minedelaystop() minedelay = 0 end I have try everything to fix it, but I just script sinds 3 weeks and this step is to big for me to take. plsssss HELP!! I will be very happy!!!! Edited November 4, 2011 by Guest Link to comment
Jaysds1 Posted November 4, 2011 Share Posted November 4, 2011 (edited) First of all, you forgot to create the colshape secondly, you have to put getElementPosition(landmine) in the colshape hit eventhandler Edited November 4, 2011 by Guest Link to comment
Moderators IIYAMA Posted November 4, 2011 Author Moderators Share Posted November 4, 2011 ummm, you forgot to add a colshape over the mine That does not look, if a bullit hit the object I think. Link to comment
Jaysds1 Posted November 4, 2011 Share Posted November 4, 2011 I've just finish creating a resource for it, here: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3178 Link to comment
Moderators IIYAMA Posted November 5, 2011 Author Moderators Share Posted November 5, 2011 I've just finish creating a resource for it, here:https://community.multitheftauto.com/index.php?p=resources&s=details&id=3178 Thx man! I will try it! Why that check version? 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