local ffi = require('ffi')
local state = false
ffi.cdef[[
typedef void (__thiscall *ApplyNetworkSimulator)(void* CRakPeer_this, double maxSendBPS, unsigned short minExtraPing, unsigned short extraPingVariance);
]]
function main()
repeat wait(0) until isSampAvailable()
local applyNetworkSimulator = ffi.cast('ApplyNetworkSimulator', ffi.cast('void* ', sampGetRakclientFuncAddressByIndex(52)))
sampRegisterChatCommand("pl", function()
state = not state
applyNetworkSimulator(ffi.cast('void*', sampGetRakclientInterface()), state and 6 * 100000 or 9999999, 0, 0)
printStringNow(state and '~g~activated' or '~r~disabled', 1500)
end)
wait(-1)
end