UPDATE player p JOIN garage g ON p.id = garage.owner JOIN car c ON c.id = garage.car SET p.money = p.money - c.rentrate, g.lastpaidrent = NOW() WHERE c.rented = '1' AND TIMESTAMPDIFF(HOUR, c.lastpaidrent, NOW()) >= 24 AND p.money >= c.rentrate
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)