Achievement System

Where are the files for the achievements for the menu on the main screen? Working on something similiar.


[lua]local ach = vgui.Create( “AchievementPanel” )[/lua]

Can I use this in my own Lua code? Perhaps somebody should make a wiki entry about it if so.

Like the actual achievements not the menu.

Nothing of that is really complicated, I think that most of it is is like:

if TimeSpentPlaying > OneDay then

Something like that. Really easy.

Ya for achievements it’s very simple. The system that i would do is like this. [lua]
function achSetUp(ply)
if ply:GetPData(“Exists”) == false then //Create a new player
ply:SetPData(“RDM”,false)//Sets RDM to false since the ply hasnt gotten it yet
ply:SetNWBool(“RDM”,false)//so that we can see clientside if the ply has gotten the achievment
//Add other achievments pdata
ply:SetPData(“Exists”,true)//Now we can start saving stats
print(“Player Created!”)//Some DeBug Code
else // load a players data
//do the same with other achievments
print(“Player Exists”)//Some more Debug
hook.Add( “PlayerSpawn”, “AchSetUp”, achSetUp )//Add a hook to PlayerSpawn

function RDM( victim, weapon, killer )//checks to see if the player has been killed
if victim:GetPData(“RDM”) == false then //check if player has unlocked this achievment already
victim:SetPData(“RDM”,true)//Set it to true to show that he got it
victim:SetNWBool(“RDM”,true)//Set it to true so clientside knows
hook.Add( “PlayerDeath”, “RDMHook”, RDM )
Then Client side make a derma menu that has shows witch achievements they have. Sorry for any typos that i might have.