What's new

Mods Regrouping Room

Status
Not open for further replies.

Ambioda

Active User
Joined
Dec 25, 2012
Messages
121
Reaction score
6
Witam chcia?bym si? z wami podzieli? scryptem na regrouping room. Polega on na tym i? lider gildi wchodzi w teleport i zostaje przeniesiony to pomieszczenia. Cz?onkowie gildi wchodz?c w ten sam teleport zostan? przeniesieni do lidera gildi. Gdy? za? Lider wyjdzie z tego pomieszczenia przez dany teleport wszystkich cz?onk?w znajduj?cych si? w tym pomieszczenie wy?uci na dane pozycje :] Wstawiam ten scrypt poniewa? nie widzia?em ?eby takowy znajdowa? si? na tym forum. (SCRYPT NIE JEST M?J)
wklejamy go do folderu mods/rroom.xml
[XML]
<?xml version='1.0' encoding='UTF-8'?>
<mod name='Regrouping Room' version='1.0' enabled='yes'>
<config name='regroup_config'>
<![CDATA[
regroupCfg = {
rooms = {
[1] = {
teleportPos = {x=796, y=1000, z=7}, ---pozycja gdzie znajduje sie danyroom ---
isFree = 0
},
[2] = {
teleportPos = {x=796, y=1017, z=7},
isFree = 0
},
[3] = {
teleportPos = {x=831, y=1019, z=7},
isFree = 0
},
[4] = {
teleportPos = {x=831, y=1000, z=7},
isFree = 0
},
[5] = {
teleportPos = {x=841, y=979, z=7},
isFree = 0
},
[6] = {
teleportPos = {x=841, y=959, z=7},
isFree = 0
},
[7] = {
teleportPos = {x=841, y=938, z=7},
isFree = 0
},
[8] = {
teleportPos = {x=841, y=918, z=7},
isFree = 0
},
[9] = {
teleportPos = {x=841, y=897, z=7},
isFree = 0
},
},

minLevel = 150, --- minimalny lvl ?eby mo?na by?o wej?? w teleport ---

backPos = {x=999, y=981, z=7}, --- gdzie ma teleportowac po wyjsciu z roomu ---

minOnline = 5, --- minimalna liczba czlonkow online z gildii ---

timeExhaust = 10, -- sekundy
exhaustStorage = 'regroupExhaust'
}
]]>
</config>

<!-- Wejscie -->
<movement type='StepIn' actionid='5000' event='script'>
<![CDATA[
domodlib('regroup_config')

function getGuildMembersOnline(guid)
local mem = {}
for _, cid in ipairs(getPlayersOnline()) do
if getPlayerGuildId(cid) == guid then
table.insert(mem, cid)
end
end
return mem
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if not isPlayer(cid) then
return false
elseif exhaustion.get(cid, regroupCfg.exhaustStorage) then
return doPlayerSendCancel(cid, 'You must wait '..exhaustion.get(cid, regroupCfg.exhaustStorage)..' seconds to be teleport again.'), doTeleportThing(cid, fromPosition)
end
exhaustion.set(cid, regroupCfg.exhaustStorage, regroupCfg.timeExhaust)

if getPlayerGuildId(cid) < 1 then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You do not have a guild!'), doTeleportThing(cid, fromPosition)
end

local free = 0
for k, v in pairs(regroupCfg.rooms) do
if v.isFree == 0 then
free = k
end

if v.isFree == getPlayerGuildId(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have been teleported to your guild.')
doTeleportThing(cid, v.teleportPos)
doCreatureSetStorage(cid, 'regroupRoom', k)
return true
end
end

if getPlayerGuildLevel(cid) >= GUILDLEVEL_LEADER then
if regroupCfg.minLevel >= getPlayerLevel(cid) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You don\'t have enough level to go thourgh.'), doTeleportThing(cid, fromPosition)
elseif regroupCfg.minOnline > #getGuildMembersOnline(getPlayerGuildId(cid)) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'In your guild there aren\'t '..regroupCfg.minOnline..' online members.'), doTeleportThing(cid, fromPosition)
end

if free ~= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have been teleported to free room.')
doCreatureSetStorage(cid, 'regroupRoom', free)
doTeleportThing(cid, regroupCfg.rooms[free].teleportPos)
regroupCfg.rooms[free].isFree = getPlayerGuildId(cid)
return true
end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'There isn\'t free room.'), doTeleportThing(cid, fromPosition)
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your guild isn\'t in any room.'), doTeleportThing(cid, fromPosition)
end
return true
end
]]>
</movement>

<!-- Wyjscie -->
<movement type='StepIn' actionid='7000' event='script'>
<![CDATA[
domodlib('regroup_config')

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if not isPlayer(cid) then
return false
elseif getPlayerGuildId(cid) < 1 then
return doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end

if getPlayerGuildLevel(cid) >= GUILDLEVEL_LEADER then
local p, k = regroupCfg.backPos, getCreatureStorage(cid, 'regroupRoom')
regroupCfg.rooms[k].isFree = 0
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You leave from room with your guild.')
for _, pid in ipairs(getPlayersOnline()) do
if getCreatureStorage(pid, 'regroupRoom') == k then
doCreatureSetStorage(pid, 'regroupRoom', 0)
doTeleportThing(pid, {x=p.x+math.random(-1,1),y=p.y+math.random(-1,1), z=p.z})
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have been teleported to temple.')
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doCreatureSetStorage(cid, 'regroupRoom', 0)
end
return true
end
]]>
</movement>

<globalevent name='Regroup_start' type='startup' event='script'>
<![CDATA[
domodlib('regroup_config')

function onStartup()
for k, v in pairs(regroupCfg.rooms) do
v.isFree = 0
end
return true
end
]]>
</globalevent>
</mod>
[/XML]
W map edytorze tworzymy teleport i dajemy mu actionid 5000. P??niej przechodzimy do roomu i tworzymy teleport oraz dodajemy mu actionid 7000. My?l?, ?e przyda wam si? ten scrypt.
 

Skajowski

Senior User
Joined
Jun 11, 2010
Messages
1,160
Reaction score
90
Odp: Regrouping Room

Dzi?ki ! Mi si? na pewno przyda
 

Kahras

Senior User
Joined
Aug 26, 2011
Messages
2,714
Reaction score
167
Age
25
Odp: Regrouping Room

Skrypter jaki? ci to napisa? - ten skrypt gdzie? by? p?atny ? bo o dziwo jest na niekt?rych otkach a nigdzie go w necie nie by?o.
 

Placek

Blue Waffle
Joined
Sep 30, 2008
Messages
6,793
Reaction score
672
Age
9
Odp: Regrouping Room

@up
Widzialem za free juz pare wersji tego skryptu z pol roku temu jak nie lepiej...
Pare razy jako wolny skrypt i pare razy w datach serwerow, chociazby w materii ktorejs w modach chyba byl tez ten skrypt...
 

Ambioda

Active User
Joined
Dec 25, 2012
Messages
121
Reaction score
6
Odp: Regrouping Room

Dok?adnie ten scrypt jest wyci?gni?ty z daty otsmaterii brawo za spostrzegawczo?? :)
 

Ambioda

Active User
Joined
Dec 25, 2012
Messages
121
Reaction score
6
Odp: Regrouping Room

Taki ?adny scrypt a nikt go nie skomentuje ??

---------- Tre?? dodana o 17:52 ----------

Czemu nikt nie Komentuje ?? @REF!
 

Dantez

Moim sekretem jest ciasto
Joined
May 22, 2008
Messages
1,206
Reaction score
202
Odp: Regrouping Room

Taki ?adny scrypt a nikt go nie skomentuje ??

---------- Tre?? dodana o 17:52 ----------

Czemu nikt nie Komentuje ?? @REF!

Bo nie ma czego.
 
Status
Not open for further replies.
Top