zabuzo
Well-Known Member
- Joined
- Jun 10, 2016
- Messages
- 238
- Reaction score
- 54
I want to make a full server based in dugeons but idk how to do the lever system, so i need some help
I made this scripts by searching and copy from others scripts, i need 4 things that i asked in comments -- how to
So just ctrl+f in scripts "-- how to" in scripts
My questions are in the code
-- 1 how to: if there is a team doing players cant go in
-- 2 how to: only accept different IPs
-- 3 how to: after enter have 15 min to do a quest, if dont teleport to 956/1039/7
-- 4 how to: after go in have a exausted of 24 hours to go again
Even help with 1 would help a lot
dungeon_lever.lua
I made this scripts by searching and copy from others scripts, i need 4 things that i asked in comments -- how to
So just ctrl+f in scripts "-- how to" in scripts
My questions are in the code
-- 1 how to: if there is a team doing players cant go in
-- 2 how to: only accept different IPs
-- 3 how to: after enter have 15 min to do a quest, if dont teleport to 956/1039/7
-- 4 how to: after go in have a exausted of 24 hours to go again
Even help with 1 would help a lot
dungeon_lever.lua
Code:
-- positions and where go
local p = {
[1] = {
player = {
position = {x = 952, y = 1039, z = 7},
toPos = {x = 953, y = 1047, z = 6}
}
},
[2] = {
player = {
position = {x = 953, y = 1039, z = 7},
toPos = {x = 954, y = 1047, z = 6}
}
},
[3] = {
player = {
position = {x = 954, y = 1039, z = 7},
toPos = {x = 955, y = 1047, z = 6}
}
},
[4] = {
player = {
position = {x = 955, y = 1039, z = 7},
toPos = {x = 956, y = 1047, z = 6}
}
}
}
-- min lvl
local minLevel = 10
local maxLevel = 20
-- get a vocation's base vocation
function getBaseVocation(vocation)
if vocation >= 5 and vocation <= 8 then
return vocation - 4
elseif vocation >= 9 and vocation <= 12 then
return vocation - 8
end
return vocation
end
-- 3 how to: after enter have 15 min to do a quest, if dont teleport to 956/1039/7
function onUse(cid)
-- 1 how to: if there is a team doing players cant go in
-- 2 how to: only accept different IPs
local questPlayers = {}
for i = 1, #p do
local pid = getTopCreature(p[i].player.position).uid
if isPlayer(pid) then
if getPlayerLevel(pid) >= minLevel and getPlayerLevel(pid) <= maxLevel then
if getBaseVocation( getPlayerVocation(pid) ) == i then
-- 3 how to: remove tile per vocation, only accept if have 4 vocation, but dosent matter the position
else
doPlayerSendCancel(cid, "A vocation is on the wrong spot.")
return false
end
else
doPlayerSendCancel(cid, getCreatureName(pid) .. ", is not high enough in level, the level to enter have to be between " .. minLevel .. "~ " .. maxLevel .. ". ")
return false
end
else
doPlayerSendCancel(cid, "A player is missing.")
return false
end
end
for x = 1, #questPlayers do
-- 4 how to: after go in have a exausted of 24 hours to go again
doPlayerSendTextMessage(questPlayers[x], MESSAGE_INFO_DESCR, "Good luck!")
doTeleportThing(questPlayers[x], p[x].player.toPos)
end
return true
end