Date to timestamp help
#1

I want to format the donate expire to Datetotimestamp but it supports only 1 string parmater.
how do i do this, help me thanks

P.S: I got these stock from timestamptodate include in samp forums.

Код:
if(DonateLevel[playerid] > 0)
	{
	    new str[128];
	    dex[playerid] = DateToTimestamp("%d",DonateExpire[playerid]); // i want to format the
            // date to timestamp thing, but the stock is supporting only 1  string parameter
	    if(DonateExpire[playerid] != 0)
	    {
	     	if(gettime() < dex[playerid])
	      	{	
				switch(Sprache[playerid])
				{
					case 0: format(str,sizeof(str),"DONOR: Spende Level %d bis: %s.",DonateLevel[playerid],DonateExpire[playerid]);
					case 1: format(str,sizeof(str),"DONOR: Donator Level %d until: %s.",DonateLevel[playerid],DonateExpire[playerid]);
					case 2: format(str,sizeof(str),"DONOR: Nivel de donante %d hasta: %s.",DonateLevel[playerid],DonateExpire[playerid]);
				}
	      		SendClientMessage(playerid,0x2641FEFF,str);
	      		SendLangMessage(playerid,_COLOR_WHITE,"DONOR: Schreibe /donorcmds um deine Commands zu sehen","Type /donorcmds to see your commands.","Escribe /donorcmds para ver tus comandos.");
	       	}
	       	else
	        {
				switch(Sprache[playerid])
				{
					case 0: format(str,sizeof(str),"DONOR: Dein Spende Level (%d) ist am %s abgelaufen.",DonateLevel[playerid],DonateExpire[playerid]);
					case 1: format(str,sizeof(str),"DONOR: Your Donator Level (%d) expired on %s.",DonateLevel[playerid],DonateExpire[playerid]);
					case 2:format(str,sizeof(str),"DONOR: Tu nivel de donante (%d) expirу el %s.",DonateLevel[playerid],DonateExpire[playerid]);
				}
	      		SendClientMessage(playerid,0x2641FEFF,str);
	            DonateLevel[playerid] = 0;
				DonateExpire[playerid] = 0;
	        }
		}
		else
		{
			switch(Sprache[playerid])
			{
				case 0: format(str,sizeof(str),"DONOR: Spende Level: %d bis: Unbefristet",DonateLevel[playerid]);
				case 1: format(str,sizeof(str),"DONOR: Donator Level: %d until: Permanent",DonateLevel[playerid]);
				case 2: format(str,sizeof(str),"DONOR: Nivel de donante: %d hasta: Permanente",DonateLevel[playerid]);
			}
			SendClientMessage(playerid,0x2641FEFF,str);
  			SendLangMessage(playerid,_COLOR_WHITE,"DONOR: Schreibe /donorcmds um deine Commands zu sehen","Type /donorcmds to see your commands.","Escribe /donorcmds para ver tus comandos.");
		}
	}

Код:
// Want to change the params....
stock DateToTimestamp(str[11]) // here want to change the params
{
	new date[3]; // date[0] = day		date[1] = month			date[2] = year
	if(!sscanf(str,"p<"#SPLITTER">ddd",date[0],date[1],date[2]))
	{
		new total = 0, tmp = 0;
		total += date[0] * 86400;
		if(date[1] == 2 && date[0] < 29) tmp = ((date[2] - 1968) / 4 - 2);
		else tmp = ((date[2] - 1968) / 4 - 1);
		total += tmp * 31622400;
		total += (date[2] - 1970 - tmp) * 31536000;
		for(new i = 1; i < date[1]; i ++) total += MonthTimes1[i][0 + IsLeapYear(date[2])] * 86400;
		return total;
	}
	else return -1;
}
Reply
#2

-bump-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)