How to Add Date in Chat ? +REP
#1

How to Add Date in chat ???
Like This :

[9:12:2013]WhiteAngel : 123 <<<In Chat Box...

Please Help me !!! +REP


*SorryForMyLittleEnglish
Reply
#2

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.
}
Reply
#3

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...
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)