-
Posts
205 -
Joined
-
Last visited
-
Days Won
4
Content Type
Profiles
Forums
Events
Everything posted by Mcfarlin
-
Can you combine and event_add with a $db->querry?
Mcfarlin replied to Mcfarlin's topic in Game Support
RE: Hi No it will never equal 0. [mysql]$rand1=(int) rand(1,200); $rand2=(int) rand(10,50); if($rand1 == 100) { $db->query("UPDATE users SET crystals=crystals+$rand2 WHERE userid=$userid"); event_add($ir['userid'],"While playing the game you found a crate of rations, consider it a gift for playing."); } [/mysql] it will always be 10-50 can they be joined together? -
Can you combine and event_add with a $db->querry?
Mcfarlin replied to Mcfarlin's topic in Game Support
Okay i was trying to help a friend who is using a mod from here. find random items while playing. (changed to crystals) problem is that of those random events where the crystal was found, an event was sent to the user. but no crystal. then other times it works fine with the event and the crystal being credited. just wondered if the querry and the event_add could be combined, then there would be no way this could happen. as is is now. [mysql]$db->query("UPDATE users SET crystals=crystals+$rand2 WHERE userid=$userid"); event_add($ir['userid'],"While playing the game you found a crystal, consider it a gift for playing.");[/mysql] and i think your meaning i could use? [mysql]$db->query("UPDATE users SET crystals=crystals+$rand2 WHERE userid=$userid"), event_add($ir['userid'], "While playing bla bla.");[/mysql] -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
^ matter of opinion, and game type plays into the equation as well. I am not looking for a typical crime game. There would be no adverse effect to the users seeing the others inventory in my case. others may not like this. silly even for some, but its something i wanted for mine. But mainly i am trying to learn, and i got it so far but am now stuck. -
was wondering if it can be done, and if so how? basically the querry and the event_add in the same line of code. that way no matter what when one ran the other would as well.
-
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
Sorry, i seen i forgot to close the tags, but that wasnt it either. i corrected that earlier thinking *what a bonehead thing to leave off* but nope. and [mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "User has no items"; } else { print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">"; $lt=""; $totitems=0; print"<tr>"; while($i=$db->fetch_row($inv)) { if($lt!=$i['itmtypename']) { $totitems++; $lt=$i['itmtypename']; print "<td>{$lt}</td>"; if($totitems%3==0) { print"</tr><tr>"; } } if ($i['inv_qty'] > 1) print"</td><td>"; } print"</tr></table>"; } $h->endpage(); ?> [/mysql] just makes it worse. with that the item groups will not only go across the page if the user has more than five, but it does not divide the groups up at all, they would just be displayed in a line along the bottom of the page. But thx for the go at it. i will get this to work eventually. -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
already tried that one. 100% down to 75% does nothing different, not even going down to 5%. i was so focused on getting the dang pics to show i didnt think about how they would be shown. -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
still one little issue with this, the items are displayed across the page, and the more you have the further it widens the page to display the items. so use at your own risk as it is now. -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
Okay i fixed it with this added to the end on my viewuser.php lol was missing quite a bit the first go round. [mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "User has no items"; } else { print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">"; $lt=""; while($i=$db->fetch_row($inv)) { if($lt!=$i['itmtypename']) { $lt=$i['itmtypename']; print "\n<tr><td>{$lt}</td></tr>"; } if ($i['inv_qty'] > 1) print"</td><td>"; } } $h->endpage(); ?>[/mysql] -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
lol may be a noob to this, but yes i have the item pics. they work fine no problems, i have managed to get them to show everywhere i wanted them to show but here. -
possible Items shown in veiwuser(missing something?)
Mcfarlin replied to Mcfarlin's topic in General Discussion
Okay i have fixed the error and straightend it up a little, but still not working. lol [mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "User has no items"; } else { if ($r['inv_qty'] > 1) { print "<table width=90% class=\"table\" border=\"0\" cellspacing=\"1\"> <tr> <td> </td> </tr> </table>"; } } $h->endpage(); ?>[/mysql] think i need :sleeping: been up way to long. -
Okay i dont know if anyone would even want anything like this, and yes i know this should be simple. all i was trying to do was have the items in the user you are viewings inventory show on the bottom of the page. i think im close to having it, but i just cant seem to get it to work right. either way here is where im at now. [mysql]$inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "User has no items"; } else { print "<table width=90% class=\"table\" border=\"0\" cellspacing=\"1\"> if ($r['inv_qty'] > 1) { print"<tr><td>"; } print "</td></tr></table>"; } $h->endpage(); ?>[/mysql] is what i have as my ending code in viewuser.php but. parse error you likely see. lol i have been up way to long, im just spent i guess. :wacko: any tips on how i can make this work? some may want to use if it would work, just though id throw it our here.
-
Simple Free mod to start off---Would anyone use?
Mcfarlin replied to Joshua's topic in Requests & In Production
lol well i loaded it on my local host and it works, so.... it just needs a little tweaking. but its still a nice mod. hell i have barely just now managed to make a three in one bank. lmao and yes no exit get the page repeated at the bottom of the page. either way its a nice little thing for your users. just add a few things and an image or 6 and its all good. -
Simple Free mod to start off---Would anyone use?
Mcfarlin replied to Joshua's topic in Requests & In Production
Just one question if i may. [mysql]require("sqlpro.php"); [/mysql] ????????? -
mccode-v2 Christmas Advent Calendar [ WORKING COPY }
Mcfarlin replied to Uridium's topic in Free Modifications
lol yes i am a refresh whore i know. but still (with my refreshing) a very nice mod as always from illusions. -
mccode-v2 Christmas Advent Calendar [ WORKING COPY }
Mcfarlin replied to Uridium's topic in Free Modifications
looks good on the test site. but, it lets me keep opening the box over and over. ?? dont think you meant for that did you? and the opened box did not show up after i opened one. but still a nice mod. most of your mods are very good and bug free. keep up the great work. -
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
-
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.
-
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.
-
[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.
-
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!
-
Nope still not what i was shooting for. i realize its just gonna delete the gang not the war. two different tables. lol
-
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.
-
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.