Useful Functions

PHP Code:
stock IsVehicleInRangeOfPoint(vehicleidFloat:rangeFloat:xFloat:yFloat:z)
{
    new 
Float:x1,
        
Float:y1,
        
Float:z1;
    
CreateCircle(0xyzrange*0.01x1y1z1);
    
GetVehiclePos(vehicleidxyz);
    new 
Float:dist GetDistanceBetween2Points(xyzx1y1z1);
  
    if(
dist range
        return 
true;
    else
        return 
false;
}
stock GetNearestVehicleByCoord(Float:xFloat:yFloat:zFloat:precision 2.0)
{
    new    
vehicle INVALID_VEHICLE_ID;
    for(new 
i=1i<MAX_VEHICLESi++)
    {
        new 
Float:vehDist GetVehicleDistanceFromPoint(ixyz);
        if(
vehDist == 0.0)
        {
            if(
GetVehiclePoolSize()) return vehicle;
            else continue;
        }
        if(
vehDist precision) continue;
        else 
precision vehDistvehicle i;
    }
    return 
vehicle;
}
stock Float:GetDistanceBetween2Points(Float:x1Float:y1Float:z1Float:x2Float:y2Float:z2)
{
    return 
VectorSize(x1-x2y1-y2z1-z2);
}
CMD:exemple(playerid)
{
    new 
Float:x
        
Float:y,
        
Float:z;
    
    
GetVehiclePos(GetPlayerVehicleID(playerid), xyz);
    if(
IsVehicleInRangeOfPoint(110xyz)) 
        return 
SCM(playeridGREEN"In range!");
    else
        return 
SCM(playeridRED"Out of range");

Reply

Quote:
Originally Posted by Dayrion
View Post
PHP Code:
//CODE 
You should use natives because they are faster

IsVehicleInRangeOfPoint could be done with GetVehicleDistanceFromPoint
PHP Code:
#define IsVehicleInRangeOfPoint(%0,%1, %1 > GetVehicleDistanceFromPoint(%0, 
In GetNearestVehicleByCoord you use IsVehicleInRangeOfPoint three times, make use of an additional variable and call it only once
For GetDistanceBetween2Points use the native VectorSize
Reply

ReturnPhonetic
Returns NATO phonetic alphabet code word of a letter, d = delta for example. Might be useful for TDM servers.

Code:
static const
	NATOPhonetic[][9 char] = {
	//  https://en.wikipedia.org/wiki/NATO_phone...8.75376132	    !"Alfa", !"Bravo", !"Charlie", !"Delta", !"Echo",
		!"Foxtrot", !"Golf", !"Hotel", !"India", !"Juliett",
		!"Kilo", !"Lima", !"Mike", !"November", !"Oscar",
		!"Papa", !"Quebec", !"Romeo", !"Sierra", !"Tango",
		!"Uniform", !"Victor", !"Whiskey", !"X-ray", !"Yankee",
		!"Zulu"
	};

ReturnPhonetic(letter)
{
	new idx = toupper(letter) - 65, string[9];
	if(!(0 <= idx <= 25))
	{
		format(string, sizeof(string), "Invalid");
		return string;
	}

	strunpack(string, NATOPhonetic[idx], sizeof(string));
	return string;
}
Example:
Code:
new string[32];
format(string, sizeof(string), "We lost objective %s!", ReturnPhonetic('c'));
SendClientMessageToAll(-1, string);
// output: We lost objective Charlie!
Reply

Quote:
Originally Posted by Nero_3D
View Post
You should use natives because they are faster

IsVehicleInRangeOfPoint could be done with GetVehicleDistanceFromPoint
PHP Code:
#define IsVehicleInRangeOfPoint(%0,%1, %1 > GetVehicleDistanceFromPoint(%0, 
In GetNearestVehicleByCoord you use IsVehicleInRangeOfPoint three times, make use of an additional variable and call it only once
For GetDistanceBetween2Points use the native VectorSize
I didn't thought about this. '-'
Oh yes, you are right. I forgot to check if I used too many times a function without affect it in a variable. : x
Yep! Someone said it like 5 mins ago. I took the mathematic function so.. I didn't check about a function which returning the norm of a vector. :$
Thanks for your reply!
- Sorry for English mistakes :$
Reply

Back to school with this one ;p
PHP Code:
Float:EuclideanDivision(dividenddivisor, &rest, &Float:quotientprecision 5)
{
    new 
temp;
    
quotient dividend divisor;
    
rest dividend divisor;
    while(
rest != 0)
    {
        if(
temp++ > precision)
            break;
        
dividend *= 10;
        
quotient quotient + (dividend divisor) * 0.10;
        
rest dividend divisor;
    }
    return 
quotient;

Reply

Fixed split function:
In contrast to the original function (which had an issue with out of bounds of the array "destination", if the string "source" had delimiters more than an array size of "destination"), this function requires to specify two-dimensional array size of "destination". So it have two new arguments: destsize (the size of the first dimension), destlen (and second).
Code:
split(const source[], destination[][], delim, destsize, destlen)
{
	for(new i, li, aNum, len, s = strlen(source); i <= s && aNum < destsize; i++)
	{
		if(source[i] == delim || i == s)
		{
			len = strmid(destination[aNum], source, li, i, destlen);
			destination[aNum][len] = EOS;
			li = i + 1;
			aNum++;
		}
	}
	return 1;
}
Example:
Code:
new pos[3][9];
new strtmp[] = "1958.3783, 1343.1572, 15.3746 ||| Other s,t,u,f,f";
split(strtmp, pos, ',', sizeof pos, sizeof pos[]);
SetPlayerPos(playerid, floatstr(pos[0]), floatstr(pos[1]), floatstr(pos[2]));
Simple strfindchar functon:
This is faster than using strfind function, but only in case to search for a single character in the string.
It's useful only if you use this function in events that are often called (cycle, OnPlayerUpdate?) or for find a large number of single characters
Code:
strfindchar(const string[], sub)
{
	for(new i; string[i] != '\0'; i++)
	{
		if(string[i] == sub) return i;
	}
	return -1;
}
Example:
Code:
new strtmp[] = "Question?";
if(strfindchar(strtmp, '?') != -1) //Pay attention to '' (not "")
{
	print("Yes");
}
else print("No");
Reply

Who can make function laser point, how to get rotations rx,ry,rz for certain point?
Reply

Wrong place, this for posting functions not asking for them to be made...
Reply

Code:
bool: IsAParticle(objectid)
{
	if(objectid >= 18668 && objectid <= 18748)
		return true;
		
	return false;
}
This returns true if the object model is a particle and false if it isn't.
Reply

Quote:
Originally Posted by Abagail
View Post
Code:
bool: IsAParticle(objectid)
{
	if(objectid >= 18668 && objectid <= 18748)
		return true;
		
	return false;
}
This returns true if the object model is a particle and false if it isn't.
Simply :P
Code:
bool:IsAParticle(objectid)
	return objectid >= 18668 && objectid <= 18748 ? true : false;
Reply

Failing to outsmart someone. :')
PHP Code:
bool:IsAParticle(modelid)
    return (
18668 <= modelid <= 18748); 
Reply

@Dignity: 1D array would be enough:
pawn Код:
static const wepDataArray[] =
{
    331, 333, 334, 335, 336, 337, 338, 339, 341, 321,
    322, 323, 324, 325, 326, 342, 343, 344, 346, 347,
    348, 349, 350, 351, 352, 353, 355, 356, 372, 357,
    358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
    368, 369, 371
};
Reply

Quote:
Originally Posted by Dignity
Посмотреть сообщение
This probably isn't any better but it is more compact imo.

Код:
WeaponToModel ( wepid )  { 

    new wepDataArray [  ] [ ] = {
        { 331 } , { 333 } , { 334 } , { 335 } , { 336 } , { 337 } , { 338 } , { 339 } , { 341 } , { 321 } , 
        { 322 } , { 323 } , { 324 } , { 325 } , { 326 } , { 342 } , { 343 } , { 344 } , { 346 } , { 347 } , 
        { 348 } , { 349 } , { 350 } , { 351 } , { 352 } , { 353 } , { 355 } , { 356 } , { 372 } , { 357 } , 
        { 358 } , { 359 } , { 360 } , { 361 } , { 362 } , { 363 } , { 364 } , { 365 } , { 366 } , { 367 } , 
        { 368 } , { 369 } , { 371 }
    } ;
   
    if ( wepid > sizeof ( wepDataArray ) || wepid < sizeof ( wepDataArray ) ) return INVALID_OBJECT_ID ;

    return wepDataArray [ wepid ] [ 0 ] ; 
}
How exactly is this function going to return a model according to the condition you stated?
Reply

PHP код:
if ( wepid sizeof wepDataArray ) || wepid sizeof wepDataArray ) ) 
Haha, that's a run time there!
Reply

I should also mention that the array should either hold INVALID_WEAPON_ID over indexes : {19, 20, 21} or have a proper condition over them too. I believe it's always better to point out and give chances to fix than posting the fixed code here.
Reply

Since there's no update with the previous function, I'll post.

- GetWeaponModelByID(weaponid); : Returns the model ID of the weaponid given as argument. Returns -1 for invalid weaponid.

- GetWeaponIDByModel(weapon_model); : Returns the weapon ID of the weapon_model given as argument. Returns -1 for invalid weapon_model.
pawn Код:
new
    g_WeaponModels[] = {
   
        -1,
        331,
        333,
        334,
        335,
        336,
        337,
        338,
        339,
        341,
        321,
        322,
        323,
        324,
        325,
        326,
        342,
        343,
        344,
        -1,
        -1,
        -1,
        346,
        347,
        348,
        349,
        350,
        351,
        352,
        353,
        355,
        356,
        372,
        357,
        358,
        359,
        360,
        361,
        362,
        363,
        364,
        365,
        366,
        367,
        368,
        369,
        371
};

stock GetWeaponModelByID(weaponid) {

    if(weaponid < 0 || weaponid > sizeof(g_WeaponModels))
        return -1; //run time check
       
    return g_WeaponModels[weaponid];
}

stock GetWeaponIDByModel(weapon_model) {

    for(new i = 1; i< sizeof(g_WeaponModels); i++) {

        if(g_WeaponModels[i] == weapon_model)
            return i;
    }
    return -1;
}
Reply

I posted this function on this topic. Thought to post here as it might be useful for someone.

EDIT : If you're looking for a function that accepts any date-format and separator - http://forum.sa-mp.com/showpost.php?...postcount=4616

First version :

IsValidDate - Function returns true if the given date is valid, false if invalid.

Parameters
dStr - Date as string.
delim - Date separator. By default, it's '/'.
dFormat - Date format. By default, it's "ymd" (YYYY/MM/DD). (y = year, m = month, d = day)
size - Size of dStr (by default).

pawn Код:
stock bool:isValidDate(dStr[], delim = '/', dFormat[] = "ymd", size = sizeof(dStr)) {

    new
        monthDays[12] = {
            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
        },
        temp_Year,
        temp_Month,
        temp_Day,
        temp_Index  = 0,
        temp_Pos    = 0,
        temp_ePos   = 0,
        temp_shortStr[5]
    ;
    do {

        while(dStr[temp_ePos] != delim) {

            if(++temp_ePos >= size) {

                temp_ePos = size - 1;
                break;
            }
        }
        strmid(temp_shortStr, dStr, temp_Pos, temp_ePos, sizeof(temp_shortStr));
        temp_Pos = ++temp_ePos;

        switch(dFormat[temp_Index++]) {

            case 'm', 'M':
                temp_Month = strval(temp_shortStr);

            case 'd', 'D':
                temp_Day = strval(temp_shortStr);

            case 'y', 'Y':
                temp_Year = strval(temp_shortStr);

            default:
                return false;
        }
    }
    while(temp_Index < 3);

    if((temp_Year % 400) == 0 || ((temp_Year % 100) != 0 && (temp_Year % 4) == 0))
        monthDays[1] = 29;

    if(temp_Month < 1 || temp_Month > 12)
        return false;

    if(temp_Day < 1 || temp_Day > monthDays[temp_Month - 1])
        return false;

    return true;
}
Example code:
pawn Код:
public OnFilterScriptInit() {

    new date[15] = "06/29/2016"; //MM/DD/YYYY "mdy"
    printf("IsValid : %d",  isValidDate(date, '/', "mdy"));
    date = "29/02/2016"; //DD/MM/YYYY "dmy"
    printf("IsValid : %d",  isValidDate(date, '/', "dmy"));
    date = "2016/02/29"; //YYYY/MM/DD "ymd"
    printf("IsValid : %d",  isValidDate(date, '/', "ymd"));

    //invalid tests.
    //February doesn't have 29 days in 2017. So the further results should be 0.
    date = "02/29/2017"; //MM/DD/YYYY "mdy"
    printf("IsValid : %d",  isValidDate(date, '/', "mdy"));
    date = "29/02/2017"; //DD/MM/YYYY "dmy"
    printf("IsValid : %d",  isValidDate(date, '/', "dmy"));
    date = "2017/02/29"; //YYYY/MM/DD "ymd"
    printf("IsValid : %d",  isValidDate(date, '/', "ymd"));

    date = "01/32/2016"; //MM/DD/YYYY "mdy" //January doesn't have 32 days.
    printf("IsValid : %d", isValidDate(date, '/', "mdy"));

    return 1;
}
Second version :

This works similar to the first one, except that it does not have a delimiter parameter. It works with any separator, only the date-format has to be mentioned if it's different from YYYY/MM/DD.

pawn Код:
stock bool:isValidDate(dStr[], dFormat[] = "ymd", size = sizeof(dStr)) {

    new
        monthDays[12] = {
            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
        },
        temp_Year,
        temp_Month,
        temp_Day,
        temp_Index = 0,
        temp_Pos = 0,
        temp_ePos = 0,
        temp_shortStr[5]
    ;
    do {
   
        while(dStr[temp_ePos] >= 48 && dStr[temp_ePos] <= 57) {
       
            if(++temp_ePos >= size) {
           
                temp_ePos = size - 1;
                break;
            }
        }
        strmid(temp_shortStr, dStr, temp_Pos, temp_ePos, sizeof(temp_shortStr));
        temp_Pos = ++temp_ePos;

        switch(dFormat[temp_Index++]) {

            case 'm', 'M':
                temp_Month = strval(temp_shortStr);

            case 'd', 'D':
                temp_Day = strval(temp_shortStr);

            case 'y', 'Y':
                temp_Year = strval(temp_shortStr);

            default:
                return false;
        }
    }
    while(temp_Index < 3);

    if((temp_Year % 400) == 0 || ((temp_Year % 100) != 0 && (temp_Year % 4) == 0))
        monthDays[1] = 29;

    if(temp_Month < 1 || temp_Month > 12)
        return false;

    if(temp_Day < 1 || temp_Day > monthDays[temp_Month - 1])
        return false;

    return true;
}
Example for second version:
pawn Код:
//I'm testing on different date separators.
    new date[15] = "06.29.2016"; //MM/DD/YYYY "mdy"
    printf("IsValid : %d",  isValidDate(date, "mdy"));
    date = "29/02/2016"; //DD/MM/YYYY "dmy"
    printf("IsValid : %d",  isValidDate(date, "dmy"));
    date = "2016-02-29"; //YYYY/MM/DD "ymd"
    printf("IsValid : %d",  isValidDate(date, "ymd"));
   
    //invalid tests.
    //February doesn't have 29 days in 2017. So the further results should be 0.
    date = "02>29>2017"; //MM/DD/YYYY "mdy"
    printf("IsValid : %d",  isValidDate(date, "mdy"));
    date = "29!02!2017"; //DD/MM/YYYY "dmy"
    printf("IsValid : %d",  isValidDate(date, "dmy"));
    date = "2017\02\29"; //YYYY/MM/DD "ymd"
    printf("IsValid : %d",  isValidDate(date, "ymd"));
   
    date = "01~32~2016"; //MM/DD/YYYY "mdy" //January doesn't have 32 days.
    printf("IsValid : %d", isValidDate(date, "mdy"));
Output - of both first and second version:
Код:
IsValid : 1
IsValid : 1
IsValid : 1
IsValid : 0
IsValid : 0
IsValid : 0
IsValid : 0
Reply

isValidDate

Gist Link



Okay this function is created on the behalf of this discussion.It validates a date which is passed as string to the function.It doesn't need any delimiter or format to specify actually.The function will identify date,month and year automatically.


Parameters: str - date in string
PHP код:

bool
:isValidDate(str[])//by Sreyas
{
    new 
count,i,j;
    new 
daysinmonth[12]={312831303130313130313031};
    new 
parts[3][5],Index_Beg;
    new 
bool:legit;
    while(
str[i]!='\0')
    {
        if(
str[i] < 48 || str[i] > 57)
        {
            
count++;
            
strmid(parts[j], strIndex_Begisizeof(parts[]));
            
Index_Beg i+1;
            
j++;
        }
        
i++;
        if(
str[i]=='\0')
        {
            
strmid(parts[j], strIndex_Begisizeof(parts[]));
        }
    }
    if(
count != 2) return false;
    new 
number[3];
    for(
i=0;i<3;i++)
    {
        
number[i] = strval(parts[i]);
        if(
number[i] == 0)return false;
    }
    new 
y,m,d;
    
= -1;
    for(
i=0;i<3;i++)
    {
        if(
number[i]>31)
        {
            if(
!= -1) return false;
            
i;
        }
    }
    for(
i=0;i<3;i++)
    {
        if(
== y) continue;
        if(
number[i] < 13 && number[i] > 0)
        {
            if(
== -1)
            {
                
i;
            }
            else
            {
                
i;
            }
        }
    }
    if(
y==-1)
    {
        for(
i=0;i<3;i++)
        {
            if(
i==d||i==m) continue;
            
i;
        }
    }
    if(
d==-1)
    {
        for(
i=0;i<3;i++)
        {
            if(
i==y||i==m) continue;
            
i;
        }
    }
    
    if(
m==-1)
    {
        for(
i=0;i<3;i++)
        {
            if(
i==y||i==d) continue;
            
i;
        }
    }
    
    if(
number[y] % 400 == || (number[y] % 100 != && number[y] % == 0))
        
daysinmonth[1]=29;
    if( 
number[m]<13 && number[d] <= daysinmonth[number[m]-1])
        
legit=true;
    if (!
legit) return false;
    return 
true;


NOTE:
More faster function and one using sscanf is posted by Lordzy below. So i prefer you to use that instead of this as it proved to be more slow.
Reply

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
isValidDate

Okay this function is created on the behalf of this discussion.It validates a date which is passed as string to the function.It doesn't need any delimiter or format to specify actually.The function will identify date,month and year automatically.


Parameters: str - date in string
PHP код:

bool
:isValidDate(str[])//by Sreyas
{
    new 
count,i,j;
    new 
daysinmonth[12]={312831303130313130313031};
    new 
parts[3][5],Index_Beg;
    new 
bool:legit;
    
    while(
str[i]!='\0')
    {
        if(
str[i] < 48 || str[i] > 57)
        {
            
count++;
            
strmid(parts[j], strIndex_Begisizeof(parts[]));
            
Index_Beg i+1;
            
j++;
            
          }
        
i++;
        if(
str[i]=='\0')
        {
            
            
strmid(parts[j], strIndex_Begisizeof(parts[]));
            
        }
    }
    
    if(
count != 2) return false;
    new 
number[3];
    
    for(
i=0;i<3;i++)
    {
        
number[i] = strval(parts[i]);
        if(
number[i] == 0)return false;
    }
    new 
y,m,d;
    
= -1;
    
    for(
i=0;i<3;i++)
    {
        if(
number[i]>31)
        {
              
            if(
!= -1) return false;
            
i;
            
        }
    }
    for(
i=0;i<3;i++)
    {
        if(
== y) continue;
        if(
number[i] < 13 && number[i] > 0)
        {
            if(
== -1)
            {
                
i;
            }
            else
            {
                
i;
                
            }
        }
    }
    
    
    if(
y==-1)
    {
        for(
i=0;i<3;i++)
        {
            if(
i==d||i==m) continue;
            
i;
            
        }
    }
    if(
d==-1)
    {
        for(
i=0;i<3;i++)
        {
            if(
i==y||i==m) continue;
            
i;
        }
    }
    if(
number[y] % 400 == || (number[y] % 100 != && number[y] % == 0))
        
daysinmonth[1]=29;
    if( 
number[m]<13 && number[d] <= daysinmonth[number[m]-1])
        
legit=true;
    
    if (!
legit) return false;
    return 
true;

Good idea, but you should check your function failing at some invalid dates which causes array index out of bounds.

------

An even more faster version (1.5 times) of the above IsValidDate that accepts any date-format and separators.

(non-sscanf version)
IsValidDate - Returns true on valid dates, false for invalid ones.

Parameters:
dStr[] - Date as string.
size = sizeof(dStr)) - String size. (optional, default value = sizeof(dStr) )
pawn Код:
stock bool:IsValidDate(dStr[], size = sizeof(dStr)) {

    new
        monthDays[12] = {
            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
        },
        temp_YMD[3],
        temp_Pos    = 0,
        temp_ePos   = 0,
        temp_Index  = 0,
        temp_shortStr[5]
    ;
    do {
   
        while(dStr[temp_ePos] >= 48 && dStr[temp_ePos] <= 57) {
       
            if(++temp_ePos >= size) {
           
                temp_ePos = size - 1;
                break;
            }
        }
        strmid(temp_shortStr, dStr, temp_Pos, temp_ePos, sizeof(temp_shortStr));
        temp_YMD[temp_Index++] = strval(temp_shortStr);
        temp_Pos = ++temp_ePos;
    }
    while(dStr[temp_ePos] != '\0' && temp_Index < 3);

    temp_ePos = temp_Pos = -1;
    for(temp_Index = 0; temp_Index < 3; temp_Index++) {
   
        if(temp_YMD[temp_Index] > 1750) {
       
            if((temp_YMD[temp_Index] % 400) == 0 || ((temp_YMD[temp_Index] % 100) != 0 && (temp_YMD[temp_Index] % 4) == 0))
                monthDays[1] = 29;
               
        }
        else if(temp_YMD[temp_Index] > 12)
            temp_Pos = temp_Index;
        else
            if(temp_ePos == -1)
                temp_ePos = temp_Index;
            else
                temp_Pos = temp_Index;
    }
    if(temp_ePos == -1 || temp_Pos == -1)
        return false;

    if(temp_YMD[temp_ePos] < 1 || temp_YMD[temp_ePos] > 12)
        return false;

    if(temp_YMD[temp_Pos] < 1 || temp_YMD[temp_Pos] > monthDays[temp_YMD[temp_ePos] - 1])
        return false;

    return true;
}
sscanf supported version. (1.5 times faster than the above non-sscanf version)
Parameters:
dStr[] - Date, as string.
pawn Код:
stock bool:IsValidDate(dStr[]) {

    new
        monthDays[12] = {
            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
        },
        temp_YMD[3],
        temp_Pos    = 0,
        temp_ePos   = 0,
        temp_Index  = 0
    ;
        //Thought about implementing SSCANF_QUIET, but it requires spaces to work "currently".
    for(temp_Index = strlen(dStr) - 1; temp_Index != 0; temp_Index--) {

        if(!(dStr[temp_Index] >= 48 && dStr[temp_Index] <= 57))
            dStr[temp_Index] = ' ';
    }
    if(sscanf(dStr, "iii", temp_YMD[0], temp_YMD[1], temp_YMD[2]))
        return false;

    temp_ePos = temp_Pos = -1;
    for(temp_Index = 0; temp_Index < 3; temp_Index++) {

        if(temp_YMD[temp_Index] > 1750) {

            if((temp_YMD[temp_Index] % 400) == 0 || ((temp_YMD[temp_Index] % 100) != 0 && (temp_YMD[temp_Index] % 4) == 0))
                monthDays[1] = 29;

        }
        else if(temp_YMD[temp_Index] > 12)
            temp_Pos = temp_Index;
        else
            if(temp_ePos == -1)
                temp_ePos = temp_Index;
            else
                temp_Pos = temp_Index;
    }
    if(temp_ePos == -1 || temp_Pos == -1)
        return false;

    if(temp_YMD[temp_ePos] < 1 || temp_YMD[temp_ePos] > 12)
        return false;

    if(temp_YMD[temp_Pos] < 1 || temp_YMD[temp_Pos] > monthDays[temp_YMD[temp_ePos] - 1])
        return false;

    return true;
}
PS : It's 3:45 AM right now, I've no idea what I'm doing totally...I think I should be in bed right now...
Reply

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Good idea, but you should check your function failing at some invalid dates which causes array index out of bounds.
Thanks its fixed now the problem was the month was evaluated after assumption of date having invalid month value.But still yours is faster so i would prefer people to use your version.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)