@name VK_Player_CLS @persist [ Playlist NowPlaylist Commands ]:table [ MusicList WaitMessage ]:array [ O FollowEnt ]:entity @persist [ Prefix Password MusicTableButton Mode User ReqUser API_Link LastMode MusicInfoButton ]:string @persist Page PageLen MusicTableShow MusicInfoShow CycleType UserMusicCount PlaylistId Chunk IsChanged Try ShuffleCounter @persist LastIndex LastPage ChunkLastPage Deviation NowTime IsLoading Now IsPlaying Volume NowIndex NowCountMusic @model models/props_lab/citizenradio.mdl if(first()) { # Work only izbushechka!!! ######################################################################## ## ATTETION!!!!! There is a request limit on the server. BE SLOWER!!! ## ######################################################################## #[ How use it? Izi. There are settings. You can change anything. But follows the comments. !!! To begin with, you must open access to your audio in VK. !!! !!! It is necessary! !!! Buttons: n - open music table p - open music info Prefix(default) - "!!" Commands: !!search - make search. There are two modes - "local" and "global" local mode - search in the current user (see varible "User") global mode - search in the "global search". sorry for tautology... Its izi pizi !!get - get user audio. and this is also izi. If you have not written nothing then it is searching in "User" !!playlists - same as "!!get" but load playlists !!select - select playlist in "playlists". Just give the playlist index. The Index is in the playlist name Example: 11. System Of A Down - Best Songs | Count: 10 Index - 11 !!play - play music. Just give the audio index !!play - toggle pause/resume The Index is in the music name Example: 456. System Of A Down - Toxicity | [00:04:00] Index - 456 !!stop - stop music. yeah !!set - this function is more hard but convenient if you learn how to use it. All arguments except are optional. Unspecified argument is equal to current value. Example: Audio time - [00:02:10] !!set 50 --> [00:02:50] !!set 0 4 1 --> [01:04:00] !!set - 4 1 --> [01:04:10] !!set - - - --> [00:02:10] !!set - --> [00:02:10] izi !!shuffle - shuffle music (mix music). Works only on current chunk. And work if your music is disabled. !!vol <0-100> - set audio volume !!goto - go to audio through the index !!page - set page !!next and !!prev - next audio and previouse audio !!cycle <0-2 or nothing> - set cycle type. 0 - cycle off, 1 - around list, 2 - arround track !!owner - change main owner Vars: You can change Vars, which are below Chunk - eto skolko budet zagrujeno za raz. PageLen - kol-vo audio in one page Also see API Docs if you developer - https://arturka.net/vk-music/ For all questions and errors, please contact with me. Contacts: VK: @kamasutra2281337 Tg: @homus32 ]# #[ Settings Var ]# # You can change this vars User = "kamasutra2281337" # You can change vk user. Prefix = "!!" # You can change comand prefix Password = "5qwx0c8ii94q" # API Password MusicTableButton = "n" MusicInfoButton = "p" Chunk = 500 # >700 !!! PageLen = 12 # >Chunk !!! API_Link = "https://arturka.net/vk-music" # API URI. Without last slash. Dont change FollowEnt = owner() Volume = 100 # Default volume # You can change commands name - see Commands table Commands = table( "search" = "c_search", "get" = "c_get", "playlists" = "c_playlists", "select" = "c_playlist", "play" = "c_audio_toggle", "stop" = "c_stop_music", "set" = "c_set_time", "shuffle" = "c_shuffle_music", "vol" = "c_volume", "goto" = "c_go_to_audio", "page" = "c_set_page", "next" = "c_next_audio", "prev" = "c_prev_audio", "cycle" = "c_cycle_audio", "owner" = "c_set_user" ) #[ Stop Config ]# #[ User: dont stop me noooow!! ]# runOnChat(1) runOnHTTP(1) runOnSoundURL(1) soundURLPurge() #noDuplications() O = owner() runOnKeys(O, 1, array(MusicTableButton, MusicInfoButton)) dPanel("Music",vec2((scrW() / 2) + 270, (scrH() / 2) + 70),vec2(400, 300)) dListBox("List", "Music", vec2(10, 35), vec2(380, 220)) dButton(">", "Music", vec2(320, 265), vec2(60, 20)) dButton("<", "Music", vec2(20, 265), vec2(60, 20)) dLabel("Page", "Music", vec2(195, 270)) dShowCloseButton("Music", 0) dShow("Music", 0) dPanel("Info",vec2(scrW() / 2 - 450 / 2, 10),vec2(450, 130)) dButton("prev", "Info", vec2(10, 30), vec2(430, 20)) dButton("now", "Info", vec2(10, 50), vec2(430, 20)) dButton("next", "Info", vec2(10, 70), vec2(430, 20)) dButton("time", "Info", vec2(10, 102), vec2(200, 20)) dButton("vol", "Info", vec2(225, 102), vec2(100, 20)) dButton("cycle", "Info", vec2(340, 102), vec2(100, 20)) dShowCloseButton("Info", 0) dShow("Info", 0) if(User:toNumber() == 0) { LastMode = Mode Mode = "userid" httpRequest(API_Link + "/userId?user=" + httpUrlEncode(User) + "&pswd=" + Password) } function number approximPageFromNum(AudioId, MaxInPage) { local ApproximPage = floor(AudioId / MaxInPage) return (ApproximPage * MaxInPage < AudioId ? ApproximPage + 1 : ApproximPage) } ChunkLastPage = approximPageFromNum(Chunk, PageLen) Deviation = (ChunkLastPage * PageLen) - Chunk WaitMessage = array( "Please, wait......", "If this message is long here -", "Reapet the request in 10 seconds OR reboot chip", "", "ATTETION!!!!! There is a request limit on the server. BE SLOWER!!!" ) function number factor(AudioId, MaxInPage, MaxChunk) { return floor((MaxInPage * AudioId) / MaxChunk) } function number string:in(Exp:string) { return Exp:gmatch(This):exists(1) } function printMaxPages(Audios) { print("Count: " + Audios) print("Max pages: " + approximPageFromNum(Audios, PageLen)) } function string secToTime(Time) { Sec = (Time % 60):toString() Min = (floor(Time / 60) % 60):toString() Hour = (floor(floor(Time / 60) / 60)):toString() StrTime = format( "[%s:%s:%s]", Hour:length() == 1 ? "0" + Hour : Hour, Min:length() == 1 ? "0" + Min : Min, Sec:length() == 1 ? "0" + Sec : Sec ) return StrTime } function string string:limitStr(Count) { if(This:length() <= Count) { return This } else { return This:sub(1, Count - 3) + "..." } } function loadMusic() { MusicList = array() local Exp = PageLen * Page # Bidlocode :) A kak nazvat' peremennuyu... Expression? Da. if("add":in(Mode) & (PageLen * (Page + LastPage)) > UserMusicCount & LastIndex != 0) { Exp = Playlist:count() } for(I = (PageLen * (Page - 1)) + 1, Exp) { if(Playlist:exists(I)) { T = Playlist[I, table] local Music = format( "%s. %s - %s | %s", T["index", string]:toNumber() + LastIndex, T["artist", string]:limitStr(21), T["title", string]:limitStr(21), secToTime(T["duration", number]) ) MusicList:pushString(Music) } } dArray("List", MusicList) } function loadAlbums() { MusicList = array() for(I = (PageLen * (Page - 1)) + 1, PageLen * Page) { if(Playlist:exists(I)) { T = Playlist[I, table] local Music = format( "%s. %s | Count: %s", T["index", string]:toNumber(), T["title", string]:limitStr(45), T["count", number] ) MusicList:pushString(Music) } } dArray("List", MusicList) } function c_search(LS:array) { Mode = "search" if(LS:string(1) == "local") { httpRequest(API_Link + format( "/search?q=%s&owner_id=%s&pswd=%s", httpUrlEncode(LS:concat(" ", 2, LS:count())), User, Password ) ) } elseif(LS:string(1) == "global") { httpRequest(API_Link + format("/search?q=%s&pswd=%s", httpUrlEncode(LS:concat(" ", 2, LS:count())), Password)) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("You should have print in the second argument 'global' or 'local'") } } function c_get(LS:array) { LastMode = Mode Mode = "get" ReqUser = User if(LS:exists(1) & LS:string(1) != "") { ReqUser = LS:string(1) } LastIndex = 0 LastPage = 0 httpRequest(API_Link + format("/get?owner_id=%s&count=%s&pswd=%s", httpUrlEncode(ReqUser), Chunk, Password)) } function c_playlists(LS:array) { LastMode = Mode Mode = "albums" ReqUser = User if(LS:exists(1) & LS:string(1) != "") { ReqUser = LS:string(1) } httpRequest(API_Link + format("/getAlbums?owner_id=%s&pswd=%s", httpUrlEncode(ReqUser), Password)) } function loadChunk(Type:string) { Mode = Type if(Type == "add_get") { httpRequest(API_Link + format( "/get?owner_id=%s&offset=%s&count=%s&pswd=%s", httpUrlEncode(ReqUser), LastIndex, Chunk, Password ) ) } else { httpRequest(API_Link + format( "/getAlbum?owner_id=%s&album_id=%s&offset=%s&count=%s&pswd=%s", ReqUser, PlaylistId, LastIndex, Chunk, Password ) ) } MusicList = array() dArray("List", WaitMessage) } function c_playlist(LS:array) { if(Mode == "albums") { if(LS:exists(1) & LS:string(1) != "" & LS:string(1):toNumber() != 0) { local Int = LS:string(1):toNumber() if(Int <= Playlist:count()) { PlaylistId = Playlist[Int, table]["id", number] UserMusicCount = Playlist[Int, table]["count", number] ReqUser = Playlist[Int, table]["owner_id", number]:toString() LastMode = Mode Mode = "playlist" httpRequest(API_Link + format( "/getAlbum?owner_id=%s&album_id=%s&offset=%s&count=%s&pswd=%s", Playlist[Int, table]["owner_id", number], PlaylistId, LastIndex, Chunk, Password ) ) MusicList = array() dArray("List", WaitMessage) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Playlists count < Index") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Playlist Index is empty or it is not int") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("First load the playlist list") } } function c_set_page(LS:array) { if(LS:exists(1) & LS:string(1) != "" & LS:string(1):toNumber() != 0) { if(Playlist:count() != 0) { local Int = LS:string(1):toNumber() if("add":in(Mode) | Mode == "get" | Mode == "playlist") { if(UserMusicCount != -1) { local MaxPages = approximPageFromNum(UserMusicCount, PageLen) Int = clamp(Int, 1, MaxPages) local LastLastIndex = LastIndex # LasLastLastIndex :D local Factor = factor(Int - 1, PageLen, Chunk) LastIndex = Factor * Chunk LastPage = Factor * ChunkLastPage Page = Int - LastPage if(LastLastIndex == LastIndex) { if(Mode != "albums"){ loadMusic() }else{ loadAlbums() } } else { if("get":in(Mode)){ loadChunk("add_get") }else{ loadChunk("add_playlist") } } dSetSval("Page", Int:toString()) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Please, wait... Audio is loading") } } else { if(Int > 0 & (PageLen * (Int - 1)) + 1 <= Playlist:count()) { Page = Int if(Mode != "albums"){ loadMusic() }else{ loadAlbums() } dSetSval("Page", Page:toString()) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Your page is out of available pages") } } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("First load music list") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Page index is empty or it is not int") } } function c_go_to_audio(LS:array) { if(LS:string(1):toNumber() <= UserMusicCount) { local Audio = LS:string(1):toNumber() local Index = approximPageFromNum(Audio, PageLen) local Factor = factor(Index, PageLen, Chunk) if(Factor != 0) { Audio += Factor * Deviation Index = approximPageFromNum(Audio, PageLen) } c_set_page(array(Index:toString())) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Audio out of range") } } function c_set_user(LS:array) { if(LS:exists(1) & LS:string(1) != "") { LastMode = Mode Mode = "userid" httpRequest(API_Link + "/userId?user=" + LS:string(1) + "&pswd=" + Password) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("User name is empty") } } function c_stop_music(LS:array) { Now = 0 NowPlaylist = table() IsLoading = 0 IsPlaying = 0 MusicInfoShow = 0 NowTime = 0 NowIndex = 0 NowCountMusic = 0 dSetSval("prev", "-") dSetSval("now", "-") dSetSval("next", "-") dSetSval("time", "-") dShow("Info", 0) stoptimer("timer") soundURLPurge() } function c_volume(LS:array) { if(LS:string(1) != "" & LS:exists(1)) { local Int = LS:string(1):toNumber() Volume = clamp(Int, 0, 100) dSetSval("vol", "Volume: " + Volume) soundURLvolume("homus32_vk_player", Volume / 100) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Volume number is empty") } } function update_music_info() { local AudioId = Now - NowIndex local PrevTable = NowPlaylist[AudioId - 1, table] if(PrevTable:count() != 0) { local PrevAudio = format( "%s. %s - %s", PrevTable["index", string]:toNumber() + NowIndex, PrevTable["artist", string], PrevTable["title", string] ) dSetSval("prev", PrevAudio) } else { dSetSval("prev", "-") } local NowTable = NowPlaylist[AudioId, table] if(NowTable:count() != 0) { local NowAudio = format( "%s. %s - %s", NowTable["index", string]:toNumber() + NowIndex, NowTable["artist", string], NowTable["title", string] ) dSetSval("now", NowAudio) } else { dSetSval("now", "-") dSetSval("time", "-") } local NextTable = NowPlaylist[AudioId + 1, table] if(NextTable:count() != 0) { local NextAudio = format( "%s. %s - %s", NextTable["index", string]:toNumber() + NowIndex, NextTable["artist", string], NextTable["title", string] ) dSetSval("next", NextAudio) } else { dSetSval("next", "-") } dSetSval("vol", "Volume: " + Volume) dSetSval("cycle", "Cycle: " + select(CycleType + 1, "off", "around list", "around track")) } function play_audio(AudioId) { local AudioInfo = NowPlaylist[AudioId, table] local Pswd = AudioInfo["pswd", string] local MusicURI = AudioInfo["url", string] if(MusicURI:gmatch("index\.m3u8"):exists(1)) { URI = API_Link + format("/m3u8?url=%s&pswd=%s", httpUrlEncode(MusicURI), Pswd) } else { URI = API_Link + format("/mp3?url=%s&pswd=%s", httpUrlEncode(MusicURI), Pswd) } soundURLload("homus32_vk_player", URI, Volume / 100, 0, FollowEnt) } function c_audio_toggle(LS:array) { # Bidlocode function.... if(LS:string(1) != "" & LS:exists(1) & LS:string(1):toNumber() != 0) { local Int = LS:string(1):toNumber() if("add":in(Mode) | Mode == "get" | Mode == "playlist" | Mode == "search") { if(UserMusicCount != -1) { if(Int <= UserMusicCount) { c_stop_music(array()) local LastLastIndex = LastIndex c_go_to_audio(array(LS:string(1))) Now = Int NowIndex = LastIndex NowCountMusic = UserMusicCount IsChanged = 0 if(LastLastIndex == LastIndex) { NowPlaylist = Playlist play_audio(Now - NowIndex) } else { IsLoading = 1 } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Audio out of music list") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Please wait... Music is loading") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("First load music list") } } else { if(IsLoading != 1) { if(Now != 0) { IsPlaying = !IsPlaying if(IsPlaying) { print("resume") soundURLplay("homus32_vk_player") timer("timer", 1000) } else { print("pause") soundURLpause("homus32_vk_player") stoptimer("timer") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Nothing plays") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Music is loading... wait...") } } } function c_next_audio(LS:array) { if(Now != 0) { IsPlaying = 0 if(IsChanged) { soundURLPurge() if((Now - NowIndex) + 1 > NowPlaylist:count()) { NowTime = 0 Now = NowIndex + 1 play_audio(1) } else { NowTime = 0 Now++ play_audio(Now - NowIndex) } } else { if((Now + 1) > NowCountMusic) { c_audio_toggle(array("1")) } else { soundURLPurge() NowTime = 0 Now++ if(Now - NowIndex > NowPlaylist:count()) { c_audio_toggle(array(Now:toString())) } else { play_audio(Now - NowIndex) } } } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Nothing is play") } } function c_prev_audio(LS:array) { if(Now != 0) { IsPlaying = 0 if(IsChanged) { soundURLPurge() if((Now - NowIndex) - 1 <= 0) { NowTime = 0 Now = NowIndex + NowPlaylist:count() play_audio(NowPlaylist:count()) } else { NowTime = 0 Now-- play_audio(Now - NowIndex) } } else { if((Now - 1) <= 0) { c_audio_toggle(array(NowCountMusic:toString())) } else { soundURLPurge() NowTime = 0 Now-- if(Now - NowIndex < NowPlaylist:count()) { c_audio_toggle(array(Now:toString())) } else { play_audio(Now - NowIndex) } } } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Nothing is play") } } function c_cycle_audio(LS:array) { if(LS:string(1) != "" & LS:exists(1)) { local Int = LS:string(1):toNumber() CycleType = clamp(Int, 0, 2) } else { CycleType = (CycleType + 1) % 3 } print(select(CycleType + 1, "You off cycle", "You on cycle. Mode: 'Around list'", "You on cycle. Mode: 'Around track'" ) ) update_music_info() } function c_set_time(LS:array) { if(Now != 0) { if(LS:exists(1) & LS:string(1) != "") { local M = NowPlaylist[Now - NowIndex, table] local TimeNow = secToTime(NowTime) local GTime = TimeNow:gmatch("%[(%d+):(%d+):(%d+)%]")[1, array] local GHour = GTime[1, string]:toNumber() local GMin = GTime[2, string]:toNumber() local GSec = GTime[3, string]:toNumber() local Sec = GSec if(LS:string(2) != "-") { local Sec = abs(LS:string(1):toNumber()) } local Min = GMin if(LS:exists(2) & LS:string(2) != "" & LS:string(2) != "") { Min = abs(LS:string(2):toNumber()) } local Hour = GHour if(LS:exists(3) & LS:string(3) != "" & LS:string(3) != "-") { Hour = abs(LS:string(3):toNumber()) } local TimeSec = Sec + (Min * 60) + (Hour * 60 ^ 2) local M_Dur = M["duration", number] if(TimeSec < M_Dur) { soundURLtime("homus32_vk_player", TimeSec) TimeNow = secToTime(TimeSec) NowTime = TimeSec dSetSval("time", format("Time: %s - %s", secToTime(TimeSec), secToTime(M_Dur))) print("You set time on: " + TimeNow) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Time out of range") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("First arg is empty") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Nothing is play") } } function c_shuffle_music(LS:array) { if(Playlist:count() != 0 & ("add":in(Mode) | Mode == "get" | Mode == "playlist")) { if(!Now) { ShuffleCounter = 0 c_stop_music(array()) timer("shuffle", 1) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Please, stop music") } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) print("Nothing is shuffle") } } } if(chatClk(O)) { local LS = O:lastSaid():explode(" ") local Command = LS:string(1):sub(Prefix:length() + 1, LS:string(1):length()):lower() local Pref = LS:string(1):sub(0, Prefix:length()) if(Commands[Command, string] & Pref == Prefix) { hideChat(1) (Commands[Command, string])(LS:concat(" ", 2, LS:count()):explode(" ")) } } if(httpClk()) { local Data = jsonDecode(httpData()) print("Requests accepted. Mode: " + Mode) if(!Data:exists("error")) { if(Mode == "search" | Mode == "get" | Mode == "playlist") { if(Mode == "get") { UserMusicCount = -1 timer("getCount", 3 * 1000) # Bi-dlo code :( } elseif(Mode == "search") { UserMusicCount = Data:count() printMaxPages(UserMusicCount) } else { printMaxPages(UserMusicCount) } Playlist = Data Page = 1 LastIndex = 0 LastPage = 0 IsChanged = 1 dSetSval("Page", Page:toString()) loadMusic() } elseif("add":in(Mode)) { Playlist = Data dSetSval("Page", (Page + LastPage):toString()) loadMusic() } elseif(Mode == "albums") { Playlist = Data IsChanged = 1 Page = 1 LastIndex = 0 LastPage = 0 UserMusicCount = Playlist:count() printMaxPages(UserMusicCount) dSetSval("Page", Page:toString()) loadAlbums() } elseif(Mode == "userid") { User = Data["id", number]:toString() if(User == "0") { User = Data["id", string] } Mode = LastMode } elseif(Mode == "getCount") { UserMusicCount = Data["count", number] printMaxPages(UserMusicCount) Mode = LastMode } if(IsLoading) { if(Now != 0) { NowPlaylist = Playlist:clone() play_audio(Now - NowIndex) } } } else { Mode = LastMode O:soundPlaySingle("buttons/button10.wav", 100, 100) hint("ERROR!!! SEE CHAT", 3) printColor(vec(255, 150, 150), "An error has occured. Submit a bug to the developer \nError: ") printTable(Data) } } if(dClk()) { local D = dClk() if(!"add":in(Mode) & Mode != "get" & Mode != "playlist") { if(D == ">") { if((PageLen * Page) + 1 <= Playlist:count()) { Page++ if(Mode != "albums"){ loadMusic() }else{ loadAlbums() } } } elseif(D == "<") { if(Page != 1) { Page-- if(Mode != "albums"){ loadMusic() }else{ loadAlbums() } } } dSetSval("Page", Page:toString()) } else { if(MusicList:string(1) != "") { if(D == ">") # Eto toje bidlocode... thx e2... { local FuturePageCount = (PageLen * (Page + LastPage)) + 1 if(FuturePageCount <= Playlist:count() + LastIndex) { Page++ loadMusic() } elseif(UserMusicCount != -1) { if(FuturePageCount < UserMusicCount) { LastIndex += Chunk LastPage = Page + LastPage Page = 1 if("get":in(Mode)){ loadChunk("add_get") }else{ loadChunk("add_playlist") } } } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) hint("Please, wait...", 3) } } elseif(D == "<") { if(Page != 1) { Page-- loadMusic() } elseif(Page == 1 & LastIndex != 0) { LastIndex -= Chunk Page = ChunkLastPage LastPage -= ChunkLastPage if("get":in(Mode)){ loadChunk("add_get") }else{ loadChunk("add_playlist") } } } dSetSval("Page", (Page + LastPage):toString()) } } } if(keyClk(O) == 1) { if(keyClkPressed() == MusicTableButton) { MusicTableShow = !MusicTableShow dShow("Music", MusicTableShow) enableMouse(MusicTableShow) } elseif(keyClkPressed() == MusicInfoButton) { MusicInfoShow = !MusicInfoShow dShow("Info", MusicInfoShow) } } if(clk("getCount")) { LastMode = Mode Mode = "getCount" httpRequest(API_Link + format("/getCount?owner_id=%s&pswd=%s", httpUrlEncode(ReqUser), Password)) } if(clk("timer")) { local MusicDuration = NowPlaylist[Now - NowIndex, table]["duration", number] if(NowTime < MusicDuration) { NowTime++ dSetSval("time", format("Time: %s - %s", secToTime(NowTime), secToTime(MusicDuration) )) timer("timer", 1000) } else { stoptimer("timer") soundURLPurge() if(CycleType == 2) { IsPlaying = 0 NowTime = 0 play_audio(Now - NowIndex) } else { if( CycleType == 1 | ((Now - NowIndex) + 1 <= NowPlaylist:count()) | (Now + 1 <= NowCountMusic) ) { c_next_audio(array()) } else { c_stop_music(array()) } } } } if(clk("shuffle")) { timer("shuffle", 1) if(ShuffleCounter == Playlist:count()) { loadMusic() stoptimer("shuffle") } while(ShuffleCounter != Playlist:count() & perf(20)) { ShuffleCounter++ local RandInt = randint(1, Playlist:count()) local Temp = Playlist[ShuffleCounter, table] Playlist[ShuffleCounter, table] = Playlist[RandInt, table] Playlist[RandInt, table] = Temp Playlist[ShuffleCounter, table]["index", string] = ShuffleCounter:toString() Playlist[RandInt, table]["index", string] = RandInt:toString() } } if(soundURLClk("homus32_vk_player") & soundURLClkEnt() == O) { if(soundURLSuccess()) { MusicInfoShow = 1 IsPlaying = 1 IsLoading = 0 Try = 0 soundURLplay("homus32_vk_player") dShow("Info", 1) timer("timer", 1) update_music_info() } else { if(soundURLErrorID() != 40) { O:soundPlaySingle("buttons/button10.wav", 100, 100) printColor(vec(255, 150, 150), "Sound URL Error") print("ID: " + soundURLErrorID()) print("Error name: " + soundURLErrorString()) c_stop_music(array()) } else { if(Try != 6) { Try++ print("Please, wait...") timer("try_again", 2000) } else { O:soundPlaySingle("buttons/button10.wav", 100, 100) printColor(vec(255, 150, 150), "Sound URL Error") print("ID: " + soundURLErrorID()) print("Error name: " + soundURLErrorString()) print("Try againy later :(") c_stop_music(array()) Try = 0 } } } } if(clk("try_again")) { play_audio(Now - NowIndex) } # by homus32. everlast memory...