Whats Wrong in This Gameday GameTime System?
#1

Hello..guys as u all know or may not know...im a complete failure in scripting for now tho ..learning slowly slowly...today i was trying to make a ingame gameday and gametime system...look this clock isnt going to work with real world time and day... its gonna work like normal GTA - SA..one hour of this ingame hour will be one minute irl...and one minute will be one second.. it isnt showing any error in compiling tho..

but my problem is -

One second is resulting into one ingame hour..trying getting me? and one minute is passing like one milli second..its working faster than it should be...couldnt figure out the mistake anyway...Help me ._.

My Code - (Includes)
Код:
 #include <a_samp>
#include <sscanf2>
The Defines - They Are Used To Change Color of the textdraw string
Код:
#define COLOR_TIME 0xFFFFFFFF 
#define COLOR_DAY  0xFFFFFFFF
#define MINUTE 1000
My Timer which i forwarded -
Код:
forward GameDay();
The Variables -
Quote:

new Text:gTime;
new Text:gDay;
new gtime=0;
new gday=0;

Under OnGameModeInit -
Код:
SetTimer("Gameday",MINUTE,1);
	
	gTime = TextDrawCreate(605.000000,25.000000,"00:00");
	TextDrawAlignment(gTime,3);
	TextDrawBackgroundColor(gTime,0x000000FF);
	TextDrawFont(gTime,3);
	TextDrawLetterSize(gTime,0.535,2.2);
	TextDrawColor(gTime,COLOR_TIME);
	TextDrawSetOutline(gTime,2);
	TextDrawSetProportional(gTime,1);
	TextDrawSetShadow(gTime,1);

	gDay = TextDrawCreate(610.000000,7.000000,"Sunday");
	TextDrawUseBox(gDay,0);
	TextDrawFont(gDay,3);
	TextDrawLetterSize(gDay,0.6,1.5);
	TextDrawSetShadow(gDay,1);
	TextDrawSetOutline(gDay ,0);
	TextDrawBackgroundColor(gDay, 0x000000FF);
	TextDrawBoxColor(gDay ,0x00000066);
	TextDrawColor(gDay,COLOR_DAY);
	TextDrawTextSize(gDay , -1880.0, -1880.0);
	TextDrawAlignment(gDay,3);
	TextDrawSetOutline(gDay,1);
My Function -
Код:
public Gameday()
{
 	new timestring[256];
  	new daystring[256];
	new gseconds = gtime % 60,
	gminutes = (gtime - gseconds) / 60;
	gtime ++;
	format(timestring, sizeof (timestring), "   %02d:%02d", gminutes, gseconds);
	TextDrawSetString(gTime,timestring);
	TextDrawShowForAll(gTime);
	format(daystring, sizeof (daystring), "%s",GetDayName());
	TextDrawSetString(gDay,daystring);
	TextDrawShowForAll(gDay);
	SetWorldTime(gminutes);
	if(gday==6&&gtime==1440)//One week passed
	{
		gday=0;
		gtime=0;
		//A new week has begun
	}
	if(gtime==1440)//One day passed
	{
		gday++;
		gtime=0;
		format(daystring, sizeof (daystring), "   00:00");
		TextDrawSetString(gTime,daystring);
	}
	return 1;
}
Finally, The Stock -
Код:
stock GetDayName()
{
	new DayName[128];
    switch(gday)
    {
		//All day names can be changed to your language.
		case 0: format(DayName, sizeof(DayName), "Sunday");
        case 1: format(DayName, sizeof(DayName), "Monday");
        case 2: format(DayName, sizeof(DayName), "Tuesday");
        case 3: format(DayName, sizeof(DayName), "Wednesday");
        case 4: format(DayName, sizeof(DayName), "Thursday");
        case 5: format(DayName, sizeof(DayName), "Friday");
        case 6: format(DayName, sizeof(DayName), "Saturday");
    }
    return DayName;
}
Help Me Please - [+REP] i couldnt solve it
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)