Jump to content

Quest Function - IS Weekend


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 20
  • kekw 1
  • Good 3
  • Love 9
Link to comment
https://metin2.dev/topic/8131-quest-function-is-weekend/
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
https://metin2.dev/topic/8131-quest-function-is-weekend/#findComment-50602
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
https://metin2.dev/topic/8131-quest-function-is-weekend/#findComment-50677
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
https://metin2.dev/topic/8131-quest-function-is-weekend/#findComment-50679
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
https://metin2.dev/topic/8131-quest-function-is-weekend/#findComment-50683
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
https://metin2.dev/topic/8131-quest-function-is-weekend/#findComment-50684
Share on other sites

  • 2 months later...

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.