Jump to content

vx89

Members
  • Posts

    99
  • Joined

  • Last visited

About vx89

  • Birthday 16/07/1989

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vx89's Achievements

Punk-@ss B*tch

Punk-@ss B*tch (12/54)

6

Reputation

  1. Unfortunately searching for Justin Bieber is banned on that website. On more serious note though, that specific website allows only specific spotify uri ids, so no search by names. Only useful part of that website is to get content of specific playlist id; specific album id or specific artist id. After thinking about it, I think it's actually relatively safe to create a new Spotify account, ask for Spotify Web API token from it, which has no user-specific rights, so you could make that token public (i.e use it directly on client-side) and use Spotify Web API with that token to search for songs. If you will actually try to do it, let me know if that kind of web api user token needs refreshing or it's permanent or if there are any other issues I was not thinking about.
  2. Not through this API. You might find the music some other way (e.g to find first 200 songs of a specific playlist or album one could parse https://open.spotify.com/embed?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf) (this is exactly what I will add actually) and use spotify_api just for playback . Spotify also provides Web API, but it requires user authentication, where user is logged in to spotify.com and your service would prompt spotify.com to ask for a request token to your service for a given user, with user permission. But this can securely happen only inside user web browser. Definitely not MTA, because you have to be logged into spotify.com and there's no safe way to do that inside MTA. Another way to use Web API is that you authenticate only yourself and searching for songs (with your API key) is always done on server side and just the result is passed on to client-side. There might be some 3rd party services providing spotify search though.
  3. In spotify_api/api.lua change connect(4380) to connect(4381). Looks like when SpotifyWebHelper.exe is running it occupies 4380, so our port scanning finds that 4380 is responding to our status request. However running any actual commands will fail with that 404 error. I will add status command check to make sure the found port is OK.
  4. Hi. Not sure what you are saying, so I'm trying to cover the case where it does *not* connect. 1. Go to https://open.spotify.com/embed?uri=spotify:user:spotify:playlist:3rgsDhGHZxZ9sB9DQWQfuf and see if controlling Spotify from there works. 2. When Spotify is running, go to start menu and open "Resource Monitor". In Resource Monitor choose "Network" tab. In "Listening Ports" section order the table by "Port" column and look if Spotify.exe is running in range 4370-4381. Also if there is anything else running in that range. Let me know. 3. Let's try next steps when we cover the previous ones..
  5. Small update (updated the link in the first post as well). I added support to get periodical updates what's currently playing. Here is example of the newly added spotify_notifier always showing currently playing track in bottom right corner.
  6. Just wanted to say thanks for the fetchRemote additions (allowed be to create spotify controller).
  7. You listen for key down and up events. Store start time (getTickCount() - time in milliseconds) on 'down'. And on 'up' check if current tick count is >= 2000 milliseconds (assuming more than 2 seconds is also ok - you can add some buffer zone, like between 2 and 3 seconds). UPDATE: Ah, you probably meant knowing two seconds has passed even before releasing the key. Then you simply call https://wiki.multitheftauto.com/wiki/SetTimer on the 'down' event. You have to be careful with timers though. If user clicks down many times during the 2 seconds, the old timers have to be canceled or ignored.
  8. Hi. I noticed new MTA version allows specifying headers in fetchRemote, so I could finally implement spotify remote controller (control locally running spotify from the game). I want to share the possibility with you, so here goes.. This is not ready for public use! Download https://www.upload.ee/files/7552466/_spotify_.zip.html Extract [spotify] inside server resources Start Spotify on same computer where you run the game. In MTA server, run one of (or all): spotify_cli, spotify_gui, spotify_notifier, spotify_status In MTA client permanently accept domain access for "open.spotify.com" (this is used anonymously, to get oauth token, MTA client has no spotify session data from you). You might need to reconnect to the server after that as I haven't handled the domain access. Troubleshooting/Feedback: * You might need to change the "starting port" in spotify_api/api.lua, line 42 from 4380 to something else, like 4371 (there currently seems to be a bug with port scanning because on my computer spotify was listening on two ports, both of them responded to version check, but actual status request failed on one of them. Will deal with that definitely if I have some feedback, like which ports people are using and which one is working for them) * New MTA version has "localhost" whitelisted by default. If it's not you will get prompt to whitelist it. * Currently spotify_api connects automatically on client resource start, but there is usecase where user alt+tabs out of game, starts Spotify and then we would like to try connecting again. Maybe you have some good ideas how to design the API for that - should it automatically retry connecting (if not connected) on any exported function call? Also, maybe there is good usecase that connecting should not be done on resource start at all and is deferred until really needed. Currently there might be substantial delay finding the correct port though, because fetchRemote timeout argument doesn't seem to have any effect, so the timeout is really slow (around ~1 sec) for each port. In given zip file it's not an issue as it is trying range 4380-4381 Unfortunately, the spotify remote control API that this resource is using, supports only few basic commands: starting specific track (in specific context (context not implemented in my resource yet)), pausing, resuming and getting current status (and track) info. That is all. No seeking, no volume change, no prev/next track (unless you know what is prev and next, and just play those tracks). Nevertheless the existing commands alone are pretty nice to have. My goal is to publish the spotify_api and let others implement their own usages (either incorporated into gamemode - i.e each map has it's own music; or create some nice GUI controller for the music). Provided spotify_cli and spotify_gui are just dumb interfaces so I know the API is actually working and designed ok. Provided examples: spotify_cli Adds commands to play specific track/playlist/album uri; play; pause. Type command 'spotify.commands' to see list of possible commands. spotify_gui Press 0 (as in zero) to show playlist GUI with play and pause buttons. Click on song name to start playing it. spotify_status Permanently shows current playing song and seek position. spotify_notifier Similar to spotify_status, but pops up only for few seconds when new song started and does not include playing time.
  9. vx89

    Object as image

    They just replicate the images, instead of really showing face of an object
  10. vx89

    KWK 3D Radio

    I tried to create a similar resource a while ago, but got stopped on the problem, that I found no stable way to play one track after another one without any clipping between (e.g intro & song; or song & outro). I see you just start the next part before 50ms - haven't tried this script yet, but is it always stable on your machine - i.e you don't hear any delay or overlapping when next track part is started?
  11. It describes how *they* have implemented OOP for MTA builtin functions. Element = { create = createElement, setPosition = setElementPosition, ... } -- Hidden in lua registry, applied to userdata ElementMT = { __index = CLuaClassDefs::Index, -- accessing missing key with element[key] or element.key will call CLuaClassDefs::Index. This will call __class or __get __newindex = CLuaClassDefs::NewIndex, -- setting element[key] = value or element.key = value will call CLuaClassDefs::NewIndex. This will call __set. __class = Element, -- private field, so __call can use it and maybe something else as well __call = __class.create, -- calling element(foo) will call __class.create(element, foo), which is Element.create(element, foo) __set = { -- not in Lua specs, MTA handles it somehow - creates setters for contained names type = CLuaClassDefs::ReadOnly, -- setting Element type is not allowed (but getting is) health = setElementHealth, ... }, __get = { -- same as __set, only for getters type = getElementType, health = getElementHealth, ... }, } It's important to look at https://github.com/multitheftauto/mtasa ... ssDefs.cpp to see what's going on. Also see http://lua-users.org/wiki/MetatableEvents I am not sure though why they have in that wiki example setPosition in Element instead of ElementMT.__set.position
  12. On 7th line you are setting statusfunctions to a new value and on next frame (when xsManager() is called again) you try to get getElementData(localPlayer,statusfunctions), which now returns false instead. But the error probably comes when getElementData returns true as boolean as then the "Disabled" is not returned instead. Also, is this elementData synced with server or is only local? If only local then I guess it should be ok to ask it every frame, though it would make more sense to just keep the values in a separate table as per descriptions they don't change often. If synced, then you should definitely keep them cached and not ask updates from server on each frame.
  13. It should find all shader elements created by the map resource script. My example is a starting point for you to experiment with.
  14. Maybe you could try local mapResourceDynamicRoot = getResourceDynamicElementRoot(mapResource) local shaders= getElementsByType( 'shader', mapResourceDynamicRoot) Just an idea.
  15. I understand it can be hard to make up a topic title, but I just see it too much https://forum.multitheftauto.com/viewtopic.php?f=31&t=15740 Example: How to change jail position in Nerd Gaming GameMode?
×
×
  • Create New...