1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved file help....

Discussion in 'Skript' started by MEncrp, Jul 13, 2018 at 6:25 AM.

Tags:
  1. M

    MEncrp Member

    Joined:
    Friday
    Messages:
    4
    Likes Received:
    0
    Hello! I want to create a file that can store player data and change it (for example, A player joining the server will generate an A player's profile. yml)
    This is my skript:


    Code (Skript):
    1. options:
    2.     #系統設定#
    3.     #---玩家檔案---#
    4.     player_file: "plugins\Sug\player\%uuud of player%(%player%).yml"
    5.  
    6.  
    7.  
    8. On Join:
    9.     if {資料系統(v0.001).%player%} is not set:
    10.         if {新玩家123te.%player%} is not set:
    11.             set {資料系統(v0.001).%player%} to player
    12.             set {新玩家.%player%} to player
    13.             message "&f&l系統&7&l>&a&l正在創建資料中. . .!&c&l由於您是新加入的可能需要花個&f&l10秒&c&l~&f&l3分鐘"
    14.             create file {@player_file}
    15.             wait 50 tick
    16.             set {創建資料(1)} to a random integer between 3 and 8
    17.             message "&f&l系統&7&l>&a&l正在創建資料中. . .!&d&l%{創建資料(1)}%/100..."
    18.             wait 3 tick
    19.             delete {創建資料(1)}
    20.             set {玩家的勝場.player} to 0
    21.             set {創建資料(2)} to a random integer between 9 and 35
    22.             message "&f&l系統&7&l>&a&l正在寫入資料中. . .!&d&l%{創建資料(2)}%/100..."
    23.             wait 3 tick
    24.             delete {創建資料(2)}
    25.             wait 30 tick
    26.             write "#玩家資料#" at line 1 to file {player_file}
    27.             write "玩家ID : %player%" at line 2 to file {player_file}
    28.             write "玩家UUID : %uuid of player%" at line 3 to file {player_file}
    29.             write "玩家勝場 : %{玩家的勝場.player}%" at line 4 to file {player_file}
    30.             write "玩家勝場 : %{玩家的金錢.player}%" at line 5 to file {player_file}
    31.             wait 150 tick
    32.             set {創建資料(3)} to a random integer between 50 and 79
    33.             message "&f&l系統&7&l>&a&l正在校驗資料中. . .!&d&l%{創建資料(3)}%/100..."
    34.             wait 3 tick
    35.             delete {創建資料(3)}
    36.             wait 10 tick
    37.             message "&f&l系統&7&l>&a&l完成! 歡迎你的到來!"
    38.         if {新玩家.%player%} is set:
    39.             message "&f&l系統&7&l>&a&l正在更新中. . .!&c&l可能需要花一些時間"


    En:

    Code (Skript):
    1. Options:
    2. #system program#
    3. #--- Player Profile---#
    4. Player_file: "plugins\Sug\player\%uuud of player%(%player%).yml"
    5.  
    6.  
    7.  
    8. On Join:
    9. If {data system (v0.001).%player%} is not set:
    10. If {new player 123te.%player%} is not set:
    11. Set {data system (v0.001).%player%} to player
    12. Set {new player.%player%} to player
    13. Message "&f&l system &7&l>&a&l is creating the data. . .!&c&l may need to spend a &f&l10 seconds &c&l~&f&l3 minutes because you are new to join"
    14. Create file {@player_file}
    15. Wait 50 tick
    16. Set {create data(1)} to a random integer between 3 and 8
    17. Message "&f&l system &7&l>&a&l is creating data. . .!&d&l%{Create material(1)}%/100..."
    18. Wait 3 tick
    19. Delete {create material(1)}
    20. Set {the player's win.player} to 0
    21. Set {create data(2)} to a random integer between 9 and 35
    22. Message "&f&l system &7&l>&a&l is writing in the data. . .!&d&l%{Create material(2)}%/100..."
    23. Wait 3 tick
    24. Delete {create material (2)}
    25. Wait 30 tick
    26. Write "# player data#" at line 1 to file {player_file}
    27. Write "Player ID: %player%" at line 2 to file {player_file}
    28. Write "player UUID : %uuid of player%" at line 3 to file {player_file}
    29. Write "The player wins: %{the player's win.player}%" at line 4 to file {player_file}
    30. Write "Player wins: %{player's money.player}%" at line 5 to file {player_file}
    31. Wait 150 tick
    32. Set {create data(3)} to a random integer between 50 and 79
    33. Message "&f&l system &7&l>&a&l is verifying the data. . .!&d&l%{Create material(3)}%/100..."
    34. Wait 3 tick
    35. Delete {create material(3)}
    36. Wait 10 tick
    37. Message "&f&l system &7&l>&a&l complete! Welcome to your arrival!"
    38. If {new player.%player%} is set:
    39. Message "&f&l system &7&l>&a&l is being updated. . .!&c&l may take some time"

    My problem is that he doesn't create a file, but I'm not sure if he will type in the file.

    plz help me
     
  2. Efnilite

    Efnilite Well-Known Member

    Joined:
    May 12, 2018
    Messages:
    130
    Likes Received:
    3
    You used 'uuud of player' and you use the most inefficient way of storing vars. Use vars for a player like
    Code (Skript):
    1. {wins::%player%}
    2. {coins::%player%}
    And to use SkUtils yaml, use:
    Code (Skript):
    1. set {file::%player}} to "plugins\Sug\player\%uuid of player%(%player%).yml"
    2. create file "%{file::%player%}%"
    3.  
    4. write "## player data of %player%" at line 1 of file "%{file::%player%}%"
    5. write "coins: %{coins::%player%}%" at line 2 of file "%{file::%player%}%"
    6.  
    Dont use spaces in vars but instead use '.' or '::', but :: is better. Btw why do you use '( )' in your vars? Just use like {data::%player%::version-1}
     
  3. M

    MEncrp Member

    Joined:
    Friday
    Messages:
    4
    Likes Received:
    0
    don't work

    Code (Skript):
    1.  
    2. On Join:
    3. If {data system (v0.003).%player%} is not set:
    4. If {new player 123te.%player%} is not set:
    5. Set {data system (v0.003).%player%} to player
    6. Set {new player.%player%} to player
    7. Message "&f&l system &7&l>&a&l is creating the data. . .!&c&l may need to spend a &f&l10 seconds &c&l~&f&l3 minutes because you are new to join"
    8. Set {file::%player} to "plugins\Sug\player\%uuid of player%(%player%).yml"
    9. Create file "%{file::%player%}%"
    10. Wait 50 tick
    11. Set {create data(1)} to a random integer between 3 and 8
    12. Message "&f&l system &7&l>&a&l is creating data. . .!&d&l%{Create material(1)}%/100..."
    13. Wait 3 tick
    14. Delete {create material(1)}
    15. Set {the player's win.player} to 0
    16. Set {create data(2)} to a random integer between 9 and 35
    17. Message "&f&l system &7&l>&a&l is writing in the data. . .!&d&l%{Create material(2)}%/100..."
    18. Wait 3 tick
    19. Delete {create material (2)}
    20. Wait 30 tick
    21. Write "# player data#" at line 1 to file "%{file::%player%}%"
    22. Write "Player ID: %player%" at line 2 to file "%{file::%player%}%"
    23. Write "player UUID : %uuid of player%" at line 3 to file "%{file::%player%}%"
    24. Write "The player wins : %{wins::%player%}%" at line 4 to file "%{file::%player%}%"
    25. Write "player money : %{coins::%player%}%" at line 5 to file "%{file::%player%}%"
    26. Wait 150 tick
    27. Set {create data(3)} to a random integer between 50 and 79
    28. Message "&f&l system &7&l>&a&l is verifying the data. . .!&d&l%{Create material(3)}%/100..."
    29. Wait 3 tick
    30. Delete {create material(3)}
    31. Wait 10 tick
    32. Message "&f&l system &7&l>&a&l complete! Welcome to your arrival!"
    33. If {new player.%player%} is set:
    34. Message "&f&l system &7&l>&a&l is being updated. . .!&c&l may take some time"
     
  4. Efnilite

    Efnilite Well-Known Member

    Joined:
    May 12, 2018
    Messages:
    130
    Likes Received:
    3
    What dke
    What doesnt work? Install SkUtilities before this works here:
    https://forums.skunity.com/resources/skutilities.26/

    Can you post your errors?
     
  5. M

    MEncrp Member

    Joined:
    Friday
    Messages:
    4
    Likes Received:
    0
    Sorry, my fault.
    Is work!
     
  6. D0XY

    D0XY Active Member

    Joined:
    May 4, 2018
    Messages:
    33
    Likes Received:
    0
    Set thread as solved
     
Loading...