.txt file has 0 lines (skUtilities)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

QmanRocks

New Member
Aug 2, 2021
7
0
1
16
I'm setting up a server, and one of the commands is for custom join/leave messages. It's a Bungeecord server, so I make it a .txt file when they input it. That way, all the servers can access it for when the player leaves/joins. However, when I have it make the .txt file, it says that the file only has 0 lines, and it doesn't save what the player says on line 1. Here's the code I have right now, which doesn't work. Any help would be greatly appreciated.
Code:
command /joinmsg <text>:
    permission: skript.joinmsg
    usage: /joinmsg <custom message to be displayed when you join>
    trigger:
        if directory "../JoinMessages" doesn't exist:
            create directory "../JoinMessages"
        if file "../JoinMessages/%{playername}%.txt" doesn't exist:
            create file "../JoinMessages/%{playername}%.txt"
        set line 1 in file "../JoinMessages/%{playername}%.txt" to "%{playername}%> %arg 1%"
        set file "../JoinMessages/%{playername}%.txt"'s line 1 to "%{playername}%> %arg 1%"
        message "Set &o%arg 1% &ras your custom join message."
        
command /leavemsg <text>:
    permission: skript.leavemsg
    usage: /leavemsg <custom message to be displayed when you leave>
    trigger:
        if directory "../LeaveMessages" doesn't exist:
            create directory "../LeaveMessages"
        if file "../LeaveMessages/%{playername}%.txt" doesn't exist:
            create file "../LeaveMessages/%{playername}%.txt"
        set line 1 in file "../LeaveMessages/%{playername}%.txt" to "%{playername}%> %arg 1%"
        message "Set &o%arg 1% &ras your custom leave message."
 
Status
Not open for further replies.