• Play time help
    2 replies, posted
How would i go about getting how much time a user has played on the server. Im making a script where i want them to gain stat points every hour they have played. These stat points then can be used to improve skill levels and what not. But i just wanna know about the time issue.
When a player spawns ([URL="http://wiki.garrysmod.com/?title=Gamemode.PlayerInitialSpawn"]Gamemode.PlayerInitialSpawn[/URL]) simply set a variable pl.JoinTime = CurTime(). The current time played can then be easily calculated: pl.TimePlayed = CurTime() - pl.JoinTime
Hmmm i get it. What i can do is keep adding time in the sql database, and basically everytime they rejoin i get the current time and just add it to what they already got.
Sorry, you need to Log In to post a reply to this thread.