Real Time Clock in GM
#1

Hello, if possible, I would like to put this fs about real time clock in my gm.
How do I change this fs in order to put it in my gm? Because there is a part that have to go below public OnFilterScriptInit()

Quote:

#include <a_samp>
#define FILTERSCRIPT

new Text:Clock; new Text:WeekDayg;

forward GetWeekdayNum(d,m,y);
forward settime();
forward weatherchange();

public OnFilterScriptInit()
{
WeekDayg = TextDrawCreate(558.000000,4.000000,"----");
TextDrawAlignment(WeekDayg,0);
TextDrawBackgroundColor(WeekDayg,0x000000ff);
TextDrawFont(WeekDayg,3);
TextDrawLetterSize(WeekDayg,0.500000,1.600000);
TextDrawColor(WeekDayg,0xffff00cc);
TextDrawSetOutline(WeekDayg,1);
TextDrawSetProportional(WeekDayg,1);
TextDrawSetShadow(WeekDayg,10);

Clock = TextDrawCreate(578.0, 17.0, "--:--");
TextDrawLetterSize(Clock, 0.4, 1.;
TextDrawFont(Clock, 3);
TextDrawSetOutline(Clock, 2);

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

public OnFilterScriptExit()
{
return 1;
}

public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Clock);
TextDrawShowForPlayer(playerid, WeekDayg);
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, Clock);
TextDrawHideForPlayer(playerid, WeekDayg);
return 1;
}

public weatherchange(){
SetWeather(random(1);
}

public settime(){
new hour,minute,second;
new string[256];
gettime(hour,minute,second);
if (minute <= 9){format(string,25,"%d:0%d",hour,minute);}
else {format(string,25,"%d:%d",hour,minute);}
TextDrawSetString(Clock,string);
SetWorldTime(hour);
new day, month, year;
new weekday;
getdate(day, month, year);
weekday = GetWeekdayNum(day, month, year);
if(weekday == 1){TextDrawSetString(WeekDayg,"Lunedi");}
if(weekday == 2){TextDrawSetString(WeekDayg,"Martedi");}
if(weekday == 3){TextDrawSetString(WeekDayg,"Mercoledi");}
if(weekday == 4){TextDrawSetString(WeekDayg,"Giovedi");}
if(weekday == 5){TextDrawSetString(WeekDayg,"Venerdi");}
if(weekday == 6){TextDrawSetString(WeekDayg,"Sabato");}
if(weekday == 7){TextDrawSetString(WeekDayg,"Domenica");}
return 1;
}

public GetWeekdayNum(d,m,y) //by d.wine
{
m-=2;
if(m<=0)
{
y--;
m+=12;
}
new cen = y/100;
y=getrem(y,100);
new w = d + ((13*m-1)/5) + y + (y/4) + (cen/4) - 2*cen;
w=getrem(w,7);
if (w==0) w=7;
return w-1;
}

getrem(a,b) //get remnant of division
{
new div = a/b;
new left = a-b*div;
return left;
}

Reply
#2

I can't understand what is a problem?
Reply
#3

add the thing from
PHP код:
public OnFilterScriptInit 
in your gamemode at
PHP код:
public OnGameModeInit 
Reply
#4

@PepsiCola23 thanks, +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)