The problem is that lockstyle is mostly a server behavior. I'd be very surprised to learn that the client monitors lockstyle status at all, which means windowerplugin would have to catch outgoing lockstyle packets (and reset lockstyle to false on zone). Here is an include file that makes a "user_lockstyle" function and passes true (lockstyle is on) or false (lockstyle is off) when lockstyle changes, if you are interested:
Code:
_lockstyle = {lockstyle=false}
windower.register_event('zone change',function(...)
if _lockstyle.lockstyle then
if user_lockstyle and type(user_lockstyle) == 'function' then user_lockstyle(false) end
_lockstyle.lockstyle=false
end
end)
windower.register_event('outgoing chunk',function(id,org,mod,is_injected,is_blocked)
if id == 0x111 then
local new_lockstyle = (mod:byte(5)==1)
if new_lockstyle ~= _lockstyle.lockstyle then
_lockstyle.lockstyle = new_lockstyle
if user_lockstyle and type(user_lockstyle) == 'function' then user_lockstyle(new_lockstyle) end
end
end
end)
function lockstyle(bool)
if _lockstyle.lockstyle ~= bool then
local pants = 0
if bool then pants = 1
elseif bool == false then pants = 0
elseif _lockstyle.lockstyle = false then pants = 1 end
windower.packets.inject_outgoing(0x111,string.char(0x111,4,0,0,pants,0,0,0))
end
end
I also included a function named lockstyle() that takes a boolean argument and either unlocks (false) or locks (true) your lockstyle. If you don't provide the boolean, it toggles it based on the current state.
I didn't bother testing it, but it probably works. Use print statements to debug it if you care.