Mcfarlin Posted November 7, 2009 Share Posted November 7, 2009 Okay i know im new at this but i cannot for the life of me get this to work. I am trying to write two queries in my minute cron to delete all wars where any of the gangs in was have less than 200 respect. and another so that you cannot declare war if gang respect is not greater than 500. here is what i have now tried to this point. [mysql]$db->query(" DELETE FROM `gangwars` WHERE `gangRESPECT` < 200");[/mysql] [mysql]$db->query(" DELETE `gangwars` WHERE `gangRESPECT` < 200");[/mysql] i know i will not be able to do the second thing in the cron, but if i cant make the first one work their is no use in the second. any help i would appreciate greatly. Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 7, 2009 Author Share Posted November 7, 2009 dang i feel dumb now. lol i fixed it now, but as yoo well know it was not with a cron. hehe [mysql]$db->query("DELETE FROM gangwars WHERE gangRESPECT<='200'");[/mysql] in the three attack files. works like a charm now. all i have left is to stop a war from being declared if either gang has less than 500 respect. but i think i can figure that one out. Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 8, 2009 Author Share Posted November 8, 2009 Nope still not what i was shooting for. i realize its just gonna delete the gang not the war. two different tables. lol Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 8, 2009 Author Share Posted November 8, 2009 Okay i have it mostly fixed now the way i was trying to fix it. all i have left that i still am not sure how to make work is the war declare in yourgang.php and the deletion of the wars with either gang involved in it getting to a certain respect level. the war delete i though i could make happen with a cron, but i have no knowledge of how to make it query two tables to get the info needed to delete the war. i have the original function here, i had to take my addition out for errors. :cursing: [mysql]function gang_staff_wardeclare() { global $db,$ir,$c,$userid,$gangdata; if(isset($_POST['subm'])) { $_POST['gang'] = abs((int) $_POST['gang']); $db->query("INSERT INTO gangwars VALUES('',{$ir['gang']},{$_POST['gang']},unix_timestamp())"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID={$_POST['gang']}"); $them=$db->fetch_row($ggq); $event=str_replace("'","''","{$gangdata['gangNAME']} declared war on {$them['gangNAME']}"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',{$_POST['gang']},unix_timestamp(),'$event')"); print "You have declared war!"; } else { print "<form action='yourgang.php?action=staff&act2=declare' method='post'> Choose who to declare war on. <input type='hidden' name='subm' value='submit' /> Gang: <select name='gang' type='dropdown'>"; while($r=$db->fetch_row($q)) { print "<option value='{$r['gangID']}'>{$r['gangNAME']}</option>\n"; } print "</select> <input type='submit' value='Declare' /></form>"; } }[/mysql] i cannot seem to get it to kill the request to keep the war from being declared, it tells the user they cannot declare the war, but it still does it anyway. with that i am at a loss now. i have been around this forum for a while now and know i will likely catch hell for my lack of knowledge, but i do not care. If anyone is willing to help thank you! Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 8, 2009 Author Share Posted November 8, 2009 [mysql]function gang_staff_wardeclare() { global $db,$ir,$c,$userid,$gangdata; if(isset($_POST['subm'])) { $_POST['gang'] = abs((int) $_POST['gang']); $db->query("INSERT INTO gangwars VALUES('',{$ir['gang']},{$_POST['gang']},unix_timestamp())"); $ggq=$db->query("SELECT * FROM gangs WHERE gangID={$_POST['gang']}"); $them=$db->fetch_row($ggq); if ($them['gangRESPECT'] < 500) { print " You can only declare war on a squad with more than 500 respect"; return; } $event=str_replace("'","''","{$gangdata['gangNAME']} declared war on {$them['gangNAME']}"); $db->query("INSERT INTO gangevents VALUES('',{$ir['gang']},unix_timestamp(),'$event') , ('',{$_POST['gang']},unix_timestamp(),'$event')"); print "You have declared war!"; } else { print "<form action='yourgang.php?action=staff&act2=declare' method='post'> Choose who to declare war on. <input type='hidden' name='subm' value='submit' /> Gang: <select name='gang' type='dropdown'>"; while($r=$db->fetch_row($q)) { print "<option value='{$r['gangID']}'>{$r['gangNAME']}</option>\n"; } print "</select> <input type='submit' value='Declare' /></form>"; } } [/mysql] this doesnt work either, thx curt. Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 8, 2009 Author Share Posted November 8, 2009 Okay after an hour of LEARNING lol i made this work like i wanted it to work. Thank you curt for pointing me in the right direction. [mysql]function gang_staff_wardeclare() { global $db,$ir,$c,$userid,$gangdata; if(isset($_POST['subm'])) { $ggq=$db->query("SELECT * FROM gangs WHERE gangID={$_POST['gang']}"); $them=$db->fetch_row($ggq); if ($them['gangRESPECT'] < 500) { die("you cannot declare on a squad with less than 500 respect."); } $_POST['gang'] = abs((int) $_POST['gang']); $db->query("INSERT INTO gangwars VALUES('',{$ir['gang']},{$_POST['gang']},unix_timestamp())");[/mysql] Now all i need i a way to delete a gang war if any of the gnags involved in a war have less than 200 respect. i connot make this work in a cron, two diferent tables to call and i dont know how. i will try to make it work in the attack files. Quote Link to comment Share on other sites More sharing options...
Curt Posted November 9, 2009 Share Posted November 9, 2009 np bro also to get it so the war ends when there respect is less than 200 you would need to edit the following files : attackbeat.php attacklost.php attacktake.php attackwon.php hope that helps u.. cheers Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted November 10, 2009 Author Share Posted November 10, 2009 Yeah i got that part of it all. my issue is that i cannot successfully call the two separate tables at the same time. lol i am in no way trying to act like i know what i am doing, i have tried several $db->queries but none seem to work. [mysql]$db->query("DELETE FROM gangWARS WHERE gangRESPECT<=200");[/mysql] that one is the closest i think i have got to the correct one, but i know it will never work calling to two different tables like that. Sooo.....off to google i go to try and learn how it works better than i know now. really i dont think im doing so bad considering i have only been at this for two months. lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.