elnelson
Lunaria World Dev
Good morning, otlanders. I've been working on this script but i cant make it work, seems like it is not scanning global storages, i've made some prints and it does not advance when i sign up with different vocs nor same vocs.
-no errors in console
-no do not detects most of global storages :S
-cant check if there is already another of the same voc
-cant check how many vocs remains for the dungeon
-does not teleport if there is already the 4 vocs
Im using TFS REV 3774
-no errors in console
-no do not detects most of global storages :S
-cant check if there is already another of the same voc
-cant check how many vocs remains for the dungeon
-does not teleport if there is already the 4 vocs
Im using TFS REV 3774
Lua:
---------------Pos of dungeon start----------------
local dungeon_one_pos = {x = 1000, y = 1000, z = 7}
---------------Tell server if dungeons are open-------
local dungeon_one_open = 33311
----------Tells server what vocs are in que---------
local knight_in_que = 33313
local sorc_in_que = 33314
local paladin_in_que = 33315
local druid_in_que = 33316
----Tells server players that are in que--------
local in_que_one = 33317
local in_que_1 = 33317
---------------------------
local isSorc = {1, 5, 9, 13, 17}
local isDruid = {2, 6, 10, 14, 18}
local isPaladin = {3, 6, 11, 15, 19}
local isKnight = {4, 7, 12, 16, 20}
--------Helps me script----------
local getGlobalStorage = getGlobalStorageValue
local sendTextMessage = doPlayerSendTextMessage
local sendMagicEffect = doSendMagicEffect
local getPlayerStorage = getPlayerStorageValue
function onSay(cid, words, param, channel)
if (getGlobalStorage(dungeon_one_open) == nil) then
setGlobalStorageValue(dungeon_one_open, 0)
doPlayerSendTextMessage(cid, 22, "Closed.")
end
if (param == '' or param == "0") then
doPlayerSendTextMessage(cid, 22, "Select a number for desirded dungeon (!dungeon 1).")
end
if (param == "1" or param == "first") then ------------------This part is if player uses talkaction again, after being qued into the dungeon--------------
-- doPlayerSendTextMessage(cid, 22, "You have signed for dungeon one.")
if (getPlayerStorageValue(cid, in_que_1) ~= 1) then
print(1)
if (isInArray(isSorc, getPlayerVocation(cid))) then
print(2)
if (getGlobalStorage(knight_in_que) ~= 1) then
print(3)
if (getGlobalStorage(druid_in_que) ~= 1) then
print(4)
if (getGlobalStorage(paladin_in_que) ~= 1) then
print(5)
sendTextMessage(cid, 22, "Waiting for all vocations.")
return false
else
print(6)
sendTextMessage(cid, 22, "waiting for a druid and a knight.")
return false
end
else
print(7)
sendTextMessage(cid, 22, "Waiting for a knight.")
return false
end
end
elseif (isInArray(isDruid, getPlayerVocation(cid))) then
if (getGlobalStorage(knight_in_que) ~= 1) then
if (getGlobalStorage(sorc_in_que) ~= 1) then
if (getGlobalStorage(paladin_in_que) ~= 1) then
sendTextMessage(cid, 22, "Waiting for all vocations.")
return false
else
sendTextMessage(cid, 22, "waiting for a sorcerer and a knight.")
return false
end
else
sendTextMessage(cid, 22, "Waiting for a knight.")
return false
end
end
elseif (isInArray(isPaladin, getPlayerVocation(cid))) then
if (getGlobalStorage(knight_in_que) ~= 1) then
if (getGlobalStorage(sorc_in_que) ~= 1) then
if (getGlobalStorage(druid_in_que) ~= 1) then
doPlayerSendTextMessage(cid, 22, "Waiting for all vocations.")
return false
else
doPlayerSendTextMessage(cid, 22, "waiting for a sorcerer and a knight.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "Waiting for a knight.")
return false
end
end
elseif (isInArray(isKnight, getPlayerVocation(cid))) then
if (getGlobalStorage(druid_in_que) ~= 1) then
if (getGlobalStorage(sorc_in_que) ~= 1) then
if (getGlobalStorage(paladin_in_que) ~= 1) then
doPlayerSendTextMessage(cid, 22, "Waiting for all vocations.")
return false
else
doPlayerSendTextMessage(cid, 22, "waiting for a sorcerer and a druid.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "Waiting for a druid.")
return false
end
end
else
if (isInArray(isSorc, getPlayerVocation(cid))) then ----------------------This is main script--------------------------
if (getGlobalStorage(dungeon_one_open) == 0) then
if (getGlobalStorage(knight_in_que) == 1) then
if (getGlobalStorage(paladin_in_que) == 1) then
if (getGlobalStorage(druid_in_que) == 1) then
if (getGlobalStorage(sorc_in_que) == 0) then
setPlayerStorageValue(cid, in_que_1, 1)
for i, pid in ipairs(getPlayersOnline()) do
------------------Auto dungeon starter-----------------
if (getPlayerStorage(pid, in_que_one) == 1) then
doTeleportThing(pid, dungeon_one_pos)
sendTextMessage(pid, 22, "Welcome to dungeon one. This is your team.")
sendMagicEffect(pid, math.random(1, 20))
setGlobalStorageValue(dungeon_one_open, 1)
setPlayerStorageValue(pid, in_que_1, 0)
end
end
else
doPlayerSendCancel(cid, "There is already a Sorcerer qued in this dungeon.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendCancel(cid, "The dungeon is already in use.")
return false
end
elseif (isInArray(isDruid, getPlayerVocation(cid))) then ------------------Reapeat script for each voc.------------
if (getGlobalStorage(dungeon_one_open) == 0) then
if (getGlobalStorage(sorc_in_que) == 1) then
if (getGlobalStorage(paladin_in_que) == 1) then
if (getGlobalStorage(knight_in_que) == 1) then
if (getGlobalStorage(druid_in_que) == 0) then
setPlayerStorageValue(cid, in_que_one, 1)
for i, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorage(pid, in_que_one) == 1) then
doTeleportThing(pid, dungeon_one_pos)
sendTextMessage(pid, 22, "Welcome to dungeon one. This is your team.")
sendMagicEffect(pid, math.random(1, 20))
setGlobalStorageValue(dungeon_one_open, 1)
end
end
else
doPlayerSendCancel(cid, "There is already a Druid qued in this dungeon.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendCancel(cid, "The dungeon is already in use.")
return false
end
elseif (isInArray(isPaladin, getPlayerVocation(cid))) then
if (getGlobalStorage(dungeon_one_open) == 0) then
if (getGlobalStorage(knight_in_que) == 1) then
if (getGlobalStorage(sorc_in_que) == 1) then
if (getGlobalStorage(druid_in_que) == 1) then
if (getGlobalStorage(paladin_in_que) == 0) then
setPlayerStorageValue(cid, in_que_one, 1)
for i, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorage(pid, in_que_one) == 1) then
doTeleportThing(pid, dungeon_one_pos)
sendTextMessage(pid, 22, "Welcome to dungeon one. This is your team.")
sendMagicEffect(pid, math.random(1, 20))
setGlobalStorageValue(dungeon_one_open, 1)
end
end
else
doPlayerSendCancel(cid, "There is already a Paladin qued in this dungeon.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendCancel(cid, "The dungeon is already in use.")
return false
end
elseif (isInArray(isKnight, getPlayerVocation(cid))) then
if (getGlobalStorage(dungeon_one_open) == 0) then
if (getGlobalStorage(paladin_in_que) == 1) then
if (getGlobalStorage(sorc_in_que) == 1) then
if (getGlobalStorage(druid_in_que) == 1) then
if (getGlobalStorage(knight_in_que) == 0) then
setPlayerStorageValue(cid, in_que_one, 1)
for i, pid in ipairs(getPlayersOnline()) do
if (getPlayerStorage(pid, in_que_one) == 1) then
doTeleportThing(pid, dungeon_one_pos)
sendTextMessage(pid, 22, "Welcome to dungeon one. This is your team.")
sendMagicEffect(pid, math.random(1, 20))
setGlobalStorageValue(dungeon_one_open, 1)
end
end
else
doPlayerSendCancel(cid, "There is already a Paladin qued in this dungeon.")
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendTextMessage(cid, 22, "You have been qued, you will be teleported when there is a full team.")
setPlayerStorageValue(cid, in_que_1, 1)
return false
end
else
doPlayerSendCancel(cid, "The dungeon is already in use.")
return false
end
end
end
end
return true
end
end