SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 18/11/2018, 07:14 PM   #41
DIRTYBYT3
Big Clucker
 
DIRTYBYT3's Avatar
 
Join Date: Sep 2018
Location: DYRTYBYT3#2856
Posts: 87
Reputation: 11
Default Re: Chrono - Modern Plugin for Working With Dates and Times

This is beautiful!!! OMG... EXELLENT!!!
__________________
DIRTYBYT3 is offline   Reply With Quote
Old 16/12/2018, 05:25 PM   #42
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Pakistan
Posts: 1,571
Reputation: 290
Default Re: Chrono - Modern Plugin for Working With Dates and Times

Is there leap year support?

---

PHP Code:
ReturnDate(timestampdate[]) {
    
    
TimeFormat(timestamp""WEEKDAY_NAME_ABV", "DAY_OF_MONTH" "MONTH_NAME_ABV" "YEAR""date);


TimeFormat line is giving me a tag mismatch warning and I use this function wherever I need to convert the timestamp whether from the database, Now or gettime().
__________________
Developer @ Nevada State Prison RP/ Core Roleplay;

Cheap game-host (SA-MP, SA-MP Hosted tab, G-MOD etc) @ www.prestigesteve.com

Former developer @ COD:BO3, COD:AW, I:RP, PC:RP, NEG, ZL TDM, CookieDM and IW:TDM.

  • You can't forcefully correct someone and you shouldn't waste your time on it because you can bring a horse to water but can't force it to drink.
  • Please don't message me asking for help, because by doing that, you're only limiting your support to one person when the whole community can help you here. Refer to scripting help section instead.
Logic_ is offline   Reply With Quote
Old 16/12/2018, 10:48 PM   #43
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,018
Reputation: 1581
Default Re: Chrono - Modern Plugin for Working With Dates and Times

Yes, it supports whatever C++ std::chrono supports. It'll be accurate and precise in terms of all the weird quirks of how time works around the world.

`TimeFormat` expects a `Timestamp:` tag: https://github.com/Southclaws/pawn-c...hrono.inc#L109 which is returned by `Now()`.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 18/12/2018, 09:15 AM   #44
AlfaSufaIndo
Big Clucker
 
Join Date: Oct 2016
Location: Jombang, East Java, Indonesia
Posts: 120
Reputation: 0
Default Re: Chrono - Modern Plugin for Working With Dates and Times

Code:
Error: Function not registered: 'Now'
Error: Function not registered: 'TimeFormat'
[debug] Run time error 19: "File or function is not found"
[debug]  Now
[debug]  TimeFormat
[debug] Run time error 19: "File or function is not found"
[debug]  Now
[debug]  TimeFormat
I got this error from the debug
AlfaSufaIndo is offline   Reply With Quote
Old 18/12/2018, 10:02 AM   #45
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,018
Reputation: 1581
Default Re: Chrono - Modern Plugin for Working With Dates and Times

That's just a generic error from the SA:MP server itself, the plugin hasn't loaded so the server can't route those function calls to the correct place. Make sure you've installed it properly, if you're using sampctl post your `sampctl package ensure --verbose` logs.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 28/01/2019, 05:29 PM   #46
Gabi3
Little Clucker
 
Join Date: Dec 2018
Posts: 7
Reputation: 0
Default Re: Chrono - Modern Plugin for Working With Dates and Times

I put the plugin chrono.dll in to plugins folder and got this error: fatal error 100: cannot read from file: "chrono". Why is that? :/
Gabi3 is offline   Reply With Quote
Old 28/01/2019, 08:39 PM   #47
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,018
Reputation: 1581
Default Re: Chrono - Modern Plugin for Working With Dates and Times

You've confused plugin binaries (.dll and .so files) with Pawn language source files. These two have absolutely no effect on each other.

Plugin binaries are only read at run time - aka, when you open samp-server.exe and Pawn source files (.pwn and .inc) are only read at compile time.

In other words, when you compile your script, the Pawn compiler (pawncc.exe) does not care about your plugin binaries, it doesn't know they exist and will not seek them out. So, the error you've seen there "cannot read from file" is actually referring to "chrono.inc", the Pawn source file that lists the function names that the server should expect to find in plugins when it runs.

This is caused by not having the "chrono.inc" file available to the Pawn compiler. If you're just using the old editor Pawno, you can fix this by ensuring that "chrono.inc" is present in the directory "./pawno/include/" which, if you haven't moved any folders, will be in your SA:MP server's directory.

That file ("chrono.inc") exists in the repository for this project, you can find it here: https://github.com/Southclaws/pawn-c...ter/chrono.inc
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 29/01/2019, 04:23 PM   #48
Gabi3
Little Clucker
 
Join Date: Dec 2018
Posts: 7
Reputation: 0
Default Re: Chrono - Modern Plugin for Working With Dates and Times

Quote:
Originally Posted by [HLF]Southclaw View Post
You've confused plugin binaries (.dll and .so files) with Pawn language source files. These two have absolutely no effect on each other.

Plugin binaries are only read at run time - aka, when you open samp-server.exe and Pawn source files (.pwn and .inc) are only read at compile time.

In other words, when you compile your script, the Pawn compiler (pawncc.exe) does not care about your plugin binaries, it doesn't know they exist and will not seek them out. So, the error you've seen there "cannot read from file" is actually referring to "chrono.inc", the Pawn source file that lists the function names that the server should expect to find in plugins when it runs.

This is caused by not having the "chrono.inc" file available to the Pawn compiler. If you're just using the old editor Pawno, you can fix this by ensuring that "chrono.inc" is present in the directory "./pawno/include/" which, if you haven't moved any folders, will be in your SA:MP server's directory.

That file ("chrono.inc") exists in the repository for this project, you can find it here: https://github.com/Southclaws/pawn-c...ter/chrono.inc
Thank you so much for answering my question. I do not want to bother you more, but after I put the chrono.inc file in the directory that you have mentioned before I get new errors like this:

pawno\include\chrono.inc(75) : error 075: input line too long (after substitutions)
pawno\include\chrono.inc(77) : error 010: invalid function or declaration

And the lines are:
#define HM_COLON "%R" // Equivalent to %H:%M.
#define TAB_CHAR "%t" // A horizontal-tab character.

Any ideas ?

Last edited by Gabi3; 29/01/2019 at 05:31 PM.
Gabi3 is offline   Reply With Quote
Old 29/01/2019, 07:59 PM   #49
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,018
Reputation: 1581
Default Re: Chrono - Modern Plugin for Working With Dates and Times

Ah, this is because this line is a long comment, the old compiler is so bad it can't even deal with long comments.

Upgrade to the compiler from this decade and you'll solve that, and many more issues!
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw 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
[HELP] Working with dates (Property Tax) WhoIsYourDaddy Scripting Help 4 20/03/2016 04:59 PM
SA-MP: Modern times JaKe Elite Everything and Nothing 14 10/11/2012 12:01 PM
Compare two dates and times.. Outbreak Help Archive 11 26/04/2009 05:31 PM


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


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