Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 (edited) 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 August 27, 2017 by Master_MTA Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 (edited) 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 August 27, 2017 by IIYAMA Link to comment
Master_MTA Posted August 27, 2017 Author Share Posted August 27, 2017 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
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 This is excluded the code of the previous messages. Tell me, where does the code stop working? Link to comment
Master_MTA Posted August 27, 2017 Author Share Posted August 27, 2017 (edited) 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 August 27, 2017 by Master_MTA Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 errorr = 1? Is that the reason why it doesn't work? Which server version are you running? If it is lower than 1.5.2., try to upgrade it. Link to comment
Master_MTA Posted August 27, 2017 Author Share Posted August 27, 2017 5 minutes ago, IIYAMA said: errorr = 1? Is that the reason why it doesn't work? Which server version are you running? If it is lower than 1.5.2., try to upgrade it. 1.5.4 and i change the syntax like that it's still output 1 bool fetchRemote ( string URL[, table options ], callback callbackFunction[, table callbackArguments ] ) Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 Do you have the same problem with other images of other servers? Link to comment
Master_MTA Posted August 27, 2017 Author Share Posted August 27, 2017 2 minutes ago, IIYAMA said: Do you have the same problem with other images of other servers? yup Link to comment
Moderators IIYAMA Posted August 27, 2017 Moderators Share Posted August 27, 2017 and instead of and image, html code? Link to comment
Master_MTA Posted August 27, 2017 Author Share Posted August 27, 2017 (edited) 8 minutes ago, IIYAMA said: and instead of and image, html code? no thing it's still output 1 https://wiki.multitheftauto.com/wiki/CURL_Errors i check it but i don't understand what does that mean CURLE_UNSUPPORTED_PROTOCOL why it's unsupported Edited August 27, 2017 by Master_MTA Link to comment
Administrators Lpsd Posted August 28, 2017 Administrators Share Posted August 28, 2017 (edited) 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 August 28, 2017 by LopSided_ Link to comment
Master_MTA Posted August 28, 2017 Author Share Posted August 28, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now