SA-MP Forums Archive
Date - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Date (/showthread.php?tid=438924)



Date - ConnorP - 22.05.2013

pawn Код:
new Year, Month, Day;
getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);
Sorry for the influx of questions, I do usually work it out for myself but I'm real stuck.

How would I get this into text (SendClientMessage)? I tried but failed, because it was a bunch of random numbers.


Re: Date - tyler12 - 22.05.2013

pawn Код:
new Year, Month, Day,string[124];
getdate(Year, Month, Day);
format(string,sizeof(string),"%02d/%02d/%d", Day, Month, Year);
SendClientMessage(playerid,-1,string);



Re: Date - ConnorP - 22.05.2013

Quote:
Originally Posted by tyler12
Посмотреть сообщение
pawn Код:
new Year, Month, Day,string[124];
getdate(Year, Month, Day);
format(string,sizeof(string),"%02d/%02d/%d", Day, Month, Year);
SendClientMessage(playerid,-1,string);
You're awesome. It works sound now. Thanks a bunch. Will rep. Can you explain to me how the -1 works here? Although the code works, I'd like to understand it fully.


Re: Date - tyler12 - 22.05.2013

Quote:
Originally Posted by ConnorP
Посмотреть сообщение
You're awesome. It works sound now. Thanks a bunch. Will rep. Can you explain to me how the -1 works here? Although the code works, I'd like to understand it fully.
It's a color. -1 is white.


Re: Date - ConnorP - 22.05.2013

Quote:
Originally Posted by tyler12
Посмотреть сообщение
It's a color. -1 is white.
Very helpful thanks.
I know you've done your fair share of helping but I'm also having issues trying to put the date on the same line as "Date:" text. If you could help me, I would appreciate it.

So, like: Date: [scripted date here]


Re: Date - zDevon - 22.05.2013

Put it in the formatted string.
pawn Код:
format(string,sizeof(string),"Date: %02d/%02d/%d", Day, Month, Year);



Re: Date - ConnorP - 22.05.2013

Yeah, I suck.

Thanks for the help, one day I might be helping people. Sometimes my problem is that I merely overcomplicate things.