[v1.4] Spy buildings on attack - Printable Version +- TWLan Forum (https://twlan.org) +-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61) +--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62) +---- Forum: Deutsche Community (https://twlan.org/forumdisplay.php?fid=65) +----- Forum: Spielerprojekte (https://twlan.org/forumdisplay.php?fid=9) +------ Forum: Tools und Spielerprojekte (https://twlan.org/forumdisplay.php?fid=10) +------ Thread: [v1.4] Spy buildings on attack (/showthread.php?tid=4820) |
Spy buildings on attack - sinner - 29.01.2012 INFO: This script will help you determine the building levels of a spied village and automatically save it into another mysql column. Attention, this IS NOT a php snippet, though, I kindly ask you to use this as it follows: Step 1: Run this code in phpMyAdmin -> db_name - this code will create a function which selects the number of units from an string like 1;0;0;0;20;10;100;29; PHP Code: CREATE FUNCTION twexplode( Step 2: Run this code in phpMyAdmin -> db_name (this will add a new column where the data is saved) PHP Code: ALTER TABLE reports ADD s_buildings VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER receiver_userid Step 3: Create a file in htdocs/ name it spy.php and paste into it this code: PHP Code: <?php Step 4: Go to http://localhost/spy.php - If page is blank (empty / white), or it returns something like duplicate trigger name, everything is ok, DELETE spy.php - If there are shown any errors, please post them here ! Step 5: All thats left to do now is the modification for game_report_view_attack.tpl so it can parse and show the data from s_buildings (Scouted buildings column). It will be something like this,: PHP Code: {php} FAQ: Q: Why do you need to run the SQL code from spy.php in a php file when you can run it in phpMyAdmin? A: Because phpMyAdmin 2.x has trouble executing triggers with delimiters ! So it's best and secure to run it in PHP. Printscreen of the final result: Credits: - Me (idea and code) - Google (for the mysql trigger documentation) Best regards, Sinner. RE: Spy buildings on attack - Gira - 29.01.2012 realy nice good job |