<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/Math.percentProgress?action=history&amp;feed=atom</id>
	<title>Math.percentProgress - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/Math.percentProgress?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Math.percentProgress&amp;action=history"/>
	<updated>2026-05-02T12:45:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Math.percentProgress&amp;diff=72932&amp;oldid=prev</id>
		<title>Lettify: Created page with &quot;__NOTOC__ {{Useful Function}} This function returns a percentage progress from two specific values.&lt;br&gt;  ==Syntax== &lt;syntaxhighlight lang=&quot;lua&quot;&gt;float math.percentProgress(floa...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Math.percentProgress&amp;diff=72932&amp;oldid=prev"/>
		<updated>2021-10-19T21:02:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{Useful Function}} This function returns a percentage progress from two specific values.&amp;lt;br&amp;gt;  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float math.percentProgress(floa...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Useful Function}}&lt;br /&gt;
This function returns a percentage progress from two specific values.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;float math.percentProgress(float cur_value, float maxvalue [, int decimal])&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''cur_value''': The current value (Like '''480'''/1000).&lt;br /&gt;
* '''maxvalue''': The max value (Like 480/'''1000''').&lt;br /&gt;
* '''decimal''': How many decimal places the percentage will have at most. Default is 1.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function math.percentProgress(cur_value, maxvalue, decimal)&lt;br /&gt;
	cur_value, maxvalue, decimal = tonumber(cur_value), tonumber(maxvalue), decimal or 1&lt;br /&gt;
	if (cur_value and maxvalue) then&lt;br /&gt;
		local percent = tostring((cur_value/maxvalue)*100)&lt;br /&gt;
		return string.format('%.'..tostring(decimal)..'f%%', percent)&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example returns how is the current progress of a player do get max points.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local current_point = 150&lt;br /&gt;
local points_to_win = 500&lt;br /&gt;
local n = math.percentProgress(current_point, points_to_win, 0)&lt;br /&gt;
print('Your progress is', n) -- output: 30%&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;br /&gt;
&lt;br /&gt;
[[pt-br:Math.percentProgress]]&lt;/div&gt;</summary>
		<author><name>Lettify</name></author>
	</entry>
</feed>