megaman54 Posted March 7, 2012 Posted March 7, 2012 I'm currently using the function takePlayerScreenshot and i need to transfer the data to client side for preview but sometimes the string size of the screenshot data is over 65535 characters and that is over the argument length limit in triggerClientEvent. How i could split that argument to pieces and send it and then combine the pieces client side?
drk Posted March 7, 2012 Posted March 7, 2012 Maybe split ? https://wiki.multitheftauto.com/wiki/Split
SDK Posted March 7, 2012 Posted March 7, 2012 I think you don't need to split it if you use this function: https://wiki.multitheftauto.com/wiki/Tri ... lientEvent Not sure, since I never used it myself before
Castillo Posted March 7, 2012 Posted March 7, 2012 But that function isn't available until MTA 1.3.1 onwards.
Kenix Posted March 7, 2012 Posted March 7, 2012 Solution is create table. And check sub string like 1,65535. And send with parts to client. Like this: function fPack ( str ) local t = { } local new = str while #new >= 65535 do t[ #t + 1 ] = string.sub( new, 1, 65535 ) triggerClientEvent( root, 'onSomeEvent', root, t[ #t ] ) new = string.gsub( new, string.sub( new, 1, 65535 ), '' ) end t[ #t + 1 ] = string.sub( new, 1, #new ) triggerClientEvent( root, 'onSomeEvent', root, t[ #t ] ) if #t == 0 then t[1] = new end return t end
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