CREATE DEFINER=`uronicbhop_db`@`%` FUNCTION `GetRecordPoints` (`rstyle` INT, `rtrack` INT, `rtime` FLOAT, `rmap` CHAR(128), `pointspertier` FLOAT, `stylemultiplier` FLOAT) RETURNS FLOAT READS SQL DATA
BEGIN DECLARE pwr, ppoints FLOAT DEFAULT 0.0; DECLARE ptier INT DEFAULT 1; SELECT tier FROM maptiers WHERE map = rmap INTO ptier; SELECT MIN(time) FROM playertimes WHERE map = rmap AND style = rstyle AND track = rtrack INTO pwr; IF rtrack > 0 THEN SET ptier = 1; END IF; SET ppoints = ((pointspertier * ptier) * 1.5) + (pwr / 15.0); IF rtime > pwr THEN SET ppoints = ppoints * (pwr / rtime); END IF; SET ppoints = ppoints * stylemultiplier; IF rtrack > 0 THEN SET ppoints = ppoints * 0.25; END IF; RETURN ppoints; END
Unfortunately, you wouldn't be able to create things like definers or procedures on the webhosting, because it requires elevated permissions that we can't provide in shared environment. If your software requires these, you'd need to run a MySQL server on an unmanaged service, like a VDS.