Jump to content

fetchRemote


Master_MTA

Recommended Posts

what is the Wrong with this

function savedplayers( img, errorr, plr )
    local inf=getPlayerInfo(plr)
	if errorr == 0 then
        triggerClientEvent( plr, "clsavedplrs", plr, img,tostring(isPlayerAdminSkin(plr)) )
		else
		outputChatBox(errorr)----------------------------------------------------------------->result is 1
		        triggerClientEvent( plr, "clsavedplrs", plr, false,tostring(isPlayerAdminSkin(plr)))
    end
end
for k,v in ipairs(getElementsByType('player'))do
fetchRemote ( 'https://d.top4top.net/p_6026au3j1.png', savedplayers, "", false, v)
end

 

Edited by Master_MTA
Link to comment
  • Moderators

I do not know what is wrong with it at the moment. (it is just not visible)

 

Afaik: Make sure you grant the resource the right to use fetchRemote. Because the resource can't use this function without permission of the acl.

 

 

Also this might save you some server bandwidth: Everytime you call fetchRemote, it will start downloading the data from the url. (you don't want to do that per player)


fetchRemote ( 'https://d.top4top.net/p_6026au3j1.png', 
function (...)
  for k,player in ipairs(getElementsByType('player'))do
  	savedplayers(player, ...)
  end
end, "", false)
function savedplayers(plr, img, errorr )

 

 

 

Edited by IIYAMA
Link to comment

i am already add the resource to Admin group in Acl i am also add the right function.fetchRemote to ACL right for Admin group this is the fall code

 

 

function getPlayerImage(plr)
local ser=getPlayerSerial(plr)
local sl=dbPoll(dbQuery(db,'SELECT * FROM accounts WHERE serial=?',ser),-1)
if #sl~=0 then return tostring(sl[1].imageurl) end
return false
end
addEvent('checkplrs',true)
addEventHandler('checkplrs',root,function()
if #getElementsByType('player')==0 then return end
if isSerialRegisterd(getPlayerSerial(source))then
if isSerialSaved(getPlayerSerial(source)) then
local img=getPlayerImage(source)
local inf=getPlayerInfo(source)
local acc=getAccount(inf[1].accname,inf[1].pass)
if acc then
logIn(source,getAccount(inf[1].accname),inf[1].pass)
if isAccountRegisterd(user)then
dbExec(db,'UPDATE accounts SET lastvisit=? WHERE accname=?',last,user)
dbExec(db,'UPDATE accounts SET save=? WHERE accname=?',tostring(mm),user)
else
dbExec(db,'INSERT INTO accounts VALUES(?,?,?,?,?,?)',user,pass,getPlayerSerial(source),FormatDate('d/m/Y||h:i:s'),tostring(mm),'https://e.top4top.net/p_6029qsov1.png')
end
 fetchRemote (img, savedplayers, "", false, source )
 
end
else
 triggerClientEvent( source, "clnotsavedplrs", source )
end
else
 triggerClientEvent( source, "clnotsavedplrs", source )
end
end
)

client side

addEvent('clsavedplrs',true)
addEventHandler('clsavedplrs',root,function(imgme,isad)
if imgme~=false then
img=dxCreateTexture( imgme )
else
img='ss.png'
end
addEventHandler("onClientRender", root,intro)
showChat(false)
showCursor(true)
setTimer(function()
removeEventHandler("onClientRender", root,intro)
fadeCamera(true)
showCursor(false)

isadmin=isad
setCameraMatrix(-343.72479248047,1590.9632568359,92.085800170898,-343.18273925781,1590.126953125,92.003082275391,0,70)
ped=createPed(287,-341.83081054688,1588.0413818359,91.196739196777)
setPedAnimation(ped, "DANCING", "dnce_M_a",-1,true,false,false)
addEventHandler('onClientKey',root,skinchose)

end,1000*20,1)
end)

 

Link to comment
5 minutes ago, IIYAMA said:

This is excluded the code of the previous messages.

 

Tell me, where does the code stop working?

it's a small code from game mode so it doesn''t matter the code stop working at this code

function savedplayers( img, errorr, plr )
    local inf=getPlayerInfo(plr)
	if errorr == 0 then -------------------------[[it's get error at her andd didn't complete]]--
        triggerClientEvent( plr, "clsavedplrs", plr, img,tostring(isPlayerAdminSkin(plr)) )---------------------i need to trigger client side from this trigger
		else
		outputChatBox(errorr)----------------and output 1 at chat box
		        triggerClientEvent( plr, "clsavedplrs", plr, false,tostring(isPlayerAdminSkin(plr)))-------then it work perfectly at here
    end
end

 

Edited by Master_MTA
Link to comment
  • Administrators

CURLE_UNSUPPORTED_PROTOCOL (1)

The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you didn't use, it can be a misspelled protocol string or just a protocol libcurl has no code for.

Maybe it's because you're using https in the url (fetchRemote)? Try changing it to http

 

Edited by LopSided_
Link to comment
11 minutes ago, LopSided_ said:

CURLE_UNSUPPORTED_PROTOCOL (1)

The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you didn't use, it can be a misspelled protocol string or just a protocol libcurl has no code for.

Maybe it's because you're using https in the url (fetchRemote)? Try changing it to http

 

yup you are right thank you solved

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...