Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- homepoints are enabled
- if HOMEPOINT_TELEPORT == 1 then
- -- invalid homepoint index
- if not homepoints[hpIndex] then
- return
- end
- -- get homepoint bitmasks from player vars
- local masks =
- {
- [1] = bit.bor(bit.lshift(player:getVar("HpTeleportMask1a"), 16), player:getVar("HpTeleportMask1b")),
- [2] = bit.bor(bit.lshift(player:getVar("HpTeleportMask2a"), 16), player:getVar("HpTeleportMask2b")),
- [3] = bit.bor(bit.lshift(player:getVar("HpTeleportMask3a"), 16), player:getVar("HpTeleportMask3b")),
- [4] = bit.bor(bit.lshift(player:getVar("HpTeleportMask4a"), 16), player:getVar("HpTeleportMask4b")),
- }
- -- check for registration of new homepoint
- local group = homepoints[hpIndex][1]
- local mask = masks[group]
- local newHp = 0
- if bit.rshift(bit.lshift(mask, 32 - homepoints[hpIndex][2]), 31) == 0 then
- newHp = 0x10000 -- This value causes the "You have registered a new home point!" dialog to display
- -- update mask with new location and save to database
- mask = bit.bor(mask, bit.lshift(1, homepoints[hpIndex][2] - 1))
- player:setVar("HpTeleportMask"..group.."a", bit.rshift(mask, 16))
- player:setVar("HpTeleportMask"..group.."b", bit.rshift(bit.lshift(mask, 16), 16))
- end
- -- set localvar (will be used onEventFinish) and start homepoint menu event
- player:setLocalVar("currentHpIndex", hpIndex)
- player:startEvent(csid, 0, masks[1], masks[2], masks[3], masks[4], player:getGil(), 4095, hpIndex + newHp)
- -- homepoints are disabled
- else
- player:PrintToPlayer("Home point teleports are currently disabled on this server.")
- player:startEvent(csid, 0, 0, 0, 0, 0, player:getGil(), 4095, hpIndex)
- end
Advertisement
Add Comment
Please, Sign In to add comment