Well, here's an example code used for my time played plugin, the variable is here an example.
I hope you learn something with this.
PHP Code:
#include <amxmodx>
#include <amxmisc>
new seconds = 530 // random time in seconds our "client" has spent on the server
public plugin_init()
{
register_clcmd( "say /time", "zaa" )
}
public zaa(id)
{
new hours, minutes // integer for hours & minutes
while( seconds >= 60 ) // This will continue to pass through untill variable: seconds, is under 60.
{
minutes++
seconds -= 60
}
while( minutes >= 60 ) // Same as above, only seconds -> minutes
{
hours++
minutes -= 60
}
client_print(id, print_chat, "You have played %i hours, %i minutes & %i seconds", hours, minutes, seconds) // print it
}
__________________