16.03.2016, 00:50
Here, calculate your sales with this simple pawn code/snippet 
Lets calculate a simple GTX 970M:
Original Price: 455
Hours Bought: 8760 (1 year)
Hours Used: 1460 (2 months)
Current Quality: 70%
Output:

pawn Код:
// Credits: Gammix
stock Float:ReturnSaleValue(Float:actual_price, Float:hours_bought, Float:hours_used, Float:quality, Float:rate_of_hours = 0.75, Float:rate_of_usage = 0.3)
{
new Float:used = (((1.0 - (hours_used / hours_bought)) * rate_of_hours) - (hours_used / hours_bought));
if (used < 0.0)
used *= -1;
new Float:deduct[2];
deduct[0] = ((actual_price * ((used <= 0.0) ? (1.0) : (used))) * rate_of_usage);
deduct[1] = (actual_price - (quality * (actual_price / 100.0)));
return (actual_price - (deduct[0] + deduct[1]));
}
Original Price: 455
Hours Bought: 8760 (1 year)
Hours Used: 1460 (2 months)
Current Quality: 70%
Код:
printf("GTX 970M would sale best at %f!", ReturnSaleValue(455, 8760, 1460, 70));
Quote:
|
GTX 970M would sale best at 238.875000! |

