split a variables or separate variable
#1

I have a Variable-where inside there is a date. How do I separate the variable day, month and year?
Thanks, sorry for the shitty English, I'm Italian ..


Es:
I have
new str[24];
str = 2011-01-04;


do you want separate 2011, 01, 04 do you set in other varables??

new year, mont, day;

year = 2011 ecc....
Reply
#2

pawn Код:
strmid(str,"2011-01-04",0,12,13);
then use sscanf from ******

pawn Код:
sscanf(str, "p<->iii", year, month, day);
//or
sscanf("2011 01 04", "iii", year month, day); // etc
Reply
#3

Код:
	if(PlayerInfo[playerid][pPremium] == 1)
	{
		new Year, Month, Day, day, month, year;
		//sscanf(PlayerInfo[playerid][pScadenza], "iii", year month, day);
		strmid(PlayerInfo[playerid][pScadenza],PlayerInfo[playerid][pScadenza],year,month,day);
		printf("%02d/%02d/%d", day, month, year);
		getdate(Year, Month, Day);
		if(Day < day && Month > month || Day > day && Month == month || Year > year)
		{
		    PlayerInfo[playerid][pPremium] = 0;
		    SendClientMessage(playerid, COLOR_WHITE, "Il tuo abbonamento a premium user и scaduto.");
		}
		if(PlayerInfo[playerid][pPremium] == 1)
		{
		    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Il tuo abbonamento a premium user scade il %02d/%02d/%d", day, month, year);
		}
	}
printf return 00/00/0
Reply
#4

help me
Reply
#5

This PlayerInfo[playerid][pScadenza] = "2011-01-04" ?
Reply
#6

yes do you separate??
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)