Jump to content
MakeWebGames

Requesting - [Mccodes V2} Shared house mod


vampireduff

Recommended Posts

Re: Requesting - [Mccodes V2} Shared house mod

I am not too sure whether this will work,

I found a little bit of code laying around on my computer,

Perhaps with a little modification it might work

Shared housing

 

SQL Data:

 

ALTER TABLE users ADD shared text NOT NULL DEFAULT 'none';

 

Add into header.php:

 

if($ir['married']) {

  $do_1 = mysql_query("SELECT * FROM users WHERE userid={$ir['married']}");
  $r = $db->fetch_row($do_1);

  if($r['maxwill'] > $ir['maxwill']) {

     $db->query("UPDATE users SET shared = maxwill, maxwill = {$r['maxwill']} WHERE userid = $userid");
     $db->query("UPDATE users SET shared = 'owner' WHERE userid = {$ir['married']}");

  } else if($ir['maxwill'] > $r['maxwill']) {

     $db->query("UPDATE users SET shared = maxwill, maxwill = {$ir['maxwill']} WHERE userid = {$ir['married']}");
     $db->query("UPDATE users SET shared = 'owner' WHERE userid = $userid");

  } else {

     $db->query("UPDATE users SET shared = 'owner' WHERE userid = {$ir['married']}");
     $db->query("UPDATE users SET shared = 'owner' WHERE userid = $userid");

  }
}

 

Add into viewuser.php:

 

if($r['shared'] != 'none') {

print "Property: {$r['hNAME']} [with: [url='viewuser.php?u={$ma[']{$ma['username']}[/url]]
";

} else {

print "Property: {$r['hNAME']}
";

}

 

Then add into the divorce section:

 

$db->query("UPDATE users SET maxwill = shared, shared = 0 WHERE shared != 'owner' AND userid = {$ir['married']}");
$db->query("UPDATE users SET maxwill = shared, shared = 0 WHERE shared != 'owner' AND userid = $userid");

 

Then in the sell function of estate.php add:

 

if($ir['married'] AND ($ir['shared'] != 'owner')) {

print "You are living in your partner\'s house at this time, it cannot be sold.";
$h->endpage();
exit;

}
Link to comment
Share on other sites

Re: Requesting - [Mccodes V2} Shared house mod

i am using the multiple properties mod by richard and i tryed to place this bit of code in but it sets both player that are married as owners and no of them can sell the house so does anyone now how this code would be placed so it allows the owner to market the house if he wants and the spouse to only move in not market the house.

 

if($ir['married'] AND ($ir['shared'] != 'owner')) {

print "You are living in your partner\'s house at this time, it cannot be sold.";
$h->endpage();
exit;

} 

 

<?php
include "globals.php";
print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Your Properties</font><hr width=75%>";
switch($_GET['action'])
{
case 'market':
market_house();
break;

case 'give':
send_house();
break;

case 'move':
move_house();
break;

default:
your_houses();
break;
}
function your_houses()
{
global $db,$ir,$c,$userid,$h;
$q=$db->query("SELECT pr.*,h.* FROM properties pr LEFT JOIN houses h ON pr.prHOUSE=h.hID WHERE pr.prOWNER={$userid} ORDER BY h.hPRICE ASC",$c);
if ($db->num_rows($q) == 0)
{
print "You have no houses.";
}
else
{
print "<table width=60% cellspacing=1>";
while($r=$db->fetch_row($q))
{
print "<tr>";
$dfi=$db->query("SELECT * FROM users WHERE userid={$r['prOWNER']}",$c);
$tb=$db->fetch_row($dfi);
print "<td valign='center'>
[b]Property: [/b]{$r['hNAME']}

[b]Owner: [/b][url='viewuser.php?u={$tb[']{$tb['username']}[/url]

[b]Will: [/b]{$r['hWILL']}</td>
<td align='center'>
[[url='properties.php?action=move&ID={$r[']Move In[/url]]
";
$yd=$db->query("SELECT * FROM rentals WHERE reRENTER=$userid AND rePID={$r['prID']}",$c);
$zf=$db->fetch_row($yd);
$tr=$db->num_rows($yd);
if ($r['hWILL'] != '100' && $tr == '0')
{
print "
[[url='properties.php?action=market&ID={$r[']Market[/url]]

[[url='properties.php?action=give&ID={$r[']Give[/url]]
";
}
$zf=$db->fetch_row($yd);
$tr=$db->num_rows($yd);
if ($tr)
{
print "[[url='properties.php?action=return&ID={$r[']Return[/url]]
";
}
$hprice=money_formatter($r['hPRICE']);
print "</tr><tr><td height='10'></td></tr>";
}
print "</table>
";
}
}
function send_house()
{
global $db,$ir,$c,$userid,$h;
$_GET['ID'] = abs((int) $_GET['ID']);
$yd=$db->query("SELECT * FROM rentals WHERE reRENTER=$userid AND rePID={$_GET['ID']}",$c);
$zf=$db->fetch_row($yd);
$tr=$db->num_rows($yd);
if ($tr)
{
die ("

This house has been rented!

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>
");
}
if($_POST['user'])
{
$q=$db->query("SELECT pr.*,h.* FROM properties pr LEFT JOIN houses h ON pr.prHOUSE=h.hID WHERE pr.prID={$_GET['ID']} AND pr.prOWNER=$userid LIMIT 1",$c);
if($db->num_rows($q)==0)
{
print "
Invalid house ID

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$r=$db->fetch_row($q);
$m=$db->query("SELECT * FROM users WHERE userid={$_POST['user']} LIMIT 1",$c);
if($db->num_rows($m) == 0)
{
print "
You are trying to send to an invalid user!

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else if (!$_GET['ID'])
{
print "
This user does not exist.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$rm=$db->fetch_row($m);
$db->query("UPDATE properties SET prOWNER={$_POST['user']} WHERE prID={$_GET['ID']}",$c);
}
print "
You sent the {$r['hNAME']} to {$rm['username']}.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
event_add($_POST['user'],"You received the {$r['hNAME']} from [url='viewuser.php?u=$userid']{$ir['username']}[/url]",$c,'transfer');
}
}
else if($_GET['ID'])
{
$id=$db->query("SELECT pr.*,h.* FROM properties pr LEFT JOIN houses h ON pr.prHOUSE=h.hID WHERE pr.prID={$_GET['ID']} AND pr.prOWNER=$userid LIMIT 1",$c);
if($db->num_rows($id)==0)
{
print "
Invalid house ID.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else if ($_GET['ID']==0)
{
print "
This user does not exist.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$r=$db->fetch_row($id);
print "
[b]Enter the ID of the user you want to give the {$r['hNAME']} to.[/b]

<form action='properties.php?action=give&ID={$_GET['ID']}' method='post'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />User ID: <input type='text' name='user' value='' />

<input type='submit' value='Give House' /></form>

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
}
else
{
print "
Invalid use of file.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
}
function market_house()
{
global $db,$ir,$c,$userid,$h;
$_GET['ID'] = abs((int) $_GET['ID']);
$yd=$db->query("SELECT * FROM rentals WHERE reRENTER=$userid AND rePID={$_GET['ID']}",$c);
$zf=$db->fetch_row($yd);
$tr=$db->num_rows($yd);
if ($tr)
{
die ("

This house has been rented!

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>
");
}
$_POST['price'] = abs((int) $_POST['price']);
if($_POST['price'])
{
$q=$db->query("SELECT pr.*,h.* FROM properties pr LEFT JOIN houses h ON pr.prHOUSE=h.hID WHERE prID={$_GET['ID']} and prOWNER=$userid",$c);
if($db->num_rows($q)==0)
{
print "
Invalid House ID

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$r=$db->fetch_row($q);
$db->query("INSERT INTO propertymarket VALUES ('','$userid',{$_POST['price']},'{$r['hID']}')", $c);
$db->query("DELETE FROM properties WHERE prID={$_GET['ID']}",$c);
print "
House added to market.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
}
else
{
$q=$db->query("SELECT * FROM properties WHERE prID={$_GET['ID']} and prOWNER=$userid",$c);
if($db->num_rows($q)==0)
{
print "
Invalid House ID

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$r=$db->fetch_row($q);
print "
Adding a house to the property market...
<form action='properties.php?action=market&ID={$_GET['ID']}' method='post'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />
Price: <input type='text' name='price' value='0' />

<input type='submit' value='Add' /></form>


<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
}
}
function move_house()
{
global $db,$ir,$c,$userid,$h;
$_GET['ID'] = abs((int) $_GET['ID']);
$q=$db->query("SELECT pr.*,h.* FROM properties pr LEFT JOIN houses h ON pr.prHOUSE=h.hID WHERE pr.prID={$_GET['ID']} AND pr.prOWNER=$userid LIMIT 1",$c);
$r=$db->fetch_row($q);
if ($r['prOWNER'] != $ir['userid'])
{
print "
This house does not belong to you.

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
}
else
{
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}",$c);
$mp=$db->fetch_row($mpq);
print "
You moved into your {$r['hNAME']}!

<hr width=75%>> [url='properties.php']Back[/url]<hr width=75%>";
$db->query("INSERT INTO `properties` (`prID`, `prOWNER`, `prHOUSE`) VALUES
('', '$userid', '{$mp['hID']}');",$c);
$db->query("UPDATE users SET maxwill={$r['hWILL']},will=0 WHERE userid=$userid",$c);
$db->query("DELETE FROM properties WHERE prID={$_GET['ID']}",$c);
}
}
$h->endpage();
?> 
Link to comment
Share on other sites

Re: Requesting - [Mccodes V2} Shared house mod

I added the codes to where they had to go, but I get this error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/purgato1/public_html/viewuser.php on line 235

this is the code on line 235:

if($r['shared'] != 'none') {

and here is a part of the full code:

[b]Partner:[/b]  ";
if($ir['married'] > 0)
{
$spouseq=$db->query("SELECT username FROM users WHERE userid = {$r['married']}");
$spouse=$db->fetch_row($spouceq);	
print "[url='viewuser.php?u={$r[']<font color='green'>[b]{$spouse['username']}[/b]</font>[/url]
";
}
else
{
print "<font color=red>None</font>
";
} 
print "
</td>
<td>
[b]Location:[/b] [url='airport.php']{$r['cityname']}[/url]
{$r['citypic']}";
</td></tr>

<tr><td>
[b]Money:[/b] \${$r['money']}

</td>
<td>
if($r['shared'] != 'none') {

print "Property: {$r['hNAME']} [with: [url='viewuser.php?u={$ma[']{$ma['username']}[/url]]
";

} else {

print "Property: {$r['hNAME']}
";

}
{$r['hIMAGE']}
</td></tr>";

 

can anyone tell me how to fix this please :)

Link to comment
Share on other sites

Re: Requesting - [Mccodes V2} Shared house mod

Try

 

<?php //REMOVE!
[b]Partner:[/b]  ";
if($ir['married'] > 0)
{
  $spouseq=$db->query("SELECT username FROM users WHERE userid = {$r['married']}");
  $spouse=$db->fetch_row($spouceq);   
  print "[url='viewuser.php?u={$r[']<font color='green'>[b]{$spouse['username']}[/b]</font>[/url]
";
}
else
{
  print "<font color=red>None</font>
";
}
print "
</td>
<td>
[b]Location:[/b] [url='airport.php']{$r['cityname']}[/url]
{$r['citypic']}";
</td></tr>

<tr><td>
[b]Money:[/b] \${$r['money']}

</td>
<td>
if($r['shared'] != none) {

print "Property: {$r['hNAME']} [with: [url='viewuser.php?u={$ma[']{$ma['username']}[/url]]
";

} else {

print "Property: {$r['hNAME']}
";

}
{$r['hIMAGE']}
</td></tr>";
?> //REMOVE
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Re: Requesting - [Mccodes V2} Shared house mod

 

it works but theres problem

when u marry someone there <censored> house get replaced with your good one but when u divorce them they dont get there original house they still have the good house

that would be a simple fix just mess around with querys a bit

Link to comment
Share on other sites

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...