SA-MP Forums Archive
[TIME] CHAT - 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: [TIME] CHAT (/showthread.php?tid=333520)



[TIME] CHAT - Gooday - 11.04.2012

I saw that some servers haves:

[HH:MM:SS]*CHAT HERE*

It shows the time before the chat, How?


Re: [TIME] CHAT - 3RoR - 11.04.2012

use /timestamp, or you wanna somthing else ?


Re: [TIME] CHAT - Gooday - 11.04.2012

thanks :3


Re: [TIME] CHAT - DBan - 11.04.2012

https://sampwiki.blast.hk/wiki/Client_Commands


Re: [TIME] CHAT - ReneG - 11.04.2012

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.


Re: [TIME] CHAT - elhanan - 22.06.2016

it worked for me thx guys


Re: [TIME] CHAT - Luicy. - 22.06.2016

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