Jump to content

Quest Function - IS Weekend


akaitoDEV

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hello guys,

 

this function is very old and i have shared it on another board already (not on metin2dev).

So this gives out a bool(true,false)

 

function is_weekend()
    local day = tonumber(os.date("%w"))
    return day > 4 or day == 0
end
  • Metin2 Dev 18
  • Good 3
  • Love 8
Link to comment
Share on other sites

  • Premium

try this

 

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end
Edited by MrLibya

If you're going to do something, then do it right.

Link to comment
Share on other sites

try this

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end

I am confused as to how this is supposed to work:

- weekend will hold the weekday as number (e.g 6)

- day will hold % + weekday's full name (e.g %Saturday) - or simply '%', not quite sure how it's parsed.

 

(ref for what the os.date yields: http://www.cplusplus.com/reference/ctime/strftime/).

  • Love 1
Link to comment
Share on other sites

try this

 

 

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end

 

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == "Saturday" then
        return true
    else
        return false
    end
end

try this

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end

I am confused as to how this is supposed to work:

- weekend will hold the weekday as number (e.g 6)

- day will hold % + weekday's full name (e.g %Saturday) - or simply '%', not quite sure how it's parsed.

 

(ref for what the os.date yields: http://www.cplusplus.com/reference/ctime/strftime/).

Hahahahaha lol :)

Edited by Rideas
Link to comment
Share on other sites

  • Premium

try this

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end

I am confused as to how this is supposed to work:

- weekend will hold the weekday as number (e.g 6)

- day will hold % + weekday's full name (e.g %Saturday) - or simply '%', not quite sure how it's parsed.

 

(ref for what the os.date yields: http://www.cplusplus.com/reference/ctime/strftime/).

ok it's my falt

i have see in lua that is give string https://metin2.download/picture/Cz8ytZEw8hs20260NyIdJHibQb1v3YO7/.png

now i see it agien and i see it's give number

Edited by Metin2 Dev
Core X - External 2 Internal

If you're going to do something, then do it right.

Link to comment
Share on other sites

try this

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == weekend
        return true
    else
        return false
    end
end

I am confused as to how this is supposed to work:

- weekend will hold the weekday as number (e.g 6)

- day will hold % + weekday's full name (e.g %Saturday) - or simply '%', not quite sure how it's parsed.

 

(ref for what the os.date yields: http://www.cplusplus.com/reference/ctime/strftime/).

ok it's my falt

i have see in lua that is give string https://metin2.download/picture/Cz8ytZEw8hs20260NyIdJHibQb1v3YO7/.png

now i see it agien and i see it's give number

 

function is_weekend()
    local weekend = os.date("%w")
    local day = os.date("%%A")
    if day == "Saturday" then
        return true
    else
        return false
    end
end
Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • 2 months later...

Announcements



  • Similar Content

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.