[U5][SGC_ReplicÅtors] wrote:Wolf359 wrote:Grrrr - alliance wars was my idea![]()
http://www.stargatewars.com/phpBB2/viewtopic.php?t=4010
![]()
Although I must admit that you have gone into more depth, and suggested some extra alliance improvements.
The only bit I really really don't like is the 2nd part - Beneficial Relation. As I understand it - this is having different people to help you out for different things (attack/defence/covert) - this is kind of alliances within (and without) of alliances and I think is a little bit too overcomplicated.
dont worry Wolf if it wasnt for everybdy who posted anything on allaince wars and such i would never had thought about this idea...it just too me a while to thnk of a idea like this....
as for the current idea there are some concepts in the idea that seem flawed and need to be iron out. Also i am currently thingking of a rewards system for winning...KnightValor wrote:Whoa...
Very well thought out... It might be tricky, but it would be worth it...
Simple war meter:Code: Select all
... ?>
<table width=200 border=1><tr><td width=40>0%</td><td width=40>20%</td><td width=40>40%</td><td width=40>60%</td><td width=40>80%</td><td width=40>100%</td></tr></table>
<table width=200 border=1>
<tr><td width=<?php print($percent*2); ?> bgcolor=FF0000></td><td width=<?php print((200-$percent*2)); ?> bgcolor=FF4444></td></tr></table>
<?php
print("Your alliance holds ".$percent."% of the War Meter");
...
Well, at least most of it.
However, some of your ideas I think overcomplicates things a bit too much...
no defensive/offensive/intelligence/research mini-alliances. Waaay too complicated. Or at least, it would be on top of all of this.
But in case admin disagrees with me...
mysql table `users`:
Add def_alliance_p1, def_alliance_p2, atk_alliance_p1, spy_alliance_p1, spy_alliance p2, and research can be added later if at all.
Accepting proposal...Code: Select all
\\ $id would be the invitor's id
\\ $request would be the alliance request type (def, atk) in numerical form
if($request == 1) { // def
if(mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."' AND `def_alliance_p1`='0' OR `def_alliance_p2`='0')) == 1) {
$othermember1 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"def_alliance_p1");
$othermember2 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"def_alliance_p2");
if($othermember1 != 0) {
mysql_query(UPDATE `users` SET (`def_alliance_p1`, `def_alliance_p2`) VALUES ('".$id."', '".$othermember1."')"); }
if($othermember2 != 0) {
mysql_query(UPDATE `users` SET (`def_alliance_p1`, `def_alliance_p2`) VALUES ('".$id."', '".$othermember2."')"); }
if($othermember1 == 0 && othermember2 == 0) {
mysql_query(UPDATE `users` SET (`def_alliance_p1`) VALUES ('".$id."', '".$othermember2."')"); } } }
if($request == 2) { // intel
if(mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."' AND `spy_alliance_p1`='0' OR `spy_alliance_p2`='0')) == 1) {
$othermember1 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"spy_alliance_p1");
$othermember2 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"spy_alliance_p2");
if($othermember1 != 0) {
mysql_query(UPDATE `users` SET (`spy_alliance_p1`, `spy_alliance_p2`) VALUES ('".$id."', '".$othermember1."')"); }
if($othermember2 != 0) {
mysql_query(UPDATE `users` SET (`spy_alliance_p1`, `spy_alliance_p2`) VALUES ('".$id."', '".$othermember2."')"); } } }
Okay, uh... that's not nearly all yet, I know, but I'm too lazy to finish it/correct the mistakes I just reallized I made/look up the things I'm not sure on, so hopefully this will at least help out to start.
Things I didn't have: I forgot to put "WHERE `id`='".$pid."'" in all the update alliance columns (assuming pid is the accepting player's id). I didn't add anything to update the other members' profiles with the new alliance member. I also forgot in the spy one to add a third $othermember scenario... If there are no alliance members yet.
Arg. Yeah, I got tired of doing that for an idea I don't even support.
But the main idea behind this is amazingly good!
WHAO....i feel so honoured that u actautlly coded it KUDOS!
Meh... I was bored. And that isn't all, that's hardly all... and it probably has at least 3 bugs in it (I didn't test it... I can't without the right database... as in this and only this database)
Umm... although... I'm bored again (lol) I think I'll do a bit more work on it.
Code: Select all
\\ $id would be the invitor's id
\\ $request would be the alliance request type (def, atk) in numerical form
\\ $pid would be the invitee's id
if($request == 1) { // def
if(mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."' AND `def_alliance_p1`='0' OR `def_alliance_p2`='0')) == 1) {
$othermember1 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"def_alliance_p1");
$othermember2 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"def_alliance_p2");
if($othermember1 != 0) {
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$id."', `def_alliance_p2`='".$othermember1."') WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$pid."' WHERE `id`='".$id."'");}
if($othermember2 != 0) {
mysql_query("UPDATE `users` SET `def_alliance_p2`= '".$id."', `def_alliance_p1`= '".$othermember2."' WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `def_alliance_p2`='".$pid."' WHERE `id`='".$id."'");}
if($othermember1 == 0 && othermember2 == 0) {
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$id."' WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$pid."' WHERE `id`='".$id."'"); }
if($othermember1 != 0) {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember1."'"),0,"def_alliance_p1") == 0) {
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$pid."' WHERE `id`='".$othermember1."'"); } else {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember1."'"),0,"def_alliance_p2") == 0) {
mysql_query("UPDATE `users` SET `def_alliance_p2`='".$pid."' WHERE `id`='".$othermember1."'"); } } } else {
if($othermember2 != 0) {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember2."'"),0,"def_alliance_p1") == 0) {
mysql_query("UPDATE `users` SET `def_alliance_p1`='".$pid."' WHERE `id`='".$othermember2."'"); } else {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember2."'"),0,"def_alliance_p2") == 0) {
mysql_query("UPDATE `users` SET `def_alliance_p2`='".$pid."' WHERE `id`='".$othermember2."'"); } } } } } }
if($request == 2) { // spy
if(mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."' AND `spy_alliance_p1`='0' OR `spy_alliance_p2`='0')) == 1) {
$othermember1 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"spy_alliance_p1");
$othermember2 = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"spy_alliance_p2");
if($othermember1 != 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$id."', `spy_alliance_p2`='".$othermember1."') WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$pid."' WHERE `id`='".$id."'");}
if($othermember2 != 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p2`= '".$id."', `spy_alliance_p1`= '".$othermember2."' WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `spy_alliance_p2`='".$pid."' WHERE `id`='".$id."'");}
if($othermember1 == 0 && othermember2 == 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$id."' WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$pid."' WHERE `id`='".$id."'"); }
if($othermember1 != 0) {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember1."'"),0,"spy_alliance_p1") == 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$pid."' WHERE `id`='".$othermember1."'"); } else {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember1."'"),0,"spy_alliance_p2") == 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p2`='".$pid."' WHERE `id`='".$othermember1."'"); } } } else {
if($othermember2 != 0) {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember2."'"),0,"spy_alliance_p1") == 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p1`='".$pid."' WHERE `id`='".$othermember2."'"); } else {
if(mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$othermember2."'"),0,"spy_alliance_p2") == 0) {
mysql_query("UPDATE `users` SET `spy_alliance_p2`='".$pid."' WHERE `id`='".$othermember2."'"); } } } } } }
if($request == 3) { // atk
if(mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."' AND `atk_alliance_p1`='0'")) == 1) {
$othermember = mysql_result(mysql_query("SELECT * FROM `users` WHERE `id`='".$id."''),null,"atk_alliance_p1");
if($othermember != 0) {
mysql_query("UPDATE `users` SET `atk_alliance_p1`='".$id."' WHERE `id`='".$pid."'");
mysql_query("UPDATE `users` SET `atk_alliance_p1`='".$pid."' WHERE `id`='".$id."'");} } }
ahh... done.
There are probably some bugs left still, but I actually took the trouble of looking up some mysql stuff which I am very rusty at right now.
As for alot of other code: adding attack, distributing casualties, adding def, distributing casualties, adding spies, distributing casualties, and quiting alliances, I will leave it to someone who will be rewarded for it.
Hope my work will have helped whoever is unlucky enough to have to code this (should it pass... which it should)



