Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("pack")
- sp = {
- state=true,
- allow_party_members=true
- }
- sp.state = true
- windower.raw_register_event('incoming chunk', function (id, original, modified, injected, blocked)
- if sp.state and (id == 0x00D or id == 0x00E) then
- local player_id = modified:unpack('I',5)
- if player_id == player.id then return end
- local in_party = false
- for i,v in pairs(alliance[1]) do
- if type(i) == 'number' and i >= 1 and i <= 6 and v.mob and v.mob.id == player_id then
- in_party = true
- end
- end
- if in_party and sp.allow_party_members then
- elseif in_party and not sp.allow_party_members or -- party members blocked
- not in_party and id == 0x00D then -- player not in your party
- local current_value = string.byte(string.sub(modified,0x23,0x23))
- local new_value = current_value % 8 + math.floor(current_value / 16)*16 + 8
- return string.sub(modified,1,0x22)..string.char(new_value)..string.sub(modified,0x24)
- end
- end
- end)
- register_unhandled_command(function (...)
- local commands = split((...)," ")
- if commands[1] and commands[1] == 'sp' then
- if commands[2] and (commands[2] == 'on' or commands[2] == 'true') then
- sp.state = true
- elseif commands[2] and (commands[2] == 'off' or commands[2] == 'false') then
- sp.state = false
- else
- sp.state = not sp.state
- end
- print("single_player : "..tostring(sp.state))
- return true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement