Xwad Posted April 17, 2015 Author Share Posted April 17, 2015 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
ALw7sH Posted April 17, 2015 Share Posted April 17, 2015 debugscript? and what's doesn't works exactly we cant help you if we dont know what's the problem Link to comment
Perfect Posted April 17, 2015 Share Posted April 17, 2015 (edited) 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 April 20, 2015 by Guest Link to comment
Xwad Posted April 18, 2015 Author Share Posted April 18, 2015 the problem is that is not demaging Link to comment
Enargy, Posted April 18, 2015 Share Posted April 18, 2015 the problem is that is not demaging What the f*ck? it doesn't happen that. Link to comment
Xwad Posted April 18, 2015 Author Share Posted April 18, 2015 maybe its becaouse my spawn script? Link to comment
Xwad Posted April 18, 2015 Author Share Posted April 18, 2015 but i dont understand becaouse th setelemnt must working Link to comment
Perfect Posted April 20, 2015 Share Posted April 20, 2015 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
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