• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Anni lever 'One Player' (no demon spawn)

chackie

New Member
Joined
Nov 1, 2009
Messages
87
Reaction score
0
EDITED:
Can someone help me fix this script:
Code:
local annihistorage = 8790
local annihiglobalstorage = 8679
local demonposition = {x=EDIT, y=EDIT, z=EDIT} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,annihistorage) < 1 then
   if getGlobalStorageValue(cid,annihiglobalstorage) < 1 then
      setGlobalStorageValue(cid,annihiglobalstorage,1)
      doTeleportThing(cid,demonposition)
   else
       doPlayerSendCancel(cid, "You cannot enter until whos there finishes the quest!")
   end
else
    doPlayerSendCancel(cid, "You have already done this quest")
end
return true
end

Code:
<movevent type="StepIn" uniqueid="29333" event="script" value="tp.lua"/>

Code:
local annihiglobalstorage = 8679
local position = {x=EDIT, y=EDIT, z=EDIT} ---- Position you go when you leave annihi reward room
function onStepIn(cid, item, pos)
         doTeleportThing(cid,position)
         setGlobalStorageValue(cid,annihiglobalstorage,-1)
    return true
end

THE PROBLEM:
The things that needs to be fixed.. If Player A pulled the lever and dies in the quest, then player B gets message: "you cannot enter until whos there finishes the quest!" Can someone fix if player A gets offline (dies or logg off) then player B can pulled the lever.
 
Last edited:
haha ;P Try to set a exhausted time on the lever? or is it too complicated ?

Nonono, its easier with that function, actually it should work fine, I got no idea why it doesnt, better to wait for someone more pro to fix it or something :S
 
Put this at 1st post, and remove the tp thingy,
LUA:
local area = 
{
        {x=81, y=128, z=7, stackpos = 255},  ---- Top south - west corner
        {x=84, y=126, z=7, stackpos = 255} ----- Top north - east corner
}
 
local annihistorage = 17865
local demonposition = {x=81, y=128, z=7} ------ Position where player will be teleported.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local players = getPlayersOnline()
for _, pid in ipairs(players) do
	if getPlayerStorageValue(cid,annihistorage) < 1 then
		if isInRange(getCreaturePosition(pid), area[1], area[2]) == false then
			doTeleportThing(cid,demonposition)
		else
			doPlayerSendCancel(cid, "Wait til " .. getCreatureName(pid) .. " has finished the quest!")
		end
	else
		doPlayerSendCancel(cid, "You have already done this quest")
	end
end
return true
end

This is better than that, although its not checking the area alright :S
Try this:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
function playerIn() ---- Credits to KylerXX for this function
	for areax = 64,71 do 
		for areay = 102,106 do
                for areaz = "NUMBER", "NUMBER" do
		local area = {x = areax, y = areay, z = areaz, stackpos = 255}
		if isPlayer(getThingFromPos(area).uid) then
		return true
		end
		end
                end
	end
	return false
end

local annihistorage = 17865
local demonposition = {x=81, y=128, z=7} ------ Position where player will be teleported.

local players = getPlayersOnline()
for _, pid in ipairs(players) do
	if not PlayerIn() then
       if getPlayerStorageValue(cid,annihistorage) < 1 then
	      doTeleportThing(cid,demonposition)
		else
			doPlayerSendCancel(cid, "You have already done this quest")
		end
	elseif PlayerIn() then
		doPlayerSendCancel(cid, "Theres someone inside! You must wait till he finishes in order to go inside")
	end
end
return true
end
 
Last edited:
Too put my local area (my quest) is big got more then one z levels and others tp to others room. Is it not better to have a tp at the end of the quest so the script knows when the Player has gone from questet?
 
Edited post, now it shud work for more than 1 floor.

The other way, uhm, I like it more this way, the other way u have to make a login function and add some more stuff, I could do it, but I find it better with this function, just 1 file.
 
Ye but its like a room and a tp and the tp is for continue the quest. z levels and other local area?
But how about this
Simple Script... I think :P.. Action Lever
Position where player will be teleported.
Exhusted on lever about 30-20min and get a message: "You need to wait for you turn" something like this
And if you already have done the quest gets message: "You have already done the quest" If it works.
 
Okay, make it a non-logout zone then and add this
creaturecsripts/scripts/annihilogin.lua
LUA:
function onLogin(cid)
if getPlayerStorageValue(cid,8790) > 0 then
   setGlobalStorageValue(cid,8679,-1)
   end
return true
end

creaturescripts.xml
XML:
<event type="login" name="Annilogin" event="script" value="annihilogin.lua"/>
And use the script you got at ya 1st post and it shud work fine
 
Everthing works except if Player A dies in the quest. Player B cant pull the lever... :/

If player A dies he will relog? Are you relogging? thats what the login function is there for :p
Probably registering at login.lua
registerCreatureEvent('Annilogin')
 
I did relogg :P and I put the registerCreatureEvent('Annilogin') at login.lua >.<

Did get in .exe: Error - CreatureScript inteface
data/ bla bla /login.lua:OnLogin
Description:
<luaRegisterCreatureEvent> Creature not found
 
Last edited:
Change
Code:
registerCreatureEvent('Annilogin')
to
Code:
registerCreatureEvent([B][COLOR="red"]cid, [/COLOR][/B]'Annilogin')
 
Well it still dosent work :S
If player A dies and the B player tries to pulled the lever get the message: "You cannot enter until whos there finishes the quest"
Player A must go trough the TP. Then Next player can pull the lever.

I get no errors in .exe
 
Back
Top