SA-MP Forums Archive
Time and date for command shows ingame - 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 and date for command shows ingame (/showthread.php?tid=415796)



Time and date for command shows ingame - Don_Cage - 14.02.2013

Hi, when i type /maskon or /maskoff the time/date/sendername of command is showing in the game for everyone that is near the player. I dont know why this have started since nothing in the command is changed but here is it anyway
pawn Код:
if(strcmp(cmd, "/maskon", true) == 0) // by CuervO_NegrO
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMask] == 0)
            {
                 SendClientMessage(playerid, COLOR_GRAD1, "** You don't have a mask");
                 return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 5)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** You are not able to use it.");
                return 1;
            }
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 0);
                }
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "** You have put your mask on [/maskoff to put it away].");
            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);

            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskon",d,m,y,h,mi,s,sendername);
            CommandLog(string);
        }
        return 1;
    }
I hope you can help


Re: Time and date for command shows ingame - Don_Cage - 15.02.2013

I have triend to remove the time and date from the command but still it is shown example 12/12/12/[12/12/12] Don_Cage [CMD] -> /maskon for everyone that is close, why is this happening?


Re: Time and date for command shows ingame - Scenario - 15.02.2013

pawn Код:
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskon",d,m,y,h,mi,s,sendername);
            CommandLog(string);
That code simply logs the command into a file/database, I believe. You shouldn't be seeing this in-game.

Have you tried doing /timestamp? SA:MP has the option to add a time-stamp to the start of every message.


Re: Time and date for command shows ingame - Don_Cage - 15.02.2013

No i havent tried that but then again shouldnt that add a time stamp to ALL the commands? cuz it is only showing on the /maskon and /maskoff, but i will try do /timestamp and see if that works


Re: Time and date for command shows ingame - Don_Cage - 15.02.2013

nope that didnt work


Re: Time and date for command shows ingame - Scenario - 15.02.2013

Show me the CommandLog function.


Re: Time and date for command shows ingame - Don_Cage - 15.02.2013

This?
pawn Код:
public CommandLog(string[])
{
    new entry[128];
    format(entry, sizeof(entry), "%s\r\n",string);
    new File:hFile;
    hFile = fopen("LARP/Logs/commands.log", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}



Re: Time and date for command shows ingame - Da_Noob - 15.02.2013

Try to remove this line:

pawn Код:
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
Looking at the code it doesn't do anything, and maybe that's your problem.


Re: Time and date for command shows ingame - Don_Cage - 16.02.2013

Thanks that was it, all works good now!