Raised This Month: $51 Target: $400
 12% 

[STOCK] NumberToMonth


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

NumberToMonth(number)
Return number to month!

PHP Code:
stock NumberToMonth(number)
{
        new 
ertek[11]
        switch(
number)
        {
            case 
1ertek "January";
            case 
2ertek "February";
            case 
3ertek "March";
            case 
4ertek "April";
            case 
5ertek "May";
            case 
6ertek "June";
            case 
7ertek "July";
            case 
8ertek "August";
            case 
9ertek "September";
            case 
10ertek "October";
            case 
11ertek "November";
            case 
12ertek "December";
            default: 
ertek "Invalid";
        }
        return 
ertek


Example plugin:
PHP Code:
#include <amxmodx>
#include <numbertomonth>

#define PLUGIN    "Test"
#define AUTHOR    "Kiki33"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""testfgv")
}

public 
testfgv(id)
{    
    if(
is_user_connected(id))
    {
        new 
yearmonthday;
        
date(yearmonthday);
        
client_print(idprint_chat"Current year:%d, Current month:%s, Current Day:%d"yearNumberToMonth(month), day)
    }

Attached Files
File Type: inc numbertomonth.inc (658 Bytes, 256 views)
__________________

Last edited by kiki33hun; 05-08-2012 at 02:24.
kiki33hun is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-06-2012 , 07:28   Re: [STOCK] NumberToMonth
Reply With Quote #2

When you include a function inside a plugin, remove "stock".
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-06-2012 , 07:37   Re: [STOCK] NumberToMonth
Reply With Quote #3

I also don't get the point of a stock for this

PHP Code:

new const Month_Name[13][] = {
    
"Invalid",
    
"January"
    
"February"
    
"March"
    
"April"
    
"May"
    
"June"
    
"July"
    
"August"
    
"September"
    
"October"
    
"November"
    
"December"

Just add that, and use 'Month_Name[ Month ]' ?
__________________
Retired.
Xalus is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 05-06-2012 , 08:25   Re: [STOCK] NumberToMonth
Reply With Quote #4

un-test code.
clear right ?
Code:
stock NumberToMonth(month, &szMonth[] = "", len) {     new const Month_Name[12][] = {         "January",         "February",         "March",         "April",         "May",         "June",         "July",         "August",         "September",         "October",         "November",         "December"     };       for (new i = 0; i < 12; i++)     {         if (i == (month-1))         {            copy(szMonth, len, Month_Name[i]);            break;         }     } }
__________________
QQ:116268742

Last edited by K.K.Lv; 05-06-2012 at 08:27.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-06-2012 , 09:59   Re: [STOCK] NumberToMonth
Reply With Quote #5

PHP Code:
/Suicide 
__________________
Retired.
Xalus is offline
Lt.RAT
Member
Join Date: Sep 2008
Location: Russia Yekaterinburg
Old 05-06-2012 , 12:10   Re: [STOCK] NumberToMonth
Reply With Quote #6

PHP Code:
#define NumberToMonth(%1) MonthName[%1]
stock const MonthName[13][] = 
{
    
"None",
    
"January"
    
"February"
    
"March"
    
"April"
    
"May"
    
"June"
    
"July"
    
"August"
    
"September"
    
"October"
    
"November"
    
"December"
}; 
Lt.RAT is offline
Send a message via ICQ to Lt.RAT
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-06-2012 , 12:21   Re: [STOCK] NumberToMonth
Reply With Quote #7

Code:
new szMonth[10];
format_time( szMonth, charsmax(szMonth), "%B", .time = -1 );
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 05-07-2012 , 02:23   Re: [STOCK] NumberToMonth
Reply With Quote #8

Quote:
Originally Posted by Emp` View Post
Code:
new szMonth[10];
format_time( szMonth, charsmax(szMonth), "%B", .time = -1 );

Yes, but it allows other languages​​!
__________________
kiki33hun is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-07-2012 , 11:39   Re: [STOCK] NumberToMonth
Reply With Quote #9

Where are those languages ??
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-07-2012 , 11:46   Re: [STOCK] NumberToMonth
Reply With Quote #10

Your code should be in English.
__________________
fysiks 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 16:09.


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