cobraz Posted January 6, 2021 Share Posted January 6, 2021 Hello Guys! I have some problems with the timer for the new Crime addon from Dayo where you can do multiple crimes. I guess if you have installed it, you guys had / or will have the same problem. The Crime timer color won't work properly as before. (It always stays green, even tho there is a time countdown). Someone have a quik fix to this or can explain whats wrong? 🙂 Quote Link to comment Share on other sites More sharing options...
AinzOoalGown Posted January 6, 2021 Share Posted January 6, 2021 Ah yea, never even noticed lol others seem to be working fine, just not crimes. Quote Link to comment Share on other sites More sharing options...
Sim Posted January 7, 2021 Share Posted January 7, 2021 5 hours ago, cobraz said: Hello Guys! I have some problems with the timer for the new Crime addon from Dayo where you can do multiple crimes. I guess if you have installed it, you guys had / or will have the same problem. The Crime timer color won't work properly as before. (It always stays green, even tho there is a time countdown). Someone have a quik fix to this or can explain whats wrong? 🙂 Probably my doing while tweaking it. Quote Link to comment Share on other sites More sharing options...
BeNiiiBoiii Posted January 7, 2021 Share Posted January 7, 2021 Inside crimes.inc line 56 change to else { then below line 139 add if ($crimeInfo->C_cooldown + time() > $this->user->getTimer('crime')) { $this->user->updateTimer('crime', $crimeInfo->C_cooldown, true); } Hope this helps. 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted January 7, 2021 Share Posted January 7, 2021 That green bar is not for timers. As u can see your timers are res. That green bar is your % chance of committing that crime if im not mistaken, and the more you commit a certain crime, the higher it goes. 27 minutes ago, BeNiiiBoiii said: Inside crimes.inc line 56 change to else { else { then below line 139 add if ($crimeInfo->C_cooldown + time() > $this->user->getTimer('crime')) { $this->user->updateTimer('crime', $crimeInfo->C_cooldown, true); } if ($crimeInfo->C_cooldown + time() > $this->user->getTimer('crime')) { $this->user->updateTimer('crime', $crimeInfo->C_cooldown, true); } Hope this helps. We both looked at wrong spot. He circled it in picture. Its in header The problem is, i never see the crime timer updated. Only individual crime timers, so $this->user->updateTimer('crime-' . $id, $crimeInfo->C_cooldown, true); Im crimes.inc.php needs to.be something like this: $this->user->updateTimer('crime-' . $id, $crimeInfo->C_cooldown, true); $lastCrimeExpires = $this->user->getTimer("crime"); $crimeCheck = $this->user->getTimer("crime-" . $id); //timers are returned in timestamps? @Dayo If($crimeCheck > $lastCrimeExpires) { $this->user->updateTimer('crime-' . $crimeInfo->C_cooldown, true); } 1 Quote Link to comment Share on other sites More sharing options...
Dayo Posted January 7, 2021 Share Posted January 7, 2021 Ill post an updated fix for people later, im also chnaging the module a bit so you can have several crimes use the same timer. i.e. Crimes 1, 2, 4 and 6 share the same timer. if you do any of these they wioll stop you doing the others. But you can still do crimes 3 and 5. This allows you to have different types of crimes. 2 Quote Link to comment Share on other sites More sharing options...
cobraz Posted January 7, 2021 Author Share Posted January 7, 2021 (edited) 8 hours ago, BeNiiiBoiii said: Inside crimes.inc line 56 change to else { else { then below line 139 add if ($crimeInfo->C_cooldown + time() > $this->user->getTimer('crime')) { $this->user->updateTimer('crime', $crimeInfo->C_cooldown, true); } if ($crimeInfo->C_cooldown + time() > $this->user->getTimer('crime')) { $this->user->updateTimer('crime', $crimeInfo->C_cooldown, true); } Hope this helps. This pretty much solved the problem, thanks mate 🙂 Only problem now is that all crimes have to be ready before its "green". Possible to change it so its green if 1 of the crimes are ready? 1 hour ago, Dayo said: Ill post an updated fix for people later, im also chnaging the module a bit so you can have several crimes use the same timer. i.e. Crimes 1, 2, 4 and 6 share the same timer. if you do any of these they wioll stop you doing the others. But you can still do crimes 3 and 5. This allows you to have different types of crimes. Looking forward to it 🙂 Edited January 7, 2021 by cobraz 1 Quote Link to comment Share on other sites More sharing options...
BeNiiiBoiii Posted January 7, 2021 Share Posted January 7, 2021 (edited) Not quiet sure what you're on about sim? In his screen shot he has clearly circled the "crime" timer in the header? and the question was to make that go red when crimes are committed. Which my fix does. So with my code, it will update the new "crime-{id}" timers as usual but will also update the original "crime" timer that is set in header, ASLONG as the crime cooldown + current time is higher than currently set "crime" timer (I'm crap at explaining xD) Basically say you did a crime with a 45 second timer.. then immediately after committed a crime that is 25 seconds long then "crime" timer will not update.. The end result is basically crime timer will be red when ANY crime is in cooldown, and green if NO crimes are in cooldown. Edit: With all that said.. I'm sure Dayo's update will be much better than this fix lol Edited January 7, 2021 by BeNiiiBoiii 2 Quote Link to comment Share on other sites More sharing options...
cobraz Posted January 7, 2021 Author Share Posted January 7, 2021 32 minutes ago, BeNiiiBoiii said: Not quiet sure what you're on about sim? In his screen shot he has clearly circled the "crime" timer in the header? and the question was to make that go red when crimes are committed. Which my fix does. So with my code, it will update the new "crime-{id}" timers as usual but will also update the original "crime" timer that is set in header, ASLONG as the crime cooldown + current time is higher than currently set "crime" timer (I'm crap at explaining xD) Basically say you did a crime with a 45 second timer.. then immediately after committed a crime that is 25 seconds long then "crime" timer will not update.. The end result is basically crime timer will be red when ANY crime is in cooldown, and green if NO crimes are in cooldown. Edit: With all that said.. I'm sure Dayo's update will be much better than this fix lol This fix will do it for now thanks 😄 Lets wait for the update from Dayo 🤩 1 Quote Link to comment Share on other sites More sharing options...
Dayo Posted January 7, 2021 Share Posted January 7, 2021 15 minutes ago, cobraz said: This fix will do it for now thanks 😄 Lets wait for the update from Dayo 🤩 After looking at benniboiis response that is probably more efficient then what i did before. 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted January 7, 2021 Share Posted January 7, 2021 @BeNiiiBoiii dunno why i posted that, was super tired. Lol... I said same thing. 1 Quote Link to comment Share on other sites More sharing options...
BeNiiiBoiii Posted January 7, 2021 Share Posted January 7, 2021 2 minutes ago, Sim said: @BeNiiiBoiii dunno why i posted that, was super tired. Lol... I said same thing. Haha no worries 🙈 Quote Link to comment Share on other sites More sharing options...
Canjucks Posted January 21, 2021 Share Posted January 21, 2021 On 1/7/2021 at 7:42 PM, Dayo said: Ill post an updated fix for people later, im also chnaging the module a bit so you can have several crimes use the same timer. i.e. Crimes 1, 2, 4 and 6 share the same timer. if you do any of these they wioll stop you doing the others. But you can still do crimes 3 and 5. This allows you to have different types of crimes. Did you end up posting this @Dayo? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.