Jump to content

Trip mine script


Xwad

Recommended Posts

my god not working!!:(

  
function Object ( name ) 
setElementCollisionsEnabled(createObject ( 1211, -1467.2827, -1287.6701, 99.1, 0, 0, 0 ), false) -- this creates an object 
colShape = createColSphere ( -1746, -1743, 28, 3) 
end 
addEventHandler ( "onResourceStart", resourceRoot, Object ) 
  
function Mine(thePlayer, matchingDimension) 
    if getElementType ( thePlayer ) == "player" then 
        if source == colShape then 
            local pX, pY, pZ = getElementPosition ( thePlayer )   -- get the player's position 
            createExplosion ( pX, pY, pZ, 6, thePlayer )   -- and create an explosion there 
            local theHealth = getElementHealth(thePlayer); 
            if ( theHealth < 100 ) then 
            setElementHealth(thePlayer, theHealth - 70); 
            outputChatBox("You stepped on a Mine!",thePlayer,255,109 ,109 ) -- outputs a chatbox 
        end 
    end 
end 
end 
addEventHandler("onColShapeHit",root,Mine) 
  

Link to comment
function Object ( name ) 
setElementCollisionsEnabled(createObject ( 1211, -1467.2827, -1287.6701, 99.1, 0, 0, 0 ), false) -- this creates an object 
colShape = createColSphere ( -1746, -1743, 28, 3) 
end 
addEventHandler ( "onResourceStart", resourceRoot, Object ) 
  
function Mine(thePlayer, matchingDimension) 
    if getElementType ( thePlayer ) == "player" then 
        if source == colShape then 
            local pX, pY, pZ = getElementPosition ( thePlayer )   -- get the player's position 
            createExplosion ( pX, pY, pZ, 6, thePlayer )   -- and create an explosion there 
            local theHealth = getElementHealth(thePlayer); 
            if ( theHealth <= 100 ) then 
            setElementHealth(thePlayer, theHealth - 70); 
            outputChatBox("You stepped on a Mine!",thePlayer,255,109 ,109 ) -- outputs a chatbox 
        end 
    end 
end 

*lua tag added*

Edited by Guest
Link to comment

The message 'You stepped on a Mine!' is showing ?

Try this(I missed an 'end' in my last post):-

  
function Object ( name ) 
setElementCollisionsEnabled(createObject ( 1211, -1467.2827, -1287.6701, 99.1, 0, 0, 0 ), false) -- this creates an object 
colShape = createColSphere ( -1746, -1743, 28, 3) 
end 
addEventHandler ( "onResourceStart", resourceRoot, Object ) 
  
function Mine(thePlayer, matchingDimension) 
   if getElementType ( thePlayer ) == "player" then 
        if source == colShape then 
            local pX, pY, pZ = getElementPosition ( thePlayer )   -- get the player's position 
            createExplosion ( pX, pY, pZ, 6, thePlayer )   -- and create an explosion there 
            local theHealth = getElementHealth(thePlayer); 
            if ( theHealth <= 100 ) then 
                setElementHealth(thePlayer, 1); 
                outputChatBox("You stepped on a Mine!",thePlayer,255,109 ,109 ) -- outputs a chatbox 
            else 
                killPed(thePlayer) 
                outputChatBox("Looks like you have 100+ health!",thePlayer,255,109 ,109 ) -- outputs a chatbox 
            end 
        end 
    end 
end 
  

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