SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/10/2011, 05:07 AM   #1
Jovanny
Banned
 
Join Date: Oct 2010
Location: Siиαloα
Posts: 1,482
Reputation: 0
Default strftime

strftime

Well, I'm starting in c + + plugin that I made this little function based on C + + strftime

Why is it called strftime?
This means that you give the format you want at the time, this has a similar use ah
pawn Code:
format

What makes this plugin is to get the server time in different ways, 12-hour format | am, pm | itself in many ways as you want to get it.

EDIT: If the especifier does not exist crash the server!!

Examples:

Example #1
pawn Code:
#include <strftime>
public OnFilterScriptInit()
{
       new time[20];
       strftime("%I:%M %p",time);
       print(time);
       return 1;
}
Console
Code:
10:05 PM
Example #2
pawn Code:
#include <strftime>
public OnFilterScriptInit()
{
       new time[20];
       strftime("%I:%M:%S %p",time);
       print(tiempo);
       return 1;
}
Console
Code:
10:05:43 PM
Example #3
pawn Code:
#include <strftime>
public OnFilterScriptInit()
{
       new time[20];
       strftime("%p",time);
       print(time);
       return 1;
}
Console
Code:
PM

Especifiers
Code:
%a - Abbreviated weekday name 
%A - Full weekday name 
%b - Abbreviated month name  
%B - Full month name  
%c - Date and time representation  
%d - Day of the month (01-31)  
%H - Hour in 24h format (00-23) 
%I - Hour in 12h format (01-12)  
%j - Day of the year (001-366)  
%m - Month as a decimal number (01-12)  
%M - Minute (00-59)  
%p - AM or PM designation  
%S - Second (00-61)  
%U - Week number with the first Sunday as the first day of week one (00-53)  
%w - Weekday as a decimal number with Sunday as 0 (0-6) 
%W - Week number with the first Monday as the first day of week one (00-53)  
%x - Date representation  
%X - Time representation  
%y - Year, last two digits (00-99)  
%Y - Year  
%Z - Timezone name or abbreviation  
%% - A % sign
Download:Windows dll + Linux so+ source

Thanks to CyNiC for compile the plugin to linux version

Credits: Josta ( Create the plugin)
Credits: the_chaoz ( helpme whit c++)

Note: Sorry for my bad English, use a translator

Last edited by Jovanny; 09/10/2011 at 07:03 PM. Reason: Post updated!
Jovanny is offline   Reply With Quote
Old 09/10/2011, 05:10 AM   #2
Kar
High-roller
 
Join Date: May 2010
Location: Black Asylum
Posts: 2,895
Reputation: 286
Default Re: strftime

Nice, i'd like to test but can anyone put up a linux link?
__________________

  • Twisted Metal's Website & Forums are up! http://tm.lvcnr.net

    Are you prepared to get your wish? Twisted Metal SA-MP is coming soon! Join the IRC Channel: #tm on irc.tl - @tmsamp_dev

server.lvcnr.net:7777 | samp://server.lvcnr.net:7777
www.lvcnr.net | @kcnrdev
Channel: #lvcnr on irc.tl
Kar is offline   Reply With Quote
Old 09/10/2011, 05:56 AM   #3
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Pakistan
Posts: 1,410
Reputation: 65
Default Re: strftime

Nice work
__________________
HyperZ is offline   Reply With Quote
Old 09/10/2011, 05:59 AM   #4
Jovanny
Banned
 
Join Date: Oct 2010
Location: Siиαloα
Posts: 1,482
Reputation: 0
Default Respuesta: Re: strftime

Quote:
Originally Posted by HyperZ View Post
Nice work
Thanks :P
Jovanny is offline   Reply With Quote
Old 09/10/2011, 06:00 AM   #5
[L3th4l]
Guest
 
Posts: n/a
Default Re: strftime

Very nice!
  Reply With Quote
Old 09/10/2011, 06:41 AM   #6
(*|Flake|*)
High-roller
 
(*|Flake|*)'s Avatar
 
Join Date: Sep 2009
Location: Australia, Adelaide
Posts: 1,139
Reputation: 119
Default Re: strftime

Nice work man, Really nice!
__________________
(*|Flake|*) is offline   Reply With Quote
Old 09/10/2011, 06:55 AM   #7
Jovanny
Banned
 
Join Date: Oct 2010
Location: Siиαloα
Posts: 1,482
Reputation: 0
Default Respuesta: Re: strftime

Quote:
Originally Posted by (*|Flake|*) View Post
Nice work man, Really nice!
Thanks friend, is my first plugin in c ++
But would appreciate someone to compile for Linux
Jovanny is offline   Reply With Quote
Old 09/10/2011, 07:48 AM   #8
Zh3r0
Godfather
 
Join Date: Mar 2008
Posts: 5,593
Reputation: 381
Default Re: strftime

It's a nice piece of plugin. And about that problem that without a specifier it will crash.

I bet there is a way to stop that.
__________________
Zh3r0 is offline   Reply With Quote
Old 09/10/2011, 08:15 AM   #9
thiaZ_
Big Clucker
 
Join Date: Nov 2009
Posts: 169
Reputation: 7
Default Re: strftime

I also made a strftime plugin, wanted to release it the other day, but seems kinda useless now, that specifier blocking was an easy check for me.
thiaZ_ is offline   Reply With Quote
Old 09/10/2011, 08:17 AM   #10
GangsTa_
High-roller
 
GangsTa_'s Avatar
 
Join Date: May 2010
Location: Republic of Moldova
Posts: 1,149
Reputation: 51
Default Re: strftime

Good job.
__________________
Gigabyte GA-970A-D3
AMD FX-6300 3.5GHz 14MB AM3+
Zalman CNPS10X Cooler
Crucial 8,00GB (2x4GB) DDR3 PC3-10600 Ballistix Sport
XFX Radeon R9 270X 2GB GDDR5 256-bit 1000/5600
Western Digital Black 500GB 7200rpm 16MB SATA-III
Zalman Z9 Plus Black ATX
Zalman ZM500-LE 500W
GangsTa_ 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
[Plugin] JP - strftime Jovanny Lanzamientos/Releases 18 12/10/2011 11:22 AM


All times are GMT. The time now is 10:09 PM.


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