• 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!

Lua Script help please

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
Hello, i got a script for vip quest that when push lever u can do the vip quest. If you fail/take more time than 5 min u are tped out of quest.

When u been tped out u need to wait 1 h til u can do the quest again.

But something is wrong now. Cuz it saves 1 h for all players.
I mean, if i do the quest and i fail all ppl have to wait 1 h not just the single one.. Please help me :D

Errors in console:
Code:
[Error - Action Interface] 
In a timer event called from: 
data/actions/scripts/annihilatorr.lua:onUse
Description: 
(luaGetCreatureStorage) Creature not found

Script:
Code:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 1945 or item.itemid == 1946 then
		if(getPlayerStorageValue(cid, 30016) == -1)then
			nplayer1pos = {x=979, y=1409, z=11}
			doTeleportThing(cid, nplayer1pos)
			setPlayerStorageValue(cid, 30016, 1)  
			local hours = 1
			local timed = 5
			local tijd = 0

			local function timer(i)
				xpos = {x=1000, y=1000, z=7}
				if (getPlayerStorageValue(cid, 5785) == 1) then
					setPlayerStorageValue(cid, 30016, 2)
					doPlayerSendTextMessage(cid, 19, "You've compleated the quest before time runs out!")
				else
					addEvent(setPlayerStorageValue(cid, 30016, -1), (hours * 1 * 60 * 60 * 1000))
					doTeleportThing(cid, xpos)
					doPlayerSendTextMessage(cid, 19, 'You need to wait '.. hours ..' hour before you could do this quest again!')
				end
			end

			if(tijd == 0)then
				addEvent(timer, (timed * 60 * 1000))
				doPlayerSendTextMessage(cid, 19, 'Whitin '.. timed ..' minutes you will get teleported back for safety reasons.')
			end
		else
			doPlayerSendCancel(cid, "You can't pull this lever yet.")
		end
	end
return TRUE
end
 
In chest...

thats not the problem, the problem is that the waiting time (1h)

is for all characters and not for the single one..

example: i do the vip quest all ppls need to wait 1h.

how it should be: i do the vip quest i need to wait 1h
 
Lua:
local quest = 4070    ---quest storage
local storage = 4080
local storage1 = 4090
local tpplace = {x=1000,y=1000,z=7}    ----place of quest
local timetolose = 1   ---in munutes
local timereuse = 2  --in minutes

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,quest) == 1 then 
doPlayerSendCancel(cid,"You already made this quest.")
return true
end
if getPlayerStorageValue(cid,storage1) == 1 then 
doPlayerSendCancel(cid,"You cant use this except after an hour from last try.")
return true
end
if getPlayerStorageValue(cid,storage) == 1 then 
doPlayerSendCancel(cid,"You just used this.")
return true
end
function onLose()
if getPlayerStorageValue(cid,storage) == 1 and getPlayerStorageValue(cid,quest) == -1 then
setPlayerStorageValue(cid,storage1,1)
setPlayerStorageValue(cid,storage,-1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
 doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "Time has finished, you cant retry unless 1 hour pass", TALKTYPE_ORANGE_1)
end
return true
end
function onReuse()
if getPlayerStorageValue(cid,storage1) == 1 and and getPlayerStorageValue(cid,quest) == -1 then
setPlayerStorageValue(cid,storage1,-1)
doCreatureSay(cid, "You can remake the quest now", TALKTYPE_ORANGE_1)
end
return true
end

setPlayerStorageValue(cid,storage,1)
doTeleportThing(cid,tpplace,FALSE)
doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "You have "..timetolose.." minutes to complete this quest.", TALKTYPE_ORANGE_1)
addEvent(onLose, timetolose * 60 *1000)
addEvent (onReuse, (timetolose + timereuse) * 60 *1000)
return true
end
 
not work
Code:
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/annihilatorr.lua)
data/actions/scripts/annihilatorr.lua:32: unexpected symbol near 'and'
[Error - LuaScriptInterface::loadFile] data/actions/scripts/annihilatorr.lua:32: unexpected symbol near 'and'
 
just remove one and from this line :)
so (this is the correct version)
Lua:
local quest = 4070    ---quest storage
local storage = 4080
local storage1 = 4090
local tpplace = {x=1000,y=1000,z=7}    ----place of quest
local timetolose = 1   ---in munutes
local timereuse = 2  --in minutes

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,quest) == 1 then 
doPlayerSendCancel(cid,"You already made this quest.")
return true
end
if getPlayerStorageValue(cid,storage1) == 1 then 
doPlayerSendCancel(cid,"You cant use this except after an hour from last try.")
return true
end
if getPlayerStorageValue(cid,storage) == 1 then 
doPlayerSendCancel(cid,"You just used this.")
return true
end
function onLose()
if getPlayerStorageValue(cid,storage) == 1 and getPlayerStorageValue(cid,quest) == -1 then
setPlayerStorageValue(cid,storage1,1)
setPlayerStorageValue(cid,storage,-1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
 doSendMagicEffect(getCreaturePosition(cid), 10)
doCreatureSay(cid, "Time has finished, you cant retry unless 1 hour pass", TALKTYPE_ORANGE_1)
end
return true
end
function onReuse()
if getPlayerStorageValue(cid,storage1) == 1 and getPlayerStorageValue(cid,quest) == -1 then
setPlayerStorageValue(cid,storage1,-1)
doCreatureSay(cid, "You can remake the quest now", TALKTYPE_ORANGE_1)
end
return true
end

setPlayerStorageValue(cid,storage,1)
doTeleportThing(cid,tpplace,FALSE)
doSendMagicEffect(getCreaturePosition(cid), 10
doCreatureSay(cid, "You have "..timetolose.." minutes to complete this quest.", TALKTYPE_ORANGE_1)
addEvent(onLose, timetolose * 60 *1000)
addEvent (onReuse, (timetolose + timereuse) * 60 *1000)
return true
end
 
Last edited:

Similar threads

Back
Top