Blackdogg Posted January 5, 2009 Share Posted January 5, 2009 Re: [mccode] Buy A House With Level Requirements ! Thats all well and good but how do i get this mod to work lol :mrgreen: Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 6, 2009 Share Posted January 6, 2009 Re: [mccode] Buy A House With Level Requirements ! on the page where you show the houses put this in the cell with the buy link ( i don't know exact names ) ... echo($r['hLEVEL'] =< $ir['level']):'[url="buyhouse.php?id='.$r['hID'].'"]Buy[/url]':'<i style="color:#009">'.number_format($r['hCOST']).'[/i]'; Then in the buy bit.. if($np['hLevel'] > $ir['level'] ) { echo ' You Are Not The Level Required Yet</p>'; $h->endpage(); die; } $newMoney = $ir['money'] - $np['hPRICE']; if($db->query(sprintf("UPDATE users SET money = '%u', will = '0', maxwill = '%u' WHERE userid = '%u'",$newMoney,(int)$np['hWILL'],(int)$userid))) { echo ' You now live in a '.$np['hNAME'],'</p>[url="index.php"]back[/url]'; } else { echo 'error'; Quote Link to comment Share on other sites More sharing options...
Blackdogg Posted January 7, 2009 Share Posted January 7, 2009 Re: [mccode] Buy A House With Level Requirements ! hmmm this is the code that i have <?php include "globals.php"; $mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}"); $mp=$db->fetch_row($mpq); $_GET['property']=abs((int) $_GET['property']); if($_GET['property']) { $npq=$db->query("SELECT * FROM houses WHERE hID={$_GET['property']}"); $np=$db->fetch_row($npq); if($np['hWILL'] < $mp['hWILL']) { print "You cannot go backwards in houses!"; } else if ($np['hPRICE'] > $ir['money']) { print "You do not have enough money to buy the {$np['hNAME']}."; } if($ir['hLevel'] > $ir['level'] ) { print "You Are Not The Level Required Yet"; } else { $db->query("UPDATE users SET money=money-{$np['hPRICE']},will=0,maxwill={$np['hWILL']} WHERE userid=$userid"); print "You Baught {$np['hNAME']} ."; } } else if (isset($_GET['sellhouse'])) { $npq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}"); $np=$db->fetch_row($npq); if($ir['maxwill'] == 100) { print "You already live in the lowest property!"; } else { $db->query("UPDATE users SET money=money+{$np['hPRICE']},will=0,maxwill=100 WHERE userid=$userid"); print "You sold your {$np['hNAME']} and went back to your Trailer."; } } else { print "<center>Your current property: <font color=blue>[b]{$mp['hNAME']}[/b]</font> The houses you can buy are listed below. Click a house to buy it. "; print "[url='estate.php?sellhouse']Sell Your House[/url] "; if($ir['willmax'] > 100) { } $hq=$db->query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC"); while($r=$db->fetch_row($hq)) { print " <table cellspacing=2 class='table'><tr style='background:gray;'><th>House</th><th>House Price</th><th>House Will</th><th>House Level</th><th>Buy?</th></tr>"; $hq=mysql_query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC",$c); while($r=$db->fetch_row($hq)) { print "<tr><td>{$r['hNAME']}</a></td><td>\$$t".money_formatter($r['hPRICE'],'')."</td> <td>{$r['hWILL']}</td><td>{$r['hLEVEL']}</td> <td><a href='estate.php?property={$r['hID']}'>Buy</tr>"; } print "</table>"; } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Karlos Posted January 11, 2009 Share Posted January 11, 2009 Re: [mccode] Buy A House With Level Requirements ! A signed TINYINT can go from -127 to +127 [...] Almost...A signed TINYINT ranges from: -128 to +127 (1 Number out :P) Quote Link to comment Share on other sites More sharing options...
POG1 Posted January 11, 2009 Share Posted January 11, 2009 Re: [mccode] Buy A House With Level Requirements ! A signed TINYINT can go from -127 to +127 [...] Almost...A signed TINYINT ranges from: -128 to +127 (1 Number out :P) dang! lol Quote Link to comment Share on other sites More sharing options...
Karlos Posted January 11, 2009 Share Posted January 11, 2009 Re: [mccode] Buy A House With Level Requirements ! Oh well, 1 number :wink: Quote Link to comment Share on other sites More sharing options...
weewooz Posted June 28, 2009 Share Posted June 28, 2009 Re: [mccode] Buy A House With Level Requirements ! any one got this to work coz i cant get it to do anything at all Quote Link to comment Share on other sites More sharing options...
weewooz Posted June 28, 2009 Share Posted June 28, 2009 Re: [mccode] Buy A House With Level Requirements ! this wud be a great mod but the sql and the estate.php is all wrong anyone got this to work yet please? Quote Link to comment Share on other sites More sharing options...
CraigF Posted June 29, 2009 Share Posted June 29, 2009 Re: [mccode] Buy A House With Level Requirements ! You just need to use a mysql code to edit the database and add a collum for levelrequire and then edit the estate.php to only allow/show houses that are for that persons level, I don't have my old codes due to computer crash :( otherwise I would do this for you. I think I might be able to find my codes somewhere on the net from previous websites uploaded or something. 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.