Jump to content
MakeWebGames

Recommended Posts

Posted

Hey i do not know if anybody made this yet but crystal houses!!!Where the person has to have (X) amount of crystals to buy a house!They still can have houses for money but houses for crystals too now that would be awesome!Just throwing it out there lol!

Posted

simple.

[mysql]<?php

$housequery=1;

include "globals.php";

$mpq=$db->query("SELECT * FROM CRhouses WHERE hWILL={$ir['maxwill']}");

$mp=$db->fetch_row($mpq);

$_GET['property']=abs((int) $_GET['property']);

if($_GET['property'])

{

$npq=$db->query("SELECT * FROM CRhouses 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['crystal'])

{

print "You do not have enough crystal to buy that.";

}

else

{

$db->query("UPDATE users SET crystal=crystal-{$np['hPRICE']},will=0,maxwill={$np['hWILL']} WHERE userid=$userid");

print "Congrats, you bought the {$np['hNAME']} for \${$np['hPRICE']}!";

}

}

 

else if (isset($_GET['sellhouse']))

{

$npq=$db->query("SELECT * FROM CRhouses WHERE hWILL={$ir['maxwill']}");

$np=$db->fetch_row($npq);

if($ir['maxwill'] == 50)

{

print "You already live in the lowest property!";

}

else

{

$db->query("UPDATE users SET crystal=crystal+{$np['hPRICE']},will=0,maxwill=50 WHERE userid=$userid");

print "You sold your {$np['hNAME']} and went back to a Two Man Tent.";

}

}

else

{

print "Your current property: {$mp['hNAME']}

The houses you can buy are listed below. Click a house to buy it.

";

if($ir['maxwill'] > 50)

{

print "[/url]

 

";

}

 

echo "<table width='90%' class=\"table\" border=\"1\" cellspacing=\"1\">

<tr bgcolor=gray>

<th>Name</th>

<th>Price</th>

<th>Will Bar</th>

<th>Level Needed</th>

</tr>";

$hq=$db->query("SELECT * FROM CRhouses WHERE hWILL>1 AND hLVL > 0 ORDER BY hWILL ASC");

while($r=$db->fetch_row($hq))

{

echo "

<tr>

<td>{$r['hNAME']}</td>

<td>\${$r['hPRICE']}</td>

<td>{$r['hWILL']}</td>

<td>{$r['hLVL']}</td>

</tr>";

}

echo "</table>";

}

$h->endpage();

?>[/mysql]

 

and the table for the new houses.

[mysql]

CREATE TABLE IF NOT EXISTS `CRhouses` (

`hID` int(11) NOT NULL auto_increment,

`hNAME` varchar(255) collate latin1_general_ci NOT NULL default '',

`hPRICE` int(22) NOT NULL default '0',

`hWILL` int(11) NOT NULL default '0',

`hLVL` int(11) default '1',

PRIMARY KEY (`hID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=19 ;[/mysql]

 

 

if you dont want to put a min level on there you will have to take that bit out.

Posted

First of i'd like to say nice work Mcfarlin very well done, i would say add a little security in there though and maybe and i mean just maybe remove the *'s it's looks tacky. Other than that looks alright to me (quick glance).

Posted

lol i didnt do anything to it, just cntrl F and replaced all. he wanted me to make the staff stuff for it also, but i will take his silence as he figured out how to get it on his own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...