How to Add Date in Chat ? +REP - 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: How to Add Date in Chat ? +REP (
/showthread.php?tid=480130)
How to Add Date in Chat ? +REP -
WhiteAngels - 09.12.2013
How to Add Date in chat ???
Like This :
[9:12:2013]WhiteAngel : 123 <<<In Chat Box...
Please Help me !!!
+REP
*SorryForMyLittleEnglish
Re: How to Add Date in Chat ? +REP -
Krakuski - 09.12.2013
There is the command '/timestamp' that is already in the SA-MP Client. Or do you need something that actually posts in the chat?
EDIT: Here you go!
pawn Код:
public OnPlayerText(playerid, text[])
{
new Year, Month, Day, string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name)); // Get the typer's name
getdate(Year, Month, Day); // Get the time and store it into the variables above
format(string,sizeof(string),"[%d/%d/%d] %s says: %s",Day,Month,Year,name,text); // Formats the text with the time variables
SendClientMessageToAll( -1, string); // Send the message to all
return 0; // Returning 0 will disable the traditional SAMP chat.
}
Re: How to Add Date in Chat ? +REP -
WhiteAngels - 09.12.2013
Quote:
Originally Posted by Krakuski
There is the command '/timestamp' that is already in the SA-MP Client. Or do you need something that actually posts in the chat?
EDIT: Here you go!
pawn Код:
public OnPlayerText(playerid, text[]) { new Year, Month, Day, string[128], name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); // Get the typer's name getdate(Year, Month, Day); // Get the time and store it into the variables above format(string,sizeof(string),"[%d/%d/%d] %s says: %s",Day,Month,Year,name,text); // Formats the text with the time variables SendClientMessageToAll( -1, string); // Send the message to all return 0; // Returning 0 will disable the traditional SAMP chat. }
|
Not Work...
I using GameMode SATDM_v9...
Re: How to Add Date in Chat ? +REP -
gotwarzone - 09.12.2013
Maybe you have stock for date somewhere in your SATDM_v9 script? if you have post it here. As Krakuski it works on his script coz he was using his own stock and function.
Re: How to Add Date in Chat ? +REP -
Sublime - 09.12.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
new
hours, // Variable for hours
minutes, // Variable for minutes
seconds, // Variable for seconds
string[128], // String
name[MAX_PLAYER_NAME] // String for name
;
GetPlayerName(playerid,name,sizeof(name)); // Get the typer's name
gettime(hours, minutes, seconds); // Get the time and store it into the variables above
format(string,sizeof(string),"[%d:%d:%d] %s says: %s",hours,minutes,seconds,name,text); // Formats the text with the time variables
SendClientMessageToAll( -1, string); // Send the message to all
return 0; // Returning 0 will disable the traditional SAMP chat.
}
Took me 3 minutes to search, copy paste this from ReneG's post and post it here. Next time, search.
Re: How to Add Date in Chat ? +REP -
xHarshx - 09.12.2013
Make sure you don't have something iter-uptting your file...Try /timestamp...If that doesn't work...Check your Script for some errors that my be blocking that!
Or if you want the kind of DOB format like karuki...Do the same thing in your script and Karuki located.