Jump to content
MakeWebGames

How do I add NPC to be constantly in jail?


athena26

Recommended Posts

In your minute cron, add something like ...

$db->query("UPDATE users SET jail = 15 WHERE userid IN (1, 2, 3, 4) AND jail = 0");

Replacing 1, 2, 3 and 4 with the account IDs of the NPC's.

 

Note: I'm not 100% certain the method for query execution is query() - but you should be able to see if it's not from the other queries in the cron file.

Edited by SRB
Fixed query
  • Like 1
Link to comment
Share on other sites

1 hour ago, athena26 said:

Could anyone tell me how I could add 4 NPC 'bots' to be constantly in jail to be jail broken.... Every time they get jail bust 5 seconds after they return back into jail ...

Wonderful idea!!

Link to comment
Share on other sites

You could simply create 4 fake users (bots) and then give them each 1 day in jail. Then you could add a Update query in a global file to put them back in jail if they are no longer in jail. With it being in a global file like a header file every time a page is loaded by a user the query is used so as long as a user is online doing stuff the bot will always be in jail for 1 day. The is just a basic idea of how you could do it with the littlest changes to the coding as possible without having to alter or create a new section of the DB. That's a pretty good idea btw! Oh and something I usually like adding in is the option to throw rotten tomatoes at the people in jail, it's all in good fun. 😛

Edited by twison
  • Like 1
Link to comment
Share on other sites

Basically keep them in jail every 24 hours every time they get busted out they automatically return it's only because my jail bust gains 1000 labour per bust, labour only earned by jail bust I removed the gym function of labour .

3 hours ago, SRB said:

In your minute cron, add something like ...

$db->query("UPDATE users SET jail = 15 WHERE userid IN (1, 2, 3, 4") AND jail = 0;



$db->query("UPDATE users SET jail = 15 WHERE userid IN (1, 2, 3, 4") AND jail = 0;

Replacing 1, 2, 3 and 4 with the account IDs of the NPC's.

 

Note: I'm not 100% certain the method for query execution is query() - but you should be able to see if it's not from the other queries in the cron file.

This didn't work but thanks. 

1 hour ago, Sim said:

Instead of 5 secs. Just never remove them from jail? 5 secs is not much time anyway?

3 seconds would be good just because of people having timers . Another great idea that I'm thinking to do , as a gang mod.... When a gang member breaks another gang member from jail they gain double labour experience ...

Edited by athena26
Link to comment
Share on other sites

$db->query("UPDATE users SET jail = 15 WHERE user_level = 0 AND jail = 0");

Adding something like this to your header.php should work just fine if the userlevel of the npc accounts is set to 0.

This will put the npc in jail for 15 minutes every time a page is loaded by a user as long as the npc is not in jail.

You can tweak it however fits your needs but should work just fine for what you're wanting to do.

Link to comment
Share on other sites

59 minutes ago, athena26 said:

Basically keep them in jail every 24 hours every time they get busted out they automatically return it's only because my jail bust gains 1000 labour per bust, labour only earned by jail bust I removed the gym function of labour .

This didn't work but thanks. 

3 seconds would be good just because of people having timers . Another great idea that I'm thinking to do , as a gang mod.... When a gang member breaks another gang member from jail they gain double labour experience ...

It should of, I just tested this on my game. Try this, if your running the outdated version.

 

Open up ya cron five file and follow these instructions

Under

$query4="UPDATE users SET hp=maxhp WHERE hp>maxhp";

Add this

$query182="UPDATE users SET jail = 15 WHERE userid IN (6) AND jail = 0";

 

 

Then find this

$db->query($query4);

and add this under it

$db->query($query182);

 

Edited by MNG
  • Like 1
Link to comment
Share on other sites

7 hours ago, SRB said:

In your minute cron, add something like ...

$db->query("UPDATE users SET jail = 15 WHERE userid IN (1, 2, 3, 4) AND jail = 0");


$db->query("UPDATE users SET jail = 15 WHERE userid IN (1, 2, 3, 4) AND jail = 0");

Replacing 1, 2, 3 and 4 with the account IDs of the NPC's.

 

Note: I'm not 100% certain the method for query execution is query() - but you should be able to see if it's not from the other queries in the cron file.

The query was broken - that should work now, as is.

  • Like 1
Link to comment
Share on other sites

8 hours ago, MNG said:

It should of, I just tested this on my game. Try this, if your running the outdated version.

 

Open up ya cron five file and follow these instructions

Under

$query4="UPDATE users SET hp=maxhp WHERE hp>maxhp";


$query4="UPDATE users SET hp=maxhp WHERE hp>maxhp";

Add this

$query182="UPDATE users SET jail = 15 WHERE userid IN (6) AND jail = 0";


$query182="UPDATE users SET jail = 15 WHERE userid IN (6) AND jail = 0";

 

 

Then find this

$db->query($query4);


$db->query($query4);

and add this under it

$db->query($query182);


$db->query($query182);

 

10 hours ago, Sim said:

This works but it takes a minute for the dealer to go back into jail

 

Screenshot_2021-04-05-08-49-59-18.thumb.jpg.3ffdf9c80041221c8d89a55495dc597f.jpgScreenshot_2021-04-05-08-49-59-18.thumb.jpg.3ffdf9c80041221c8d89a55495dc597f.jpg

Screenshot_2021-04-05-08-50-03-00.jpg

It works perfectly tha m you guys now all I need is to add the users image in jail, I know my jail file is to basic 😂

13 hours ago, twison said:

$db->query("UPDATE users SET jail = 15 WHERE user_level = 0 AND jail = 0");


$db->query("UPDATE users SET jail = 15 WHERE user_level = 0 AND jail = 0");

Adding something like this to your header.php should work just fine if the userlevel of the npc accounts is set to 0.

This will put the npc in jail for 15 minutes every time a page is loaded by a user as long as the npc is not in jail.

You can tweak it however fits your needs but should work just fine for what you're wanting to do.

Only issue with this all bots from battle tent go to jail and they can't be attacked whilst in jail 

  • Like 1
Link to comment
Share on other sites

9 hours ago, athena26 said:

 

Screenshot_2021-04-05-08-49-59-18.thumb.jpg.3ffdf9c80041221c8d89a55495dc597f.jpgScreenshot_2021-04-05-08-49-59-18.thumb.jpg.3ffdf9c80041221c8d89a55495dc597f.jpg

Screenshot_2021-04-05-08-50-03-00.jpg

It works perfectly tha m you guys now all I need is to add the users image in jail, I know my jail file is to basic 😂

Only issue with this all bots from battle tent go to jail and they can't be attacked whilst in jail 

Your best bet is to make jail bots and attack bots separate 

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...