date/time help
#1

hey so I'm looking for a system that gets the player day/time/month so that when he join the server it gamemodetext him in the screen the date and time like this format February, 12, 2017 so can any one help me with it I will be soo glad.
Reply
#2

I am not getting what your trying to ask but

you'll be needing to add variables for that such as hours, minutes, seconds and by using gettime() convert the given time minutes, hours and seconds for date, getdate(), then do the same with hours, minutes and seconds but this time using month, date and year.

if you want it to be scripted. You're in the wrong section. Here is only for scripts that are having errors or like what I did gave you an idea on how to do it.

and also try the search button your idea might already be posted on a old thread.
Reply
#3

no I don't want it to be scripted I just wanted an idea to start off thanks!.
Reply
#4

Код:
new gYear, gMonth, gDay; // Save some global variables that will be updated every hour.

forward UpdateData();

public OnGameModeInit()
{
    getdate(gYear, gMonth, gDay); //Initialize variables.
    SetTimer("UpdateData", 3600000, true); //This timer will update every hour the date as we don't need to get it everytime a player joins the server.
}

public UpdateData()
{
    getdate(gYear, gMonth, gDay);
}

stock GetMonthName(month) //A custom function (https://sampforum.blast.hk/showthread.ph...9.42538953{ 
    static const MonhtsYears[12][] = { 
        "January",            // 0 
        "February",          // 1 
        "March",            // 2 
        "April",            // 3 
        "May",                // 4 
        "June",               // 5 
        "July",               // 6 
        "August",           // 7 
        "September",          // 8 
        "October",          // 9 
        "November",           // 10 
        "December"            // 11 
    }; 
    new 
        month_str[24] 
    ; 

    if(month > 0 && month <= sizeof(MonhtsYears)) { 
        format(month_str, sizeof(month_str), "%s", MonhtsYears[month-1]); 
    } 
    else{ 
        format(month_str, sizeof(month_str), "Unknown"); 
    } 
    return month_str; 
} 
public OnPlayerRequestClass(playerid, classid)
{
    new string[32]; 
    format(string, sizeof string, "%s, %02d, %d", GetMonthName(gMonth), gDay, Year);
    GameTextForPlayer(playerid, string, 5000, 2); //https://sampwiki.blast.hk/wiki/GameTextForPlayer
    return 1;
}
Reply
#5

thanks! btw how to remove the original san andreas clock from the top right corner?
Reply
#6

Quote:
Originally Posted by silverms
Посмотреть сообщение
thanks! btw how to remove the original san andreas clock from the top right corner?
Actually is hidden by default so search in your script for
Код:
TogglePlayerClock
and remove it.
Reply
#7

I search but there is no such a thing in the gamemode
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)