Greenie0101 Posted July 1, 2012 Share Posted July 1, 2012 Making this script for a suggestion on CIT (already suggested it so don't think about stealing) but im having many problems with the givePlayerMoney part. Here is script. function grow1() tree1 = createObject(616, -267, -1358, -30) moveObject(tree1, 30000, -267, -1358,7.5) healthtime1 = setTimer (health1, 30000, 1) end addCommandHandler("tree", grow1) function health1() ped1 = createPed ( 0, -267, -1358,8) setElementAlpha ( ped1, 0 ) attachElements(ped1, tree1) falltime1 = setTimer (treefall1, 100, 0) end function treefall1(player) if (isPedDead ( ped1 ) ) then killTimer ( falltime1 ) moveObject(tree1, 1000, -267, -1358,7.5, 90, 0, 0) setTimer(sink1, 3000, 1) outputChatBox("You've cut down a tree! Here is your pay!", getRootElement(), 0, 255, 0, true ) givePlayerMoney ( player, 1000 ) end end function sink1() moveObject(tree1, 10000, -267, -1358,4, 90, 0, 0) setTimer(grow1, 10200, 1) setTimer(reset1, 10000, 1) end function reset1() destroyElement(tree1) end Link to comment
Guest Guest4401 Posted July 1, 2012 Share Posted July 1, 2012 function grow1(player) tree1 = createObject(616, -267, -1358, -30) moveObject(tree1, 30000, -267, -1358,7.5) healthtime1 = setTimer (health1, 30000, 1,player) end addCommandHandler("tree", grow1) function health1(player) ped1 = createPed ( 0, -267, -1358,8) setElementAlpha ( ped1, 0 ) attachElements(ped1, tree1) falltime1 = setTimer (treefall1, 100, 0,player) end function treefall1(player) if (isPedDead ( ped1 ) ) then killTimer ( falltime1 ) moveObject(tree1, 1000, -267, -1358,7.5, 90, 0, 0) setTimer(sink1, 3000, 1) outputChatBox("You've cut down a tree! Here is your pay!", getRootElement(), 0, 255, 0, true ) givePlayerMoney ( player, 1000 ) end end function sink1() moveObject(tree1, 10000, -267, -1358,4, 90, 0, 0) setTimer(grow1, 10200, 1) setTimer(reset1, 10000, 1) end function reset1() destroyElement(tree1) end Link to comment
Greenie0101 Posted July 1, 2012 Author Share Posted July 1, 2012 thanks so much man, so i just had to define player in all the functions before it? Another problem with it, it works first time but then after the tree has grown again and i cut it down a second time it doesn't work? Link to comment
TAPL Posted July 1, 2012 Share Posted July 1, 2012 function grow1(player) tree1 = createObject(616, -267, -1358, -30) moveObject(tree1, 30000, -267, -1358,7.5) healthtime1 = setTimer (health1, 30000, 1,player) end addCommandHandler("tree", grow1) function health1(player) ped1 = createPed ( 0, -267, -1358,8) setElementAlpha ( ped1, 0 ) attachElements(ped1, tree1) falltime1 = setTimer (treefall1, 100, 0,player) end function treefall1(player) if (isPedDead ( ped1 ) ) then killTimer ( falltime1 ) moveObject(tree1, 1000, -267, -1358,7.5, 90, 0, 0) setTimer(sink1, 3000, 1,player) outputChatBox("You've cut down a tree! Here is your pay!", player, 0, 255, 0, true ) givePlayerMoney ( player, 1000 ) end end function sink1(player) moveObject(tree1, 10000, -267, -1358,4, 90, 0, 0) setTimer(grow1, 10200, 1,player) setTimer(reset1, 10000, 1) end function reset1() destroyElement(tree1) 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