Jump to content
  • 0

Problema ceas


Sealand123

Question

Problema intalnita (descriere):Ceas samp
Ero(area / rile) / warning-(ul / urile):Niciuna
Liniile de cod / sursa / script-ul:public ClockSeconds()

{
new string[24];
 
if(SecondsTD != 59)
{
SecondsTD ++;
}
else
{
   SecondsTD = 0;
   MinutesTD ++;
}
 
if(MinutesTD == 59)
{
   MinutesTD = 0;
   HoursTD ++;
}
if(HoursTD > 23)
{
HoursTD = 0;
}
//-----------------------------------------------
if(MinutesTD < 10)
{
format(string, sizeof(string),":0%d",MinutesTD);
}
else
{
   format(string, sizeof(string),":%d",MinutesTD);
}
TextDrawSetString(Textdraw56, string);
 
//-----------------------------------------------
if(SecondsTD < 10)
{
format(string, sizeof(string),":0%d",SecondsTD);
 
}
else
{
   format(string, sizeof(string),":%d",SecondsTD);
}
TextDrawSetString(Textdraw57, string);
 
//-----------------------------------------------
if(HoursTD < 10)
{
format(string, sizeof(string),"0%d",HoursTD);
 
}
else
{
   format(string, sizeof(string),"%d",HoursTD);
}
TextDrawSetString(Textdraw58, string);

Imagini / Video (optional):
Ati incercat sa rezolvati singur?:De saptamani ma chinui

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Problema intalnita (descriere):Ceas samp

Ero(area / rile) / warning-(ul / urile):Niciuna

Liniile de cod / sursa / script-ul:public ClockSeconds()

{
new string[24];
 
if(SecondsTD != 59)
{
SecondsTD ++;
}
else
{
   SecondsTD = 0;
   MinutesTD ++;
}
 
if(MinutesTD == 59)
{
   MinutesTD = 0;
   HoursTD ++;
}
if(HoursTD > 23)
{
HoursTD = 0;
}
//-----------------------------------------------
if(MinutesTD < 10)
{
format(string, sizeof(string),":0%d",MinutesTD);
}
else
{
   format(string, sizeof(string),":%d",MinutesTD);
}
TextDrawSetString(Textdraw56, string);
 
//-----------------------------------------------
if(SecondsTD < 10)
{
format(string, sizeof(string),":0%d",SecondsTD);
 
}
else
{
   format(string, sizeof(string),":%d",SecondsTD);
}
TextDrawSetString(Textdraw57, string);
 
//-----------------------------------------------
if(HoursTD < 10)
{
format(string, sizeof(string),"0%d",HoursTD);
 
}
else
{
   format(string, sizeof(string),"%d",HoursTD);
}
TextDrawSetString(Textdraw58, string);

Imagini / Video (optional):

Ati incercat sa rezolvati singur?:De saptamani ma chinui

 

Si problema care e ? Ca eu nu inteleg decat "ceas samp" :| . Fi mai explicit .

Link to comment
Share on other sites

  • 0

Ramane in urma si pentru unii playeri ramane mai in urma, la nimeni nu arata acelasi timp

 

Asta fie pentru ca ai un host slab, fie playerii respectivi au pc-uri slabe . Scriptul pe care l-ai pus tu mie nu imi pare sa semene prea mult cu un ceas ... sincer e prima data cand vad asa, si eu nu prea l-as numi ceas :-?

Link to comment
Share on other sites

  • 0

L-am schimbat si merge cu 5 minute intainte pentru toata lumea....(zero ping hostul)

 

#include <a_samp>
#include <time>
#define FILTERSCRIPT
forward settime(playerid);
new Text:Time2, Text:Date;
 
public settime(playerid)
{
new string[256],year,month,day,hours,minutes,seconds;
getdate(year, month, day), gettime(hours, minutes, seconds);
format(string, sizeof string, "~w~%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
TextDrawSetString(Date, string);
format(string, sizeof string, "~w~%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
TextDrawSetString(Time2, string);
}
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, Time2);
TextDrawShowForPlayer(playerid, Date);
return 1;
}
public OnGameModeInit()
{
    SetTimer("settime",1000,true);
    Date = TextDrawCreate(547.000000,11.000000,"--");
    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.399999,1.600000);
    TextDrawColor(Date,0xffffffff);
    Time2 = TextDrawCreate(547.000000,28.000000,"--");
    TextDrawFont(Time2,3);
    TextDrawLetterSize(Time2,0.399999,1.600000);
    TextDrawColor(Time2,0xffffffff);
    SetTimer("settime",1000,true);
    return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.