
gurpreet
Members-
Posts
834 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by gurpreet
-
Next create a file called payupkeep.php and paste this in: <?php include "globals.php"; $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : ""; if(!$_GET['action']) { if($ir['upkeepowed'] == 0) { die("You do not have to pay off any upkeep. <br> <a href='index.php'>> Go home</a>"); $h->endpage(); } else { if($ir['upkeepowed'] > $ir['money']) { $upkeepdefault = $ir['money']; } else { $upkeepdefault = $ir['upkeepowed']; } echo " <h3>Paying off your upkeep</h3><br><br> You currently owe <span style=\"color:red;\">\$" . number_format($ir['upkeepowed']) . "</span>. How much would you like to pay off? <br> (You must have cash on hand to pay off your upkeep. Also, there is no confirmation so enter the correct amount) <br><br> <form action='payupkeep.php?action=payupkeep' method='post'> <input type='text' name='upkeepamount' value='$upkeepdefault' /><br> <input type='submit' value='Pay upkeep!' /><br>"; $h->endpage(); } } else { $_POST['upkeepamount'] = abs(@intval($_POST['upkeepamount'])); if($_GET['action'] == 'payupkeep') { if(!abs(@intval($_POST['upkeepamount']))) { die("You must enter a number<br> > <a href='payupkeep.php'>Back</a>"); $h->endpage(); } if($_POST['upkeepamount'] > $ir['money']) { die("You are trying to pay off more than you have!<br> > <a href='payupkeep.php'>Back</a>"); $h->endpage(); } if($_POST['upkeepamount'] > $ir['upkeepowed']) { die("Why would you want to pay off more upkeep than you owe?<br> > <a href='payupkeep.php'>Back</a>"); $h->endpage(); } if($_POST['upkeepamount'] == $ir['upkeepowed']) { $upkeepleft = ""; } else { $upkeepnum = $ir['upkeepowed'] - $_POST['upkeepamount']; $upkeepleft = "However, you still have to pay off <span style=\"color:red;\">\$" . number_format ($upkeepnum) . "</span>"; } $db->query("UPDATE users SET upkeepowed = upkeepowed - {$_POST['upkeepamount']} WHERE userid = {$ir['userid']}"); $db->query("UPDATE users SET money = money - {$_POST['upkeepamount']} WHERE userid = {$ir['userid']}"); echo "You have paid off <span style=\"color:green;\">\$" . number_format($_POST['upkeepamount']) . "</span>. $upkeepleft"; $h->endpage(); } } ?> Next go to your index.php and add this: $rem = $db->query("SELECT i.itmid, i.upkeep, inv.*, u.userid, u.upkeepowed FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid WHERE userid = {$ir['userid']}"); while($remove = mysql_fetch_array($rem)) { if(isset($remove['upkeep'])) { $new_upkeep += $remove['upkeep']; } } if($ir['upkeepowed'] > 0) { $upkeepowe = "(<strong><a href='payupkeep.php'>Pay Off Upkeep</a></strong>)"; } else { $upkeepowe = ""; } Then display it like this: <strong><a href='?upkeep'>Upkeep:</a></strong> <span style=color:red;>\$" . number_format($new_upkeep) . "</span> $upkeepowe<br /> Finally open your cron_day.php and put this just before ?> $upkeepcheck = $db->query("SELECT i.itmid, i.upkeep, inv . * , u.userid, u.will, u.maxwill, u.upkeepowed, u.money, h.hPRICE, hWILL FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid LEFT JOIN houses h ON h.hWILL = u.maxwill WHERE i.upkeep >0"); $q5 = $db->query("SELECT * FROM settings WHERE conf_name = 'upkeep'"); while($upkeep=mysql_fetch_array($upkeepcheck)) { $upkeep1=mysql_fetch_array($q5); if($upkeep['money'] > $upkeep['upkeep']) { $db->query("UPDATE users SET money = money - {$upkeep['upkeep']} WHERE userid = {$upkeep['userid']}"); } else if($upkeep['upkeep'] > $upkeep['money']) { $db->query("UPDATE users SET upkeepowed = upkeepowed + {$upkeep['upkeep']} WHERE userid = {$upkeep['userid']}"); } if($upkeep1['conf_value'] == 'Stackup') { if($upkeep['upkeepowed'] > $upkeep['hPRICE']) { $db->query("UPDATE users SET will=100,maxwill=100 WHERE userid = {$upkeep['userid']}"); $db->query("UPDATE users SET upkeepowed = 0 WHERE userid = {$upkeep['userid']}"); event_add($upkeep['userid'], "You haven't paid your upkeep, so your house has been taken away. Next time sell some weapons or earn some more money to pay your upkeep!", $c); } else { $rem = $db->query("SELECT i.itmid, i.upkeep, inv.*, u.userid, u.upkeepowed FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid WHERE userid = {$upkeep['userid']}"); $remove = mysql_fetch_array($rem); if(isset($remove['upkeep'])) { $new_upkeep += $remove['upkeep']; $db->query("UPDATE users SET upkeepowed = upkeepowed + $new_upkeep WHERE userid = {$upkeep ['userid']}"); event_add($upkeep['userid'], "You did not have enough money to pay your upkeep, so it has been added to your owed amount. Pay this off as soon as possible or you may lose your house as collateral!", $c); } } } else if($upkeep1['conf_value'] == 'RemoveItems') { $rem = $db->query("SELECT i.itmid, i.upkeep, inv.*, u.userid, u.money, u.upkeepowed FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid WHERE userid = {$upkeep['userid']}"); $remove = mysql_fetch_array($rem); if(isset($remove['upkeep'])) { $new_upkeep += $remove['upkeep']; if($remove['upkeep'] > $remove['money']) { //Not sure how to total up the users' item value to the amount of $new_upkeep and only remove that much, if anyone can help with this part I'd appreciate it. } } } } Once again, if someone can help fix this up and help me with the last part a few lines above this I would be very grateful.
-
Hey guys, I've been working on an upkeep mod for a while, but I've hardly been at it because I started my new job and it's killed me. This mod currently doesn't work properly, but sadly I can't point out what is wrong because I don't have the time or the attention needed to check through. The main problem is noted by // in the last part of the cron_day. I'd like to thank the IRC guys for helping me - Dominion, Nickson, Pitch_Black and Zanyx for their input for ideas and helping me fix a few bugs Run these queries: ALTER TABLE items ADD upkeep int(11) AFTER itmsellprice INSERT INTO `settings` ( `conf_id` , `conf_name` , `conf_value` ) VALUES ( NULL , 'upkeep', 'StackUp' ALTER TABLE users ADD upkeepowed int(11) NOT NULL DEFAULT 0; Open up staff_items.php and find: Item Sell Value: <input type='text' name='itmsellprice' value='{$itemi['itmsellprice']}' /> After add: Item Upkeep: <input type='text' name='upkeep' value='{$itemi['upkeep']}' /> Next find: $itmname=mysql_real_escape_string($_POST['itmname']); or $itmname=$_POST['itmname']; After add: $_POST['upkeep'] = abs(@intval($_POST['upkeep'])); Next find: $m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, 0)"); And replace it with: $m=$db->query("INSERT INTO items VALUES('{$_POST['itmid']}',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},{$_POST['upkeep']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, 0)"); Save that and close. Next open up inventory.php and find: <td class=\"h\">Total Sell Value</td> After that add: <td class=\"h\"><a href='?upkeep'>Upkeep</a></td> Find: if ($i['inv_qty'] > 1) { After that add: $i['upkeep'] = isset($i['upkeep']) ? $i['upkeep'] : 0; $i['upkeep'] = ($i['upkeep'] * $i['inv_qty']); Next find: print "$".($i['itmsellprice']*$i['inv_qty']); After add: print "</td><td>\$" . number_format($i['upkeep']) . ""; Save that and close. Next open up header.php and find: die ("<body>Your account may be broken. Please mail help@{$domain} stating your username and player ID."); } After add: if(isset($_GET['upkeep'])) { echo '<script language="javascript">alert("Upkeep is required for more expensive items, because they may break or lose power. Upkeep is automatically taken from you and will keep your items working properly.");</script>'; } Save that and close. Next open up staff.php and find: Will Potion Item: ".item_dropdown($c, "willp_item", $set['willp_item'])."<br /> Add after: Upkeep: <br /> Remove items<input type='radio' name='upkeep' value='RemoveItems' /> <br /> Stack up costs<input type='radio' name='upkeep' value='StackUp' /><br /> Check the next post for the next part.
-
You could at least attempt to make this? If you're willing to put no effort into it then be ready to pay someone.
-
Exactly what I was thinking.
-
Bump. /Msg2short
-
Maybe you could show some code? Maybe part of your index or your header so we can see how different it is?
-
Dbeckerton I suggest you switch host, it takes like a minute or so per page load.
-
Hi ajack38, Make sure to use [ code] tags or [ php] tags. I'll give you a hint on your errors. Fixing the line 14 error will produce many more. On line 11 note that it says print ". If the quotes are ", inside the speech marks or double quotes need to be single, or an error will appear. You can escape these quotes with \ or change them to '. Like so, here's line 11-15 print "<b>Criminal Centre</b><br /> <tbody><tr> <td bgcolor='#999999' colspan='3'><div align='center'><strong>Crime</strong></div></td> </tr> <tr bgcolor='#DFDFDF' onmouseover=\"this.style.background='#AABBCC';this. style.cursor='pointer'\" ;='' onmouseout=\"this.style.background='#DFDFDF'\" onclick=\"document.getElementById('1').checked=true ; document.crimes.submit();\" style=\"cursor: pointer; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(223, 223, 223); background-position: initial initial; background-repeat: initial initial; \"> Not sure if that will work but its 3:30 am so try it, and it should be ok
-
accept goods sent instead of just auto accept
gurpreet replied to marvin's topic in General Discussion
As I said, it's not fully functioning... They can reject it by clicking the decline link, but I haven't coded that part up. I was still working on the accept when I got stuck. I may continue this over the weekend and attempt to get it fully working. I used someone else's suggestion (I think it was Dominion or Nickson) where the original sender keeps the item until it is accepted/declined. This way if someone sends it, it won't just get stuck. As soon as it's accepted, the sender would lose the item and it would go to the receiver. -
Basically certain items, mostly expensive weapons/armours will have 'upkeep'. This is like tax, but for items. Basically something to keep the economy stable so the rich guys will have to pay some stuff, instead of getting richer and richer. It turned out to be much larger than I thought though
-
Users found how to attack others from any location.
gurpreet replied to Hendrickson's topic in Modification Support
Always read through everything people send, and just say no then, and find someone more reliable. There's plenty of people here who are recognised for making quality mods. Just spend some time looking around and it'll be worth it.l -
Bump Msg2short
-
accept goods sent instead of just auto accept
gurpreet replied to marvin's topic in General Discussion
Yep, log into PHPMyAdmin, and select the SQL tab, then just copy and paste those queries -
Users found how to attack others from any location.
gurpreet replied to Hendrickson's topic in Modification Support
If someone asks for your FTP/Cpanel tell them no? They can make the files that are necessary and send the altered files to you -
accept goods sent instead of just auto accept
gurpreet replied to marvin's topic in General Discussion
I tried posting yesterday, seems T-Mobile's internet is total crap. Try running these queries: ALTER TABLE inventory ADD pending int(11); ALTER TABLE inventory ADD pending_amount int(11); -
So did you find out the problem?
-
This may sound stupid, but have you made sure your register page sends a $_POST['ref'] and not something like $_POST['referal']
-
Users found how to attack others from any location.
gurpreet replied to Hendrickson's topic in Modification Support
The game runs on 'this coding stuff' so if you have no clue, why spend $200 or whatever on a game? hmm.. -
Users found how to attack others from any location.
gurpreet replied to Hendrickson's topic in Modification Support
At least give it an attempt? Here's a hint: $ir['location'] -
I posted this a while back, but I guess nobody saw it This is really good for learning but it is quite limited
-
accept goods sent instead of just auto accept
gurpreet replied to marvin's topic in General Discussion
That means you haven't run the queries to add them. Run these Alter table inventory add pending int(11) Alter table inventory add pending_amount int(11) -
Hey everyone, I am currently trying to an upkeep mod for the community as a free mod, and it's quite complex (i think it is). So I'm having a bit of trouble with the last bit, which is the daily cron. I was wondering if there is a better way to do the code I have. Also I know the RemoveItems part is not complete. I want to keep this code as efficient as possible because I'm fixing up my cron_day, which takes 20 seconds to load! However, there are a few problems, the main one being that the upkeepowed does not get updated. I have my setting set to StackUp and I've set my upkeep to 150,000. If someone can help with that, it would be great. If needed I can post up other pages and such. Anyway here's what I've got so far: $upkeepcheck = $db->query("SELECT i.itmid, i.upkeep, inv . * , u.userid, u.will, u.maxwill, u.upkeepowed, u.money, h.hPRICE, hWILL FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid LEFT JOIN houses h ON h.hWILL = u.maxwill WHERE i.upkeep >0"); $q5 = $db->query("SELECT * FROM settings WHERE conf_name = 'upkeep'"); while($upkeep=mysql_fetch_array($upkeepcheck)) { while($upkeep1=mysql_fetch_array($q5)) { if($upkeep['money'] > $upkeep['upkeep']) { $db->query("UPDATE users SET money = money - {$upkeep['upkeep']} WHERE userid = {$upkeep['userid']}"); } else if($upkeep['upkeep'] > $upkeep['money']) { $db->query("UPDATE users SET upkeepowed = upkeepowed + {$upkeep['upkeep']} WHERE userid = {$upkeep['userid']}"); } if($upkeep1['conf_value'] == 'Stackup') { if($upkeep['upkeepowed'] > $upkeep['hPRICE']) { $db->query("UPDATE users SET will=100,maxwill=100 WHERE userid = {$upkeep['userid']}"); $db->query("UPDATE users SET upkeepowed = 0 WHERE userid = {$upkeep['userid']}"); event_add($upkeep['userid'], "You haven't paid your upkeep, so your house has been taken away. Next time sell some weapons or earn some more money to pay your upkeep!", $c); } else { $rem = $db->query("SELECT i.itmid, i.upkeep, inv.*, u.userid, u.upkeepowed FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid WHERE userid = {$upkeep['userid']}"); $remove = mysql_fetch_array($rem); if(isset($remove['upkeep'])) { $new_upkeep += $remove['upkeep']; $db->query("UPDATE users SET upkeepowed = upkeepowed + $new_upkeep WHERE userid = {$upkeep['userid']}"); } } } else if($upkeep1['conf_value'] == 'RemoveItems') { $rem = $db->query("SELECT i.itmid, i.upkeep, inv.*, u.userid, u.upkeepowed FROM items i LEFT JOIN inventory inv ON inv.inv_itemid = i.itmid LEFT JOIN users u ON inv.inv_userid = u.userid WHERE userid = {$upkeep['userid']}"); $remove = mysql_fetch_array($rem); if(isset($remove['upkeep'])) { $new_upkeep += $remove['upkeep']; //More code is going here } } } }
-
Paid mod. Limit donator and normal bank account interest
gurpreet replied to Hendrickson's topic in Requests & In Production
What do you mean by: On your last amount would you not have to set that to include the interest given for one time ... otherwise they would never get the interest. -
Paid mod. Limit donator and normal bank account interest
gurpreet replied to Hendrickson's topic in Requests & In Production
That's a simple edit as chicka said, and it is just editing your cron_day. Find your queries to update bank interest and just add a where like this: $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/100*2) WHERE bankmoney>0 AND bankmoney<20000000"); -
Paid mod. Limit donator and normal bank account interest
gurpreet replied to Hendrickson's topic in Requests & In Production
I think he means the total a user can have in their bank must be set. Something like this: if(($_POST['deposit'] + $ir['bankmoney']) > 1000000000) { die("Your requested deposit exceeds the maximum amount allowed."); }