BuRcZyK
Senior User
- Joined
- Sep 2, 2010
- Messages
- 834
- Reaction score
- 34
Witam, znalaz?em skrypt na hunting areny wszystko w jednym z otlandu
Chyba ka?dy wie po co ten skrypt.
- Autor: hugq
Chyba ka?dy wie po co ten skrypt.
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="HuntArea System" version="Tested only on 0.4" author="Hugq" contact="hugq16@gmail.com" enabled="yes">
<config name="HuntAreaFunctions"><![CDATA[
config = {
-- Teleport AID = v[1], v[2], v[3], v[4], v[5], v[6], v[7] ;]
[10001] = {{x = 1018, y = 1020, z = 7}, {x = 1019, y = 1018, z = 7}, {x = 1019, y = 1023, z = 7}, 10, 8, 2, 2},
[10002] = {{x = 1026, y = 1020, z = 7}, {x = 1027, y = 1018, z = 7}, {x = 1027, y = 1023, z = 7}, 10, 8, 2, 2}
}
monsters = {
-- Tile AID = b[1], b[2] ;]
[10201] = {"Dragon Lord", {x = 1021, y = 1020, z = 7}},
[10202] = {"Frost Dragon", {x = 1029, y = 1020, z = 7}}
}
function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
local creaturesList = {}
for x = -radiusx, radiusx do
for y = -radiusy, radiusy do
if not (x == 0 and y == 0) then
local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
table.insert(creaturesList, creature.uid)
end
end
end
end
local creature = getTopCreature(position)
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
if not(table.find(creaturesList, creature.uid)) then
table.insert(creaturesList, creature.uid)
end
end
return creaturesList
end
]]></config>
<movevent type="StepIn" actionid="10001-10002" event="script"><![CDATA[
domodlib('HuntAreaFunctions')
function onStepIn(cid, item, position, fromPosition)
local v = config[item.actionid]
function kickEvent(cid, item, position, fromPosition)
if (getCreaturesInRange(v[2], v[6], v[7], FALSE, TRUE) ~= 0 and getCreatureStorage(cid, 654321) > 0) then
doTeleportThing(cid, v[3])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doCreatureSetStorage(cid, 654321, -1)
doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
end
end
if getPlayerLevel(cid) >= v[5] then
if(getPlayerItemCount(cid, 2157) > 0) then
local players = getCreaturesInRange(v[2], v[6], v[7], FALSE, TRUE)
if #players == 0 then
local creatures = getCreaturesInRange(v[2], v[6], v[7], TRUE, FALSE)
for i = 1, #creatures do
doRemoveCreature(creatures[i])
end
doSendMagicEffect(position, CONST_ME_TELEPORT)
doTeleportThing(cid, v[1])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerRemoveItem(cid, 2157, 1)
doCreatureSay(cid, "Now you have " .. v[4] .. " minutes for hunting monsters, else you will be kicked out.", TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
pauseKick = addEvent(kickEvent, v[4] * 60 * 1000, cid)
doCreatureSetStorage(cid, 654321, 1)
return TRUE
else
doCreatureSay(cid, "There is someone else in the room.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
else
doCreatureSay(cid, "You don't have enought golden nugget.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
else
doCreatureSay(cid, "You must be at least level " .. v[5] .. " or higher to enter.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
doTeleportThing(cid, fromPosition)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
return TRUE
end
]]></movevent>
<movevent type="StepIn" actionid="10101-10102" event="script"><![CDATA[
domodlib('HuntAreaFunctions')
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
doCreatureSetStorage(cid, 654321, -1)
stopEvent(pauseKick)
end
end]]></movevent>
<movevent type="StepIn" actionid="10201-10202" event="script"><![CDATA[
domodlib('HuntAreaFunctions')
function onStepIn(cid, item, position, fromPosition)
local b = monsters[item.actionid]
if(isPlayer(cid) and exhaustion.check(cid, item.actionid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You should wait " .. exhaustion.get(cid, item.actionid) .. " seconds.")
elseif (isPlayer(cid)) then
exhaustion.set(cid, item.actionid, 10)
doSummonCreature(b[1], b[2])
doSendMagicEffect(b[2], CONST_ME_TELEPORT)
end
end]]></movevent>
</mod>
