Daniel Kopeć
Member
The guild that won the castle can enter the castle and exp. It works fine.
But the problem is that players who are not in the guild can enter the castle and exp also too.
Only players who are in the guild but do not own the castle cannot enter.
piece of script w-castle MOD:
How to fix it? How to correct the code to check if the player is in the guild?
So that players without a guild could not pass.
Or maybe someone has a script that only passes people who are in the guild.
So I would have put it on the sqm beforehand.
There where the GOD Verbania is standing in the photo.
But the problem is that players who are not in the guild can enter the castle and exp also too.
Only players who are in the guild but do not own the castle cannot enter.
piece of script w-castle MOD:
XML:
<action actionid='4992' event='script'>
<![CDATA[
domodlib('castle_config')
domodlib('castle_lib')
function onUse(cid, item, fromPosition, itemEx, toPosition)
if castleCfg.castleGetReward ~= false then
if getPlayerGuildName(cid) == getCastleOwner() then
if getPlayerLevel(cid) >= castleCfg.levelToGetReward then
if getCreatureStorage(cid, item.actionid) <= os.time() then
local cash, rewardItem = math.random(castleCfg.cash.min, castleCfg.cash.max), castleCfg.itemsToGive[math.random(#castleCfg.itemsToGive)]
doPlayerAddItem(cid, 2160, cash)
doPlayerAddItem(cid, rewardItem, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Dostajesz ' .. cash .. ' crystal coins and ' .. getItemNameById(rewardItem) .. ' od twojego krola!')
doCreatureSetStorage(cid, item.actionid, os.time() + 60 * 60 * 24)
else
doPlayerSendCancel(cid, 'Otrzymales juz swoj prezent! Mozesz dostac to ponownie za ' .. secondsToClock(math.abs(os.difftime(getCreatureStorage(cid, item.actionid), os.time()))) .. '.')
end
else
doPlayerSendCancel(cid, 'Twoj poziom jest za niski. Powinienes miec ' .. castleCfg.levelToGetReward .. '.')
end
else
doPlayerSendCancel(cid, 'Nie masz dostepu do tej nagrody!')
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
doCreatureSetStorage(cid, castleCfg.storage.winner, -1)
doCreatureSetStorage(cid, castleCfg.storage.playersEvent, -1)
end
end
return true
end
]]>
</action>
<movement type='StepIn' actionid='4991' event='script'>
<![CDATA[
domodlib('castle_config')
domodlib('castle_lib')
function onStepIn(cid, item, position)
if getPlayerGuildName(cid) ~= getCastleOwner() then
doPlayerSendCancel(cid, 'Nie masz dostepu, aby sie tam udac!')
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
return false
end
return true
end
]]>
</movement>
How to fix it? How to correct the code to check if the player is in the guild?
So that players without a guild could not pass.
Post automatically merged:
Or maybe someone has a script that only passes people who are in the guild.
So I would have put it on the sqm beforehand.
There where the GOD Verbania is standing in the photo.
Last edited: