Search the Community
Showing results for tags 'fetchremote'.
-
function fetchRemoteE() fetchRemote("site", function(responseData, errors) if errors == 0 then local finalResult = "Liberar" if responseData:match(finalResult) then -- ERRO ( Está comparando com todas as linhas do site juntas, ao invez de uma por uma.) print("FUNCIONANDO") else print(errors) print(responseData) print(finalResult) end end end) end COMO EU PODERIA FAZER PARA ELE COMPARAR LINHA POR LINHA COM O 'finalResult' ?
-
function myCallback(data, errno,path) if errno == 0 then triggerEvent("onFileTDownload", root, "sound.mp3", data); else outputChatBox ('Error '..errno) --it return error 7, when ip == localhost returns error 1006 end end addEvent("onFileTDownload", false); addEventHandler("onFileTDownload", root, function(path,data) local file; if not fileExists(path) then file = fileCreate(path); else file = fileOpen(path); end; fileWrite(file, data); fileClose(file); -- do whatever with the file ... end); function testdownload () fetchRemote("http://127.0.0.1:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); --[[i tried the following two examples too... fetchRemote("http://localhost/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); fetchRemote("http://localhost:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); ]] end addCommandHandler ('tts',testdownload) --[[ All in the client side]] How to solve it? can someone help me pls
-
How to improve the code so that it works quickly and without delay? This script works well when there are few players, but when more than 20 people come in, it starts to load for a long time. A very long time. It can load for hours. CLIENT ↓↓ triggerServerEvent("onSearchRequest",localPlayer, 'text_search') CLIENT ↑↑ SERVER ↓↓ addEvent("onSearchRequest", true) addEventHandler("onSearchRequest",getRootElement(),function(txt) fetchRemote( "http://5music.online/?song="..(txt:gsub(' ', '+')),onSongReturn,'',true,client) end) function onSongReturn(data,errno,player) if player and isElement(player) then local str1 = string.find(data,"<ul>") local _,str2 = string.find(data,"</ul>") if str1 ~= nil then local data = string.sub(data,str1,str2) triggerClientEvent(player,"onSongReceived", player, data) end end end UPGRADE CODE PLEASE
-
I know about socket module that can manage with it. Also i can output mta messages on discord server using web hook, but can i do it in opposite direction? I mean can i output discord messages on mta server without additional modules?
-
Hi there! I've recently discovered 2 problems: 1. I can't trigger fetchRemote inside another fetchRemote function. Example: fetchRemote("http_stuff",function(resp) -- everything OK here -- some magic here myfunc("some_args") end) function myfunc(args) fetchRemote("httpStuff_x2",function(resp2) print("done x2") end) -- it won't trigger but i'll see 'done x2' message end 2. i can't store information into variables inside fetchRemote func. Example: local variable fetchRemote("http_stuff",function(resp) -- everything OK here variable = resp print(variable) -- OK end) print(variable) -- nil I don't know what to do ?
-
After some updates on the FetchRemote function, I'm having a lot of trouble downloading some files directly from a "Domain" Example: My server is on a Host, and the Files on another Host, and it looks like something is blocking and FetchRemote Function. can someone help me ?
-
Hey guys, is there any way to convert a YouTube link to MP3 using fetchRemote or any other way? Thanks
- 1 reply
-
- youtube
- fetchremote
-
(and 2 more)
Tagged with:
-
Hello everyone I am trying to send a image from MTA Server to my site, however, the file is always empty... I would like to ask a help to solve this. Thanks. Server.lua (MTA) function result(result,error) outputChatBox(tostring(result)) end addEventHandler( "onPlayerScreenShot", root, function ( theResource, status, pixels, timestamp, tag ) outputChatBox("take") callRemote ( "http://domain.com/idk.php", result, pixels ) end ) function doTakeScreenShot() takePlayerScreenShot( getRandomPlayer(), 320, 200 ) end setTimer(doTakeScreenShot, 2000, 1) idk.php (Web) include( "mtaphpsdk_0.4/mta_sdk.php" ); $input = mta::getInput(); $myfile = fopen("newfile.jpeg", "w") or die("Unable to open file!"); fwrite($myfile, $input[0]); fclose($myfile); mta::doReturn(true); Result:
-
Всем привет, допустим есть элементы, которых не мало и они создаются до входа игроков на сервер. На них я заменяю текстуру (маловесную, около 30 кб). Которая подгружается и генерируется на Web-сервере. Понятное дело что заменять надо на Клиентской стороне, с помощью: dxSetShaderValue() и engineApplyShaderToWorldTexture() И вот, при тесте сервера, при онлайне выше 20 человек и кол-ва элементов около 50-100 с заменнённой текстурой, при входе игроков наблюдаются провисания ФПС и кружок подгрузки у Всех игроков на сервере, потому что при входе нового игрока я заного подгружаю все текстуры на эти элементы, с помощью: for _,v in pairs(getElementsByType("vehicle")) do Как решить эту проблему? Как закрепить текстуры в глобальном мире на серверной строне, если это возможно? Или подскажите аналогию пожалуйста, если знаете как это реализовать без подобных нерациональных нагрузок.