Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[PHP]'Paid' per hour but.. [fixed]

Joined
Jul 26, 2006
Messages
3,627
Reaction score
1,006
Fixed it.

On my crime game ( ), you have the ability to hire windows (for hookers).
You get paid per hour for that.

My problem is:
I want to make that if you e.x instead of 1 hour, wait 5 hours, you get paid 5 times as much (because you waited 5 times as much).
I just keep getting stuck, I've tried atleast 4 methods now but I failed at it..

This script pays you per hour.
PHP:
$result = mysql_query("SELECT * FROM `users` WHERE `username` = '$_SESSION[user]' LIMIT 1");
$row = mysql_fetch_assoc($result);
$result2 = mysql_query("SELECT * FROM `city` WHERE `name` = '$row[city]' LIMIT 1");
$city = mysql_fetch_assoc($result2);
$time = time();
if ($row['whores'] > 0) {
$pc = round(($row['whores'] * $city['priceper']) / rand(7, 13)); 
$cash = $row['whores'] * $city['priceper'] + rand(1, $pc); //Amount of cash calculation.
$for  = $row['thetime'] + 3600; //1 hour from when you bought them.

if ($for <= $time) {
$whores = "Your whores brought you a total of: $". $cash ."!<br />[". date("d M, H:i:s") ."]";
$cor = mysql_query("UPDATE `users` SET `cash` = `cash` + '$cash', `msg` = '$whores' WHERE `username` = '$_SESSION[user]' LIMIT 1");
if (!$cor)
{
	die("Error[". mysql_errno() ."]: ". mysql_error());
}
$go = mysql_query("UPDATE `users` SET `thetime` = '$time' WHERE `username` = '$_SESSION[user]' LIMIT 1"); //Reset that var for more use
if (!$go)
{
	die("Error[". mysql_errno() ."]: ". mysql_error());
}
}
}

The $cash & $for need to be edited to work with more hours.

Any ideas?
 
Last edited:
Back
Top