SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/12/2016, 01:02 PM   #1
POL_george
Gangsta
 
POL_george's Avatar
 
Join Date: Feb 2012
Posts: 512
Reputation: 7
Default clock problem

I tried this
Code:
forward Clock();
public Clock()
{
	new years, months, days, hours, minutes, seconds, data[128], clock[128];
	getdate(years, months, days);
 	gettime(hours, minutes, seconds);
	format(data, 128, "%i/%i/%i", days, minutes, years);
	format(clock, 128, "%i:%i:%i", hours, minutes, seconds);
	TextDrawSetString(Date, data);
	TextDrawSetString(Hour, data);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		   	TextDrawShowForPlayer(i,Date);
	 		TextDrawShowForPlayer(i,Hour);
	 	}
	}
	return 1;
}
in OnGameModeInt
Code:
	//Data
	Date = TextDrawCreate(502, 110, "Ora");
	TextDrawFont(Date , 3);
	TextDrawTextSize(Date, 0.5, 1);
	TextDrawColor(Date , 0xFFFFFFFF);
	TextDrawSetOutline(Date , 1);
	TextDrawSetProportional(Date , 1);
	TextDrawSetShadow(Date , 1);
	//Ora
	Hour = TextDrawCreate(549, 29, "Ora");
	TextDrawFont(Hour , 3);
	TextDrawTextSize(Hour, 0.5, 1);
	TextDrawColor(Hour , 0xFFFFFFFF);
	TextDrawSetOutline(Hour , 1);
	TextDrawSetProportional(Hour , 1);
	TextDrawSetShadow(Hour , 1);

	SetTimer("Clock", 100, true);
Why it's not showing up? I have no errors/warning
__________________
Cand viata iti da lamai, faci portocale!

When live give you lemons, make oranges!
POL_george is offline   Reply With Quote
Old 01/12/2016, 01:11 PM   #2
BrianFaria
Huge Clucker
 
BrianFaria's Avatar
 
Join Date: Oct 2015
Location: Argentina.
Posts: 423
Reputation: 81
Default Re: clock problem

Try this

Code:
forward Clock();
public Clock()
{
	new years, months, days, hours, minutes, seconds, data[128], clock[128];
	getdate(years, months, days);
 	gettime(hours, minutes, seconds);
	format(data, 128, "%i/%i/%i", days, minutes, years);
	TextDrawSetString(Date, data);
	format(clock, 128, "%i:%i:%i", hours, minutes, seconds);
	TextDrawSetString(Hour, clock);
	return 1;
}


//Data
	Date = TextDrawCreate(502, 110, "Ora");
	TextDrawFont(Date , 3);
	TextDrawTextSize(Date, 0.5, 1);
	TextDrawColor(Date , 0xFFFFFFFF);
	TextDrawSetOutline(Date , 1);
	TextDrawSetProportional(Date , 1);
	TextDrawSetShadow(Date , 1);
	//Ora
	Hour = TextDrawCreate(549, 29, "Ora");
	TextDrawFont(Hour , 3);
	TextDrawTextSize(Hour, 0.5, 1);
	TextDrawColor(Hour , 0xFFFFFFFF);
	TextDrawSetOutline(Hour , 1);
	TextDrawSetProportional(Hour , 1);
	TextDrawSetShadow(Hour , 1);

	SetTimer("Clock", 100, true);
__________________
[S]peed_.
BrianFaria is offline   Reply With Quote
Old 01/12/2016, 01:13 PM   #3
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,077
Reputation: 283
Default Re: clock problem

Put this code
PHP Code:
new yearsmonthsdayshoursminutessecondsdata[128], clock[128];
    
getdate(yearsmonthsdays);
     
gettime(hoursminutesseconds);
    
format(data128"%i/%i/%i"daysminutesyears);
    
format(clock128"%i:%i:%i"hoursminutesseconds);
    
TextDrawSetString(Datedata);
    
TextDrawSetString(Hourdata);
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
               
TextDrawShowForPlayer(i,Date);
             
TextDrawShowForPlayer(i,Hour);
         }
    }
    return 
1
in OnPlayerConnect or OnPlayerSpawn I'm not very experienced in textdraw but if I were you, I would have tried this
__________________

|===[Web taxi]===|
List of my work
Github
Pastebin

|===[Interesting topics]===|
Semantic Versioning
Eoussama is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clock problem AwP_sTyLE Scripting Help 9 11/09/2012 08:48 AM
Clock Problem tutibubu Scripting Help 1 27/07/2012 09:46 AM
clock problem darksone Help Archive 2 20/04/2011 08:47 AM
[FilterScript] [FS]LuX TDC! (The Digital Clock) (Realistic and advanced clock) LuxurioN™ Filterscripts 50 02/02/2011 02:07 PM
IG clock problem Outcast Help Archive 0 23/01/2011 08:29 PM


All times are GMT. The time now is 11:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.