Mcfarlin Posted November 8, 2009 Posted November 8, 2009 Yes i know this is not much of a mod, and i know you will laugh when i say it took me hours to make just this work. But we all have to start learning somewhere right? lol okay so here it is. i was tired of seeing gangs deleted after they reached zero respect. so i wanted a way to keep this from happening while at the same time not having gangs with negative respect. I now have mine set to not allow a gang to be declared on if respect is lower than XXX and set a max respect as well. the only thing its missing is the query to delete the war when it reaches a certain amount. in yourgang.php find your declare function and replace it with this one. [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())"); $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'>"; $q=$db->query("SELECT * FROM gangs WHERE gangID != {$ir['gang']}"); while($r=$db->fetch_row($q)) { print "<option value='{$r['gangID']}'>{$r['gangNAME']}</option>\n"; } print "</select> <input type='submit' value='Declare' /></form>"; } }[/mysql] in minute or five min cron add [mysql]$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-20 WHERE gangRESPECT > 10000");[/mysql] to limit the respect. this will cap the respect and keep gangs with less than an amount of respect from getting a war declared on them. but remember to delete in all three attack files [mysql]//Gang Kill if ($ga['gangRESPECT']<=0 && $r['gang']) { $db->query("UPDATE users SET gang=0 WHERE gang={$r['gang']}"); $db->query("DELETE FROM gangs WHERE gangRESPECT<='0'"); $db->query("DELETE FROM gangwars WHERE warDECLARER={$ga['gangID']} or warDECLARED={$ga['gangID']}"); }[/mysql] it should be around line 45-50 in all three. well thats what i have so far, i know its nothing speacial. but im not either :P but i could use help with the db query to delete the wars where a gang has less than 200 respect if anyone wants to help. thx curt for pointing me in the right direction. Quote
Wickidnezz Posted January 30, 2010 Posted January 30, 2010 eh not to sound rude or disrespectful but um don't ya think it might be a smart idea to tell people the 3 attack files as their are 5 attack files like say if someone who didn't know what they were doing was to want to try to use this they would go around searching all the attack files like weirdo's lmao but overall i like it:) +1 also just to help everyone who would like the files listed they are : attackbeat.php attackwon.php attacktake.php and the bit to delete You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. starts at line 45 and ends on line 52 for attackwon.php and in attacktake.php it starts on line 48 and ends on line 55 and attackbeat.php it starts on line 43 and ends on line 50 Quote
Jordan Palmer Posted January 30, 2010 Posted January 30, 2010 First thing I take out is this; Great "update" mate Quote
Mcfarlin Posted February 13, 2010 Author Posted February 13, 2010 lmao that was one of the first things i learned when i started with MCCraps but i have since moved on to bigger and better things. but i would not have learned as fast without this place. so thanks to all who helped , and a big FU to those who didnt. hehe Quote
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.