Annas Posted June 15, 2016 Share Posted June 15, 2016 Hey all. I have a problem on this code: function downloadPlayerAlternateSkin (p, _) local filename = exports.CSTmysql:query("SELECT * FROM Skins") for i=1, #filename do local theskinId = filename[i].skinid outputDebugString("filename[i] = ".. tostring(filename[i])) if theskinId then fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) end end end addCommandHandler("addskin", downloadPlayerAlternateSkin) Console: INFO: filename = table: 0xa9a3b40 Also it makes server lag (NETWORK TROUBLE) for 1min everytime i use that command '/addskin'. Maybe there is something wrong on my function.. please help me Link to comment
denny199 Posted June 15, 2016 Share Posted June 15, 2016 Well, how much skins do you have in your database? If you have 100 skins, then you will make 100 requests to your webserver via fetchRemote Link to comment
Walid Posted June 15, 2016 Share Posted June 15, 2016 100 requests to your webserver via fetchRemote Are you serious ? Link to comment
Annas Posted June 15, 2016 Author Share Posted June 15, 2016 100 requests to your webserver via fetchRemote Are you serious ? Help please.. Also ignore useless posts Link to comment
Captain Cody Posted June 16, 2016 Share Posted June 16, 2016 function downloadPlayerAlternateSkin (p, _) local filename = exports.CSTmysql:query("SELECT * FROM Skins") for i=1, #filename do local theskinId = filename[i].skinid outputDebugString("filename[i] = ".. tostring(filename[i].skinid)) -- Not sure if this was what you intended to do, but here it was outputting a table as the string. if theskinId then fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) end end end addCommandHandler("addskin", downloadPlayerAlternateSkin) Not sure if that's what you were trying to do, but some times small errors such as that will indeed freeze up the server. Link to comment
Annas Posted June 16, 2016 Author Share Posted June 16, 2016 function downloadPlayerAlternateSkin (p, _) local filename = exports.CSTmysql:query("SELECT * FROM Skins") for i=1, #filename do local theskinId = filename[i].skinid outputDebugString("filename[i] = ".. tostring(filename[i].skinid)) -- Not sure if this was what you intended to do, but here it was outputting a table as the string. if theskinId then fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) end end end addCommandHandler("addskin", downloadPlayerAlternateSkin) Not sure if that's what you were trying to do, but some times small errors such as that will indeed freeze up the server. Not working ScreenShot: Debugscript: Line 5: Attempt to concatenate local 'theskinId' (a nil value) 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