Changing a Time Filterscript timezone
#1

Hello,
How to change Time for our timezone in this [Filterscript]
Sorry, i found no tutorials about this thing...
The time in server is 23:27 , and in our country is 21:27

PHP код:
// By Shadow_ (https://sampforum.blast.hk/showthread.ph...0.76875870
#include <a_samp>
#define FILTERSCRIPT
 
new Text:TimeText:Date;
 
forward settime(playerid);
 
public 
OnFilterScriptInit()
{
        print(
"\n--------------------------------------");
        print(
" Updated Version! WORLDCLOCK+DATE By Shadow");
        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);
        return 
1;
}
 
public 
OnFilterScriptExit()
{
        print(
"\n-----------------------------------------------------");
        print(
" Update Version! WORLDCLOCK+DATE By Shadow !UNLOADED!");
        print(
"-----------------------------------------------------/n");
        return 
1;
}
 
public 
OnPlayerSpawn(playerid)
{
        
SendClientMessage(playerid0xF97804FF"This server is running Shadows Worldclock+Date AddOn!");
        
TextDrawShowForPlayer(playeridTime), TextDrawShowForPlayer(playeridDate);
       
 
        return 
1;
}
 
public 
OnPlayerDisconnect(playeridreason)
{
        
TextDrawHideForPlayer(playeridTime), TextDrawHideForPlayer(playeridDate);
        return 
1;
}
 
public 
settime(playerid)
{
        new 
string[256],year,month,day,hours,minutes,seconds;
        
getdate(yearmonthday), gettime(hoursminutesseconds);
        
format(stringsizeof string"%d/%s%d/%s%d"day, ((month 10) ? ("0") : ("")), month, (year 10) ? ("0") : (""), year);
        
TextDrawSetString(Datestring);
        
format(stringsizeof string"%s%d:%s%d:%s%d", (hours 10) ? ("0") : (""), hours, (minutes 10) ? ("0") : (""), minutes, (seconds 10) ? ("0") : (""), seconds);
        
TextDrawSetString(Timestring);

Reply
#2

https://sampforum.blast.hk/showthread.php?tid=311464
Reply
#3

Quote:
Originally Posted by Bomber07
Посмотреть сообщение
I want just to edit the filterscript ,
Reply
#4

The gettime function gets the current time of the server, so the server is being hosted in a country which is 2 hours behind your current location, a quick fix to this would be..
Код:
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+2 < 10) ? ("0") : (""), hours+2, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds); 
        TextDrawSetString(Time, string); 
}
Reply
#5

Quote:
Originally Posted by MotherDucker
Посмотреть сообщение
The gettime function gets the current time of the server, so the server is being hosted in a country which is 2 hours behind your current location, a quick fix to this would be..
Код:
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+2 < 10) ? ("0") : (""), hours+2, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds); 
        TextDrawSetString(Time, string); 
}
I think this is better :
PHP код:
public settime(playerid

        static 
string[100],year,month,day,hours,minutes,seconds
        
getdate(yearmonthday), gettime(hoursminutesseconds); 
        
format(stringsizeof string"%02d/%02d/%02d"daymonthyear);
        
TextDrawSetString(Datestring); 
        
format(stringsizeof string"%02d:%02d:%02d"hoursminutesseconds);
        
TextDrawSetString(Timestring); 

Reply
#6

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
I think this is better :
PHP код:
public settime(playerid

        static 
string[100],year,month,day,hours,minutes,seconds
        
getdate(yearmonthday), gettime(hoursminutesseconds); 
        
format(stringsizeof string"%02d/%s%02d/%s%02d"daymonthyear);
        
TextDrawSetString(Datestring); 
        
format(stringsizeof string"%s%02d:%s%02d:%s%02d"hoursminutesseconds);
        
TextDrawSetString(Timestring); 

Yes is better, but forgot remove %s
Reply
#7

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Yes is better, but forgot remove %s
Quote:
Originally Posted by Dayrion
Посмотреть сообщение
I think this is better :
PHP код:
public settime(playerid

        static 
string[100],year,month,day,hours,minutes,seconds
        
getdate(yearmonthday), gettime(hoursminutesseconds); 
        
format(stringsizeof string"%02d/%02d/%02d"daymonthyear);
        
TextDrawSetString(Datestring); 
        
format(stringsizeof string"%02d:%02d:%02d"hoursminutesseconds);
        
TextDrawSetString(Timestring); 

Like this ?
PHP код:
public settime(playerid

        static 
string[100],year,month,day,hours,minutes,seconds
        
getdate(yearmonthday), gettime(hoursminutesseconds); 
        
format(stringsizeof string"%02d/%s%02d/%s%02d"daymonthyear);
        
TextDrawSetString(Datestring); 
        
format(stringsizeof string"%s%02d:%s%02d:%s%02d"hoursminutesseconds);
        
TextDrawSetString([COLOR="-1, string); 

Reply
#8

Help Me In My Post https://sampforum.blast.hk/showthread.php?tid=610511
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)