Raised This Month: $ Target: $400
 0% 

[ Solved ] While ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Ex1ne
Senior Member
Join Date: Oct 2011
Location: Norway
Old 05-12-2012 , 18:21   Re: While ?
Reply With Quote #2

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 
hoursminutes // 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(idprint_chat"You have played %i hours, %i minutes & %i seconds"hoursminutesseconds// print it

__________________
Ex1ne is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode