[FilterScript] Clock System (Simple)
#1



Hey guys, I was playing and I just got this idea, and I'm coming here posting it for you
(progress bar indicates seconds)
Code:
#include a_samp
#include progress

new Text:r_bottom;
new Text:r_hour;
new Text:r_edge;
new Text:r_edge2;
new Text:r_edge3;
new Bar:r_seconds;

public OnGameModeInit()
{
    r_seconds = CreateProgressBar(548.00, 37.00, 76.50, 7.19, -1048321, 60.0);

	r_bottom = TextDrawCreate(628.352600, 6.750000, "usebox");
	TextDrawLetterSize(r_bottom, 0.000000, 2.988888);
	TextDrawTextSize(r_bottom, 544.352844, 0.000000);
	TextDrawAlignment(r_bottom, 1);
	TextDrawColor(r_bottom, 0);
	TextDrawUseBox(r_bottom, true);
	TextDrawBoxColor(r_bottom, 102);
	TextDrawSetShadow(r_bottom, 0);
	TextDrawSetOutline(r_bottom, 0);
	TextDrawFont(r_bottom, 0);

	r_hour = TextDrawCreate(550.588134, 0.583346, "00:00");
	TextDrawLetterSize(r_hour, 0.609529, 3.705832);
	TextDrawAlignment(r_hour, 1);
	TextDrawColor(r_hour, -1);
	TextDrawSetShadow(r_hour, -1);
	TextDrawSetOutline(r_hour, 0);
	TextDrawBackgroundColor(r_hour, 51);
	TextDrawFont(r_hour, 2);
	TextDrawSetProportional(r_hour, 1);

	r_edge = TextDrawCreate(546.352966, 1.750000, "LD_SPAC:white");
	TextDrawLetterSize(r_edge, 0.000000, 0.000000);
	TextDrawTextSize(r_edge, 80.470588, 2.916666);
	TextDrawAlignment(r_edge, 1);
	TextDrawColor(r_edge, 255);
	TextDrawSetShadow(r_edge, 0);
	TextDrawSetOutline(r_edge, 0);
	TextDrawFont(r_edge, 4);

	r_edge2 = TextDrawCreate(545.941223, 43.000000, "LD_SPAC:white");
	TextDrawLetterSize(r_edge2, 0.000000, 0.000000);
	TextDrawTextSize(r_edge2, 80.470588, 2.916666);
	TextDrawAlignment(r_edge2, 1);
	TextDrawColor(r_edge2, 255);
	TextDrawSetShadow(r_edge2, 0);
	TextDrawSetOutline(r_edge2, 0);
	TextDrawFont(r_edge2, 4);

	r_edge3 = TextDrawCreate(546.000061, 36.416671, "LD_SPAC:white");
	TextDrawLetterSize(r_edge3, 0.000000, 0.000000);
	TextDrawTextSize(r_edge3, 2.352943, 9.333333);
	TextDrawAlignment(r_edge3, 1);
	TextDrawColor(r_edge3, 255);
	TextDrawSetShadow(r_edge3, 0);
	TextDrawSetOutline(r_edge3, 0);
	TextDrawFont(r_edge3, 4);
	SetTimer("r_update", 500, true);
	return true;
}

public OnPlayerSpawn(playerid)
{
	clock(playerid);
	return true;
}

forward r_update();
public r_update()
{
	new string[10], hour, minutes, seconds;
	gettime(hour, minutes, seconds);
	format(string, sizeof string, "%02d:%02d", hour, minutes), TextDrawSetString(r_hour, string);
	SetProgressBarValue(r_seconds, seconds), UpdateProgressBar(r_seconds);
}

stock clock(playerid)
{
	ShowProgressBarForPlayer(playerid, r_seconds);
	TextDrawShowForPlayer(playerid, r_bottom);
	TextDrawShowForPlayer(playerid, r_hour);
	TextDrawShowForPlayer(playerid, r_edge);
	TextDrawShowForPlayer(playerid, r_edge2);
	TextDrawShowForPlayer(playerid, r_edge3);
	return true;
}
Reply
#2

Great work.
Reply
#3

not bad

but instead of showing the td everytime player spawns show it once on connect

PHP Code:
public OnPlayerConnect(playerid)
{
    
clock(playerid);
    return 
true;

also you dont need stock

PHP Code:
clock(playerid)
{
    
ShowProgressBarForPlayer(playeridr_seconds);
    
TextDrawShowForPlayer(playeridr_bottom);
    
TextDrawShowForPlayer(playeridr_hour);
    
TextDrawShowForPlayer(playeridr_edge);
    
TextDrawShowForPlayer(playeridr_edge2);
    
TextDrawShowForPlayer(playeridr_edge3);
    return 
true;

Reply
#4

Picture please
Reply
#5

Quote:
Originally Posted by Mivco
View Post
Picture please


dem cows doe lmao
Reply
#6

PHP Code:
SetTimer("r_update"500true); 
not sure why you did this....but you should change 500 to 1000 since 1 second = 1000 ms.

Anyhow this is very simple, you should make it unique.. like using a IP Lookup to get player GMT and add the missing hours to the player clock etc...
Reply
#7

What version of Progress2 are you using? I've looked everywhere and I downloaded [HLF]Southclaw's version but I get undefined 3 symbols then I downloaded another one Gammix's with global bar support. I got that but I can't find any version that supports UpdateProgressBar.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)