SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Romnă/Romanian

 
 
Thread Tools Display Modes
Old 01/07/2016, 12:15 PM   #1
TheHonnor
Big Clucker
 
TheHonnor's Avatar
 
Join Date: Mar 2016
Posts: 69
Reputation: 1
Default Despre Timere - Need help

Hi yall.
Recent, am facut un post la sectiunea baietilor Americani in legatura cu timerele Unix.
Era de asteptat ca o sa apara unul si o sa imi dea link la un tutorial.
Tutorialul era plin numai cu gettime, eu aveam nevoie de exemple.
Acum apelez la voi.

Stie oricine cum pot incadra un timer intr-un ClientMessage?
Adica, sa fie ceva gen: "You have to wait 03:24 minutes to enter that checkpoint!"
TheHonnor is offline  
Old 01/07/2016, 07:25 PM   #2
Johhnyllll
Huge Clucker
 
Johhnyllll's Avatar
 
Join Date: Sep 2014
Posts: 228
Reputation: 8
Default Re: Despre Timere - Need help

Hmmm, aveai in vedere asta?: How to: Unix timestamps
__________________
: GitHub
Johhnyllll is offline  
Old 01/07/2016, 08:13 PM   #3
TheHonnor
Big Clucker
 
TheHonnor's Avatar
 
Join Date: Mar 2016
Posts: 69
Reputation: 1
Default Re: Despre Timere - Need help

Da, exact. Dar stiu si eu sa folosesc gettime, stiu sa impun conditii pentru un anumit timp de utilizare unei comenzi, dar nu stiu sa convertesc acea suma care rezulta din gettime in minute si secunde. Ma gandesc ca e vreo functie pe care nu o stiu eu face.
TheHonnor is offline  
Old 02/07/2016, 09:45 AM   #4
Johhnyllll
Huge Clucker
 
Johhnyllll's Avatar
 
Join Date: Sep 2014
Posts: 228
Reputation: 8
Default Re: Despre Timere - Need help

Quote:
Originally Posted by TheHonnor View Post
Da, exact. Dar stiu si eu sa folosesc gettime, stiu sa impun conditii pentru un anumit timp de utilizare unei comenzi, dar nu stiu sa convertesc acea suma care rezulta din gettime in minute si secunde. Ma gandesc ca e vreo functie pe care nu o stiu eu face.
Acolo se spune cum se converteaza:
PHP Code:
1 minute (60 secondsis 60 60
2 minutes 
(120 secondsis 60 120

1 hour 
(60 minutesis 60 60 3600
2 hours 
(120 minutesis 60 120 7200

1 day 
(24 hoursis 60 60 24 86400 
2 days 
(48 hoursis 60 60 48 172800

1 week 
(7 daysis 60 60 24 604800
2 weeks 
(14 daysis 60 60 24 14 1209600

1 month 
(30 daysis 60 60 24 30 2592000
2 months 
(60 daysis 60 60 24 60 5184000

1 year 
(365 daysis 60 60 24 365 31536000
2 years 
(730 daysis 60 60 24 730 63072000 
P.S: Totul este in secunde.
__________________
: GitHub
Johhnyllll is offline  
Old 02/07/2016, 10:20 PM   #5
Spmn
Gangsta
 
Join Date: Jun 2015
Location: Romania
Posts: 541
Reputation: 129
Default Re: Despre Timere - Need help

Intrebarea nu tine de SA-MP, ci tine de matematica in general.
Sa spunem ca in variabila iTimeElapsed se afla diferenta in secunde intre doua unix timestamps, atunci:
Code:
new iMinutes, iSeconds, szMessage[144+1];

iMinutes = iTimeElapsed / 60;
iSeconds = iTimeElapsed % 60;

format(szMessage, sizeof(szMessage), "Au trecut %02i minute si %02i secunde.", iMinutes, iSeconds);
Am scris %02i in loc de %i pentru ca mereu numarul afisat sa aiba 2 cifre, asadar numarul 5 va fi afisat ca 05, iar 15 va fi afisat ca 15.
Spmn is offline  
 

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



All times are GMT. The time now is 02:21 AM.


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