SA-MP Forums Archive
Clock Problem - 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: Clock Problem (/showthread.php?tid=363315)



Clock Problem - tutibubu - 27.07.2012

Hello.. i am using a simple clock filterscript and i want to change the hour.. because.. now it's 12:47 Pm in my country and in game it shows 13:40 ) Here is my code
Код:
#include <a_samp>
#define FILTERSCRIPT

new Text:Time, Text:Date;

forward settime(playerid);

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" By ProDj");
        print("--------------------------------------\n");

    SetTimer("settime",1000,true);

        Date = TextDrawCreate(547.000000,11.000000,"--");

        TextDrawFont(Date,3);
        TextDrawLetterSize(Date,0.399999,1.600000);
    TextDrawColor(Date,0xffffffff);

        Time = TextDrawCreate(547.000000,28.000000,"--");

        TextDrawFont(Time,3);
        TextDrawLetterSize(Time,0.399999,1.600000);
        TextDrawColor(Time,0xffffffff);


        SetTimer("settime",1000,true);
        return 1;
}

public OnFilterScriptExit()
{
        print("\n-----------------------------------------------------");
        print(" Update Version! By ProDj");
        print("-----------------------------------------------------/n");
        return 1;
}

public OnPlayerSpawn(playerid)
{
        TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);


        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
        return 1;
}

public settime(playerid)
{
        new string[256],year,month,day,hours,minutes,seconds;
        getdate(year, month, day), gettime(hours, minutes, seconds);
        format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
        TextDrawSetString(Date, string);
        format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
        TextDrawSetString(Time, string);
}



Re: Clock Problem - tutibubu - 27.07.2012

Solve it by myself
Quote:

#include <a_samp>
#define FILTERSCRIPT

new Text:Time, Textate;

forward settime(playerid);

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" By ProDj");
print("--------------------------------------\n");

SetTimer("settime",1000,true);

Date = TextDrawCreate(547.000000,11.000000,"--");

TextDrawFont(Date,3);
TextDrawLetterSize(Date,0.399999,1.600000);
TextDrawColor(Date,0xffffffff);

Time = TextDrawCreate(547.000000,28.000000,"--");

TextDrawFont(Time,3);
TextDrawLetterSize(Time,0.399999,1.600000);
TextDrawColor(Time,0xffffffff);


SetTimer("settime",1000,true);
return 1;
}

public OnFilterScriptExit()
{
print("\n-----------------------------------------------------");
print(" Update Version! By ProDj");
print("-----------------------------------------------------/n");
return 1;
}

public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);


return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
return 1;
}

public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours-1, (minutes < 10) ? ("0") : (""), minutes+7, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time, string);
}