Make some indicators for version 1.8
[MOD] Attack indicators for version 1.8
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
mimirkz had a mod update for 1.8 that has a attack indiator
-
Lol not even a “please”. Can you please go and fuck yourself ?
-
lol
-
This is from my game, you have to adapt to yours, eventually.
It's very simple to do it.
PHP Source Code: AbstractGamePage.class.php
- <?php
- [...]
- $AttackSQL = "SELECT COUNT(*) as count FROM %%FLEETS%% WHERE fleet_target_owner = :id AND (fleet_mission = 1 OR fleet_mission = 2 OR fleet_mission = 9) AND fleet_start_time > :timestamp; ";
- $AttackCount = Database::get()->selectSingle($AttackSQL, array(
- ':id' => $USER['id'],
- ':timestamp' => TIMESTAMP,
- ), 'count');
- $this->assign(array(
- [...]
- 'AttackCount' => $AttackCount,
HTML Source Code
- <a href="game.php?page=fleetActivity" class="hidden-xs nav-link dropdown-toggle arrow-none waves-light waves-effect" onclick="return Dialog.open(this.href, 600, 400);" data-toggle="dropdown" href="#" role="button"
- aria-haspopup="false" aria-expanded="false">
- {if $AttackCount > 0}<i class="fa fa-exclamation-triangle noti-icon fleet-warning" style="color: orange;"></i>{else}<i class="fa fa-plane noti-icon" style="color: lime;"></i>{/if}
- <script type="text/javascript">(function blink() { $('.fleet-warning').fadeOut(500).fadeIn(500, blink); })();</script>
- </a>
-
longpolls are also possible, make a request from the browser,
then in php ask db every second for new fleets.
if your client(browser) makes a request every 10 sec you would have some kind of a push-system
i would prefer sockets, but this is easy and working (just do the loop if original dbrequestresult was same client already has and change 'if (isset($db_erg[0]))' to your needs)
PHP Source Code
- do {
- session_write_close();
- if(connection_aborted()){
- die();
- }
- sleep(1);
- $sql = = "SELECT COUNT(*) as count FROM %%FLEETS%% WHERE fleet_target_owner = :id AND (fleet_mission = 1 OR fleet_mission = 2 OR fleet_mission = 9) AND fleet_start_time > :timestamp; ";
- $AttackCount = Database::get()->selectSingle($AttackSQL, array(
- ':id' => $USER['id'],
- ':timestamp' => TIMESTAMP,
- ), 'count');
- $db_erg = $db->select($sql);
- if (isset($db_erg[0])) {
- $i = 10;
- }
- $i++;
- } while ($i < 10);
-
XenQen wrote:
Lol not even a “please”. Can you please go and fuck yourself ?
-
Share
- Facebook 0
- Twitter 0
- Google Plus 0
- Reddit 0