Automatic shutdown of the game

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Automatic shutdown of the game

      Hello, I have this code for automatic change in the database, and if when setting %% CONFIG %% to %% USER %% to add dm, it works perfectly when changing game_disable in the database does not happen Nothing at all, zero information about the error in the file error.log or about the action performed in the database

      PHP Source Code: edit.class.php

      1. <?php
      2. require_once 'includes/classes/cronjob/CronjobTask.interface.php';
      3. class edit implements CronjobTask
      4. {
      5. function run()
      6. {
      7. $db = Database::get();
      8. $db->update('update %%CONFIG%% set game_disable = 0');
      9. }
      10. }
      Display All
    • Yes, I know that in the admin panel I can add dm but i have automatic dm adding for active players right now. Now I want to do so that I will be able to schedule the game to turn off and on automatically
    • You cannot turn your game on and off with that code lol.

      Off = UPDATE %%CONFIG%% SET game_disabled = 1;
      On = UPDATE %%CONFIG%% SET game_disabled = 0;

      An easy Logic would be

      if(config::get()>game_disabled == 1){
      // turn on
      database::get()->update(“UPDATE %%CONFIG%% SET game_disabled = 0;”, []);
      } else {
      database::get()->update(“UPDATE %%CONFIG%% SET game_disabled = 1;”, []);
      }

      just set the time where the Cronjob should be called and that’s it.
    • I honestly don't understand what you wrote completely. Tell me if this is correct

      PHP Source Code: EndUpdateCronjob.class.php

      1. <?php
      2. require_once 'includes/classes/cronjob/CronjobTask.interface.php';
      3. class EndUpdateCronjob implements CronjobTask
      4. {
      5. function run()
      6. {
      7. Database::get()->update("UPDATE %%CONFIG%% SET game_disable = 1;)[]");
      8. }
      9. }
      Display All
    • Okay, suggesting already ready cronjob I did something like this. is it good?

      PHP Source Code

      1. <?php
      2. require_once 'includes/classes/cronjob/CronjobTask.interface.php';
      3. class AutoOffCronjob implements CronjobTask
      4. {
      5. function run()
      6. {
      7. $sql = 'UPDATE %%CONFIG%% SET `game_disable` = `0`';
      8. }
      9. }
      Display All
    • PHP Source Code

      1. <?php
      2. require_once 'includes/classes/cronjob/CronjobTask.interface.php';
      3. class AutoOffCronjob implements CronjobTask
      4. {
      5. function run()
      6. {
      7. if(config::get()>game_disabled == 1){
      8. database::get()->update(“UPDATE %%CONFIG%% SET game_disabled = 1;, []);}
      9. }
      10. }
      Display All
      Is it ok now or should I write to the file only what you provided and will work?