Raised This Month: $ Target: $400
 0% 

[STOCK] CalculateAge


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 05-08-2012 , 13:48   [STOCK] CalculateAge
Reply With Quote #1

Return age!

Usage: CalculateAge(year, month, day), example: CalculateAge( 1990, 05, 08 )

Code:
stock CalculateAge(year, month, day) {     new currentyear, currentmonth, currentday, age;     date(currentyear, currentmonth, currentday);     age = currentyear - year;     if(currentmonth < month || currentmonth == month && currentday < day) age--;     return (age >= 0 && day != 0 && month != 0 && day < 32 && month < 13 && year < currentyear+1) ? age : -1; }

Example Plugin:

PHP Code:
#include <amxmodx>
#include <calculateage>

public plugin_init()
{
    
register_plugin("Age Stock Test""0.1""kiki33")
    
register_clcmd("get_age""get_your_age"ADMIN_ALL"<birthyear> <birthmonth> <birthday>")
}

public 
get_your_age(id)
{
        static 
Arg[5], Arg2[3], Arg3[3];
        
read_argv(1Arg4);
        
read_argv(2Arg22);
        
read_argv(3Arg32);
        
        if(!
Arg[1] || !Arg2[1]  || !Arg3[1] ) return 1;
        
        new 
age CalculateAge(str_to_num(Arg), str_to_num(Arg2), str_to_num(Arg3));
        
        
client_print(idprint_chat"Your Age: %d"age);
        
        return 
1;

Attached Files
File Type: inc calculateage.inc (368 Bytes, 152 views)
__________________
kiki33hun is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 05-09-2012 , 07:36   Re: [STOCK] CalculateAge
Reply With Quote #2

Useless.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Reply



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 10:31.


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