[TIME] CHAT
#1

I saw that some servers haves:

[HH:MM:SS]*CHAT HERE*

It shows the time before the chat, How?
Reply
#2

use /timestamp, or you wanna somthing else ?
Reply
#3

thanks :3
Reply
#4

https://sampwiki.blast.hk/wiki/Client_Commands
Reply
#5

You do this by using gettime, and storing it into variables.
Then, under OnPlayerText, format the string with the variables, and return 0;

Example
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.
}



EDIT:

Forgot about timestamp...I'm an idiot.
Reply
#6

it worked for me thx guys
Reply
#7

You do realise that you just bumped a 4 year old topic...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)