Skip to content

Instantly share code, notes, and snippets.

@blubbel01
Last active September 16, 2020 21:55
Show Gist options
  • Save blubbel01/b68f7c294f84f1010433963ea9e61084 to your computer and use it in GitHub Desktop.
Save blubbel01/b68f7c294f84f1010433963ea9e61084 to your computer and use it in GitHub Desktop.
rageMP: workaround for CEF execute limiter
const tmpDataRequests = [];
function getData(id, request, index, length, string) {
if(index < length) {
if (index > 1) {
tmpDataRequests[id].parameters += string;
} else {
tmpDataRequests[id] = {
request,
parameters: string
};
}
} else {
console.log({
request: tmpDataRequests[id].request,
data: tmpDataRequests[id].parameters
});
// call Event
delete tmpDataRequests[id];
}
}
function sendData(request, parameters) {
const stringLength = 250;
const id = randomString(5);
const amount = Math.ceil(parameters.length / stringLength) + 1;
for (let i = 0; i < amount; i++) {
let data = "";
let tmp = parameters.slice(stringLength * i, stringLength * (i + 1));
tmp ? data += tmp : null;
getData(id, request, i + 1, amount, data);
}
}
function randomString(length) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
if (! length) {
length = Math.floor(Math.random() * chars.length);
}
var str = '';
for (var i = 0; i < length; i++) {
str += chars[Math.floor(Math.random() * chars.length)];
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment