Bean666 Posted May 1, 2016 Share Posted May 1, 2016 (edited) i need help. even the player dies, leaves the marker, quit, timer still continues any help? there are no errors function onDie( ) if isTimer( timing ) and getElementsWithinColShape( theShape ) == 0 then cancelTimer( timing ) end end addEventHandler( "onPlayerWasted", root, onDie ) addEventHandler( "onPlayerQuit", root, onDie ) addEventHandler( "onMarkerLeave", root, onDie ) Edited May 1, 2016 by Guest Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 function onDie( ) if isTimer( timing ) and getElementsWithinColShape( theShape ) == 0 then killTimer( timing ) end end addEventHandler( "onPlayerWasted", root, onDie ) addEventHandler( "onPlayerQuit", root, onDie ) addEventHandler( "onMarkerLeave", root, onDie ) Link to comment
Bean666 Posted May 1, 2016 Author Share Posted May 1, 2016 (edited) EDIT: still continues the timer Edited May 1, 2016 by Guest Link to comment
Bean666 Posted May 1, 2016 Author Share Posted May 1, 2016 (edited) it still continues the timer btw... here is the main part of the script, anything wrong? everythings fine but the prob is if player leaves , timer still continues addEventHandler("onMarkerHit", marker, function(player) if isPedInVehicle(player) then return; end if (isMarerHidden == true) then return; end if (getPlayerTeam(player) and getTeamName(getPlayerTeam(player)) == "Resistances") then outputChatBox("Stay in the marker, do not leave the marker or you will not get the money.", player, 255, 0, 0); if (isTimer( timing )) then return end timing = setTimer(function() for _,v in ipairs(getElementsByType("player")) do if isElementWithinColShape(v, theShape) then givePlayerMoney(v, 5000); outputChatBox("Robbery Success, Robbery will be available again in 5 minutes.", v, 0, 255, 0); end end setElementAlpha(marker, 0); isMarerHidden = true; setTimer(function() setElementAlpha(marker, 70); isMarerHidden = false; end, 60000, 1); end, 5000, 1); end end); Edited May 1, 2016 by Guest Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 ty i forgot canceltimer isnt a function Yeah Also, getElementsWithinColShape The type of this function Is a table, not number the check is false Link to comment
Bean666 Posted May 1, 2016 Author Share Posted May 1, 2016 so what do i have to do? it still continues the timer. Link to comment
Anubhav Posted May 1, 2016 Share Posted May 1, 2016 function onDie( ) if isTimer( timing ) and #getElementsWithinColShape( theShape ) == 0 then killTimer( timing ) end end addEventHandler( "onPlayerWasted", root, onDie ) addEventHandler( "onPlayerQuit", root, onDie ) addEventHandler( "onMarkerLeave", root, onDie ) . Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 function onDie( ) if isTimer( timing ) and #getElementsWithinColShape( theShape ) == 0 then killTimer( timing ) end end addEventHandler( "onPlayerWasted", root, onDie ) addEventHandler( "onPlayerQuit", root, onDie ) addEventHandler( "onMarkerLeave", root, onDie ) . This code won't work, Try this: function onDie( ) if (eventName == "onPlayerWasted") then if ( isTimer( timing ) and #getElementsWithinColShape(getElementColShape(theShape), "player") == 0 ) then killTimer( timing ) end elseif (eventName == "onPlayerQuit") then if ( isTimer( timing ) and #getElementsWithinColShape(getElementColShape(theShape), "player") == 0 ) then killTimer( timing ) end elseif (eventName == "onMarkerLeave") then if ( isTimer( timing ) and #getElementsWithinColShape(getElementColShape(theShape), "player") == 0 ) then killTimer( timing ) end end end addEventHandler( "onPlayerWasted", root, onDie ) addEventHandler( "onPlayerQuit", root, onDie ) addEventHandler( "onMarkerLeave", root, onDie ) Link to comment
Bean666 Posted May 1, 2016 Author Share Posted May 1, 2016 (edited) SOLVED no need , both codes work. even anubhav's Edited May 1, 2016 by Guest Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 SOLVEDno need to fight, both codes work. even anubhav's Fight? no man I said that, because I know what I am talking about, Read the wiki: https://wiki.multitheftauto.com/wiki/Is ... inColShape this function requires two arguments Link to comment
Bean666 Posted May 1, 2016 Author Share Posted May 1, 2016 calm down , i wasn't serious hhhh, ok. both codes work. no prob. Link to comment
Anubhav Posted May 1, 2016 Share Posted May 1, 2016 SOLVEDno need to fight, both codes work. even anubhav's Fight? no man I said that, because I know what I am talking about, Read the wiki: https://wiki.multitheftauto.com/wiki/Is ... inColShape this function requires two arguments What shit are you talking? Your code is rather longer and my is shorter. Also my code's performence is better. You don't need to put so many ifs. Also he is NOT USING THAT FUNCTION RATHER THIS: getElementsWithinColShape /end Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 SOLVEDno need to fight, both codes work. even anubhav's Fight? no man I said that, because I know what I am talking about, Read the wiki: https://wiki.multitheftauto.com/wiki/Is ... inColShape this function requires two arguments What :~ are you talking? Your code is rather longer and my is shorter. Also my code's performence is better. You don't need to put so many ifs. Also he is NOT USING THAT FUNCTION RATHER THIS: getElementsWithinColShape /end Hey calm down, I didn't mean anything bad, I just said this function requires two arguments else it won't work as the wiki said: Required ArgumentstheElement: The element you're checking. theShape: The colshape you're checking Returns Returns true if the element is within the colshape, false otherwise IsElementWithinColShape and sorry If you understood it by wrong, we are here to help and learn from our mistakes I'm gonna test it right now and see the result maybe I am wrong, I just followed the wiki's words. Link to comment
Anubhav Posted May 1, 2016 Share Posted May 1, 2016 I'm not angry. But you are wrong here, he was not using that function. He was not using: isElementWithinColShape but rather: getElementsWithinColShape What's wrong man? Why are you so confused? Link to comment
KariiiM Posted May 1, 2016 Share Posted May 1, 2016 I'm not angry. But you are wrong here, he was not using that function. He was not using: isElementWithinColShape but rather: getElementsWithinColShapeWhat's wrong man? Why are you so confused? Yes you're right, I am sorry I didn't take attention,I tought he used isElementWithinColShape ,it was 4 AM for me so yeah that's why 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