open.mp forum
[Pawn] date_format convert to my language - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] date_format convert to my language (/showthread.php?tid=1810)



date_format convert to my language - Zow - 2021-03-26

PHP Code:
Month_Convert(month) {     new string[12];     new monthmsg[12]; switch(month) {     case 1:  monthmsg = "มกราคม";     case 2:  monthmsg = "กุมภาพันธ์";     case 3:  monthmsg = "มีนาคม";     case 4:  monthmsg = "เมษายน";     case 5:  monthmsg = "พฤษภาคม";     case 6:  monthmsg = "มิถุนายน";     case 7:  monthmsg = "กรกฎาคม";     case 8:  monthmsg = "สิงหาคม";     case 9:  monthmsg = "กันยายน";     case 10: monthmsg = "ตุลาคม";     case 11: monthmsg = "พฤศจิกายน";     case 12: monthmsg = "ธันวาคม"; } format(string, sizeof(string), "%s", monthmsg); return string; }


PHP Code:
hook OnPlayerLogin(playerid) {     inline _LoadVIP()     {         new             expire,             expiry_date[3],             expiry_month,             expiry_year[5],             expiry_time[10],             rows         ;         cache_get_row_count(rows);         if(rows) {             cache_get_value_name_int(0, "vip_level", Player_VIPLevel[playerid]);             cache_get_value_name(0, "expirydate", expiry_date, sizeof(expiry_date));             cache_get_value_name_int(0, "expirymonth", expiry_month);             cache_get_value_name(0, "expiryyear", expiry_year, sizeof(expiry_year));             cache_get_value_name(0, "expirytime", expiry_time, sizeof(expiry_time));             cache_get_value_name_int(0, "expire", expire);             if (expire <= 0) {                 VIP_RemovePlayer(playerid);                 va_SendClientMessage(playerid, COLOR_RED, "VIP ของคุณหมดอายุแล้ว %s %s %s %s!", expiry_date, Month_Convert(expiry_month), expiry_year, expiry_time);                 Player_VIPLevel[playerid] = 0;                 return;             }             va_SendClientMessage(playerid, COLOR_BLUE, "คุณคือ VIP ระดับ %d", VIP_GetPlayerLevel(playerid));             va_SendClientMessage(playerid, COLOR_RED, "จะหมดอายุใน %s %s %s %s", expiry_date, Month_Convert(expiry_month), expiry_year, expiry_time);         }     }     static const query[] = "\         SELECT \             vip_level, \             DATE_FORMAT(vip_expire_date, '%%d') as expirydate, \             DATE_FORMAT(vip_expire_date, '%%m') as expirymonth, \             DATE_FORMAT(vip_expire_date, '%%Y') as expiryyear, \             DATE_FORMAT(vip_expire_date, '%%T') as expirytime, \             TIMESTAMPDIFF(SECOND, CURRENT_TIMESTAMP(), vip_expire_date) as expire \         FROM \             vips \         WHERE \             u_id = %d\     ";     MySQL_TQueryInline(MySQL_GetHandle(), using inline _LoadVIP, query, Player_GetAccountID(playerid)); }

I feel so weird to this one 
any suggest? or just keep it

PHP Code:
    static const query[] = "\         SELECT \             vip_level, \             DATE_FORMAT(vip_expire_date, '%%d') as expirydate, \             DATE_FORMAT(vip_expire_date, '%%m') as expirymonth, \             DATE_FORMAT(vip_expire_date, '%%Y') as expiryyear, \             DATE_FORMAT(vip_expire_date, '%%T') as expirytime, \             TIMESTAMPDIFF(SECOND, CURRENT_TIMESTAMP(), vip_expire_date) as expire \         FROM \             vips \         WHERE \             u_id = %d\     ";

here's the original one from gta-open

PHP Code:
    static const query[] = "\         SELECT \             vip_level, \             DATE_FORMAT(vip_expire_date, '"SQL_DATETIME_FORMAT"') as expiry, \             TIMESTAMPDIFF(SECOND, CURRENT_TIMESTAMP(), vip_expire_date) as expire \         FROM \             vips \         WHERE \             u_id = %d\     ";