Jump to content
MakeWebGames

Crime Timer Stays Green (Support)


cobraz

Recommended Posts

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. 

image.thumb.png.e087f9a724204ade6bb0ee6b392f22e6.png

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? 🙂

Link to comment
Share on other sites

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. 

image.thumb.png.e087f9a724204ade6bb0ee6b392f22e6.png

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.

Link to comment
Share on other sites

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);

}

  • Confused 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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 by cobraz
  • Like 1
Link to comment
Share on other sites

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 by BeNiiiBoiii
  • Like 2
Link to comment
Share on other sites

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 🤩

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...