Search

open.mp forum

RegisterLogin

Discussion

General
Chat
Tech
Life
Art
Programming
open.mp
Development Updates
Questions and Suggestions
SA-MP
General Discussions
Videos and Screenshots
Support
Pawn Scripting
Tutorials
Releases
Plugins
Libraries
Filterscripts
Gamemodes
Maps
Advertisements
Other languages
Spanish/Espa?ol
Programaci?n
Discusi?n GTA SA Multijugador
Mods
Offtopic
Juegos
Portuguese/Portugu?s
Russian/???????
Italian/Italiano
Dutch/Nederlands
German/Deutsch
Romanian/Rom?na
Ex-Yu
Polish/Polski
Og?lne
Serwery
Skryptowanie
Filmiki i zdjecia
Lithuanian/Lietuvi?kas
French/Fran?ais
Hungarian/Magyar
Hindi/Urdu
Turkish
Other
Internal
Team
Hidden
Archived

Library

 Collections Links Members Roles

Problem with ctime

Hey im using southclaws pawn-ctime version (https://github.com/Southclaws/pawn-ctime) and actually got a problem with my...

ID
d6ouivfilegovhg7bhig
author
demo's avatar

Demo

@demo


View profile
Copy link
  Report member
started
Oct 14, 2020
replies
0
participating
No

scroll to top

powered by storyden

Login
Discussion
Pawn Scripting
Problem with ctime
demo's avatar

Demo

@demo


View profile
Copy link
  Report member
• 5y
Pawn Scripting

Problem with ctime

pawn

Hey im using southclaws pawn-ctime version (https://github.com/Southclaws/pawn-ctime) and actually got a problem with my function "WhichDayWillItBe".

It worked fine before with Ryders version.



Function:

stock WhichDayWillItBe(const iDay)

{

? ? new 

? ? ? ? tmWhichDay[e_tm],

? ? ? ? thedate[6];



? ? localtime(Time:gettime(), tmWhichDay);

? ? 

? ? tmWhichDay[tm_mday] = iDay;



? ? mktime(tmWhichDay);

? 

? ? strftime(thedate, sizeof(thedate), "%d.%m", tmWhichDay);

? ? return thedate;

}







Example:

hook OnGameModeInit()

{

? ? for(new i = 0; i < 20; i)

? ? {

? ? ? ? new formdate[6], whichday2;

? ? ? ? whichday2 = -i; 

? ? ? ? format(formdate, sizeof(formdate), "%s",WhichDayWillItBe(whichday2));

? ? ? ? printf("Whichday[%d]: %s",i,formdate);

? ? }



? ? return 1;

}







Returns:

[02:49:57] Whichday[0]: 14.09



... working fine till first day of a month but then:



[02:49:57] Whichday[12]: 02.09



[02:49:57] Whichday[13]: 01.09



[02:49:57] Whichday[14]: 00.09



[02:49:57] Whichday[15]: -1.09



[02:49:57] Whichday[16]: -2.09



[02:49:57] Whichday[17]: -3.09



[02:49:57] Whichday[18]: -4.09



[02:49:57] Whichday[19]: -5.09







Im using this to get the last 7 days in dd.mm format, after 01.09 it should actually show 31.08 but returns 00.09 ... -1.09 for me



Hope someone can help me with that.

0 likes0 replies

    Please sign up or log in to reply