Garry's Mod Wiki

Revision Difference

achievements.IsAchieved#567717

<function name="IsAchieved" parent="achievements" type="libraryfunc"> <description>Used in GMod 12 in the achievements menu to show the user if they have unlocked certain achievements.</description> <description>Returns whether the given achievement is obtained or not.</description> <realm>Client and Menu</realm> <args> <arg name="AchievementID" type="number">Internal Achievement ID number.</arg> <arg name="achievementID" type="number">The ID of the achievement.</arg> </args> <rets> <ret name="" type="boolean">Returns true if the given achievementID is achieved.</ret> <ret name="" type="boolean">The state.</ret> </rets> </function> <example> <description>Prints true if you got the achievement.</description> <code>print("Did you get achievement number 7?, " .. achievements.IsAchieved(7))</code>⤶ <output>boolean true (assuming you have unlocked achievement 7).</output>⤶ ⤶ </example> <description>Prints the current status for every your achievement into the console.</description> <code>⤶ for i = 1, achievements.Count() - 1 do⤶ print( achievements.GetName( i ), achievements.IsAchieved( i ) )⤶ end⤶ </code>⤶ </example>