Marggraf 139 Posted November 19, 2016 Share Posted November 19, 2016 hi guys,how to print in chat the current date ?? i want code for questlua_global Link to comment Share on other sites More sharing options...
VegaS 1087 Posted November 19, 2016 Share Posted November 19, 2016 (edited) Debug: //@svn/Server/game/common/service.h #define ENABLE_LUA_FUNCTION_TIME //@svn/Server/game/src/game/questlua_global.cpp //1.) Search: int _get_global_time(lua_State* L) { lua_pushnumber(L, get_global_time()); return 1; } //2.) Add bellow: #ifdef ENABLE_LUA_FUNCTION_TIME /* © Dick of VegaS™ */ #include <time.h> /* time_t, struct tm, time, localtime */ int _print_datetime(lua_State* L) { time_t currentTime; struct tm *localTime; time(¤tTime); localTime = localtime(¤tTime); CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_NOTICE, "%s", asctime(localTime)); return 0; } #endif //3.) Search: { "get_global_time", _get_global_time }, //4.) Add bellow: #ifdef ENABLE_LUA_FUNCTION_TIME { "print_datetime", _print_datetime }, #endif //@usr/home/game/share/locale/germany/quest_functions: print_datetime //@usr/home/game/share/locale/germany/lua_test.lua: quest lua_test begin state start begin when login begin print_datetime() end end end If u want to check only one things you can call with this example: int mYear = localTime->tm_year; CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_NOTICE, "Year: %d", mYear); tm_sec int seconds after the minute 0-61* tm_min int minutes after the hour 0-59 tm_hour int hours since midnight 0-23 tm_mday int day of the month 1-31 tm_mon int months since January 0-11 tm_year int years since 1900 tm_wday int days since Sunday 0-6 tm_yday int days since January 1 0-365 tm_isdst int Daylight Saving Time flag Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now