• 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 Exhaustion on Bridgelever

Bonbon

.: Mútànt :.
Joined
Jul 24, 2008
Messages
240
Reaction score
0
Location
Germany
I tried to add exhaustion in many ways, but no one seems to work.
I want the player to get exhausted when he uses the lever.

Code:
--Script made by Empty

function onUse(cid, item, frompos, item2, topos)
    local tile1 = {x=2840, y=2727, z=8, stackpos=1} --change tilepos
    local tile2 = {x=2840, y=2728, z=8, stackpos=1} --change tilepos
    local gettile1 = getThingfromPos(tile1)
    local gettile2 = getThingfromPos(tile2)
	local tile3 = {x=2840, y=2727, z=8, stackpos=0} --change tilepos
    local tile4 = {x=2840, y=2728, z=8, stackpos=0} --change tilepos
    local gettile1 = getThingfromPos(tile3)
    local gettile2 = getThingfromPos(tile4)

    if item.uid == 9950 and item.itemid == 1945 then
        doRemoveItem(gettile1.uid,2)
        doRemoveItem(gettile2.uid,2)
        doCreateItem(3764,1,tile1)
        doCreateItem(3764,1,tile2)
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 9950 and item.itemid == 1946 then
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doCreateItem(460,1,tile1) --change itemID
        doCreateItem(460,1,tile2) --change itemID
        doCreateItem(1548,1,tile3) --change itemID
        doCreateItem(1548,1,tile4) --change itemID
        doTransformItem(item.uid,item.itemid-1) 	
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end

Thank's for help.
 
Last edited:
Try this:
Code:
local exhaustionStorage = 06660
local time = 15
function onUse(cid, item, frompos, item2, topos)
    local tile1 = {x=2840, y=2727, z=8, stackpos=1} --change tilepos
    local tile2 = {x=2840, y=2728, z=8, stackpos=1} --change tilepos
    local gettile1 = getThingfromPos(tile1)
    local gettile2 = getThingfromPos(tile2)
	local tile3 = {x=2840, y=2727, z=8, stackpos=0} --change tilepos
    local tile4 = {x=2840, y=2728, z=8, stackpos=0} --change tilepos
    local gettile1 = getThingfromPos(tile3)
    local gettile2 = getThingfromPos(tile4)

		if not(exhaustion.check(cid,exhaustionStorage)) then
	
    if item.uid == 9950 and item.itemid == 1945 then
        doRemoveItem(gettile1.uid,2)
        doRemoveItem(gettile2.uid,2)
        doCreateItem(3764,1,tile1)
        doCreateItem(3764,1,tile2)
        doTransformItem(item.uid,item.itemid+1)
		exhaustion.set(cid,exhaustionStorage,time)
    elseif item.uid == 9950 and item.itemid == 1946 then
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doCreateItem(460,1,tile1) --change itemID
        doCreateItem(460,1,tile2) --change itemID
        doCreateItem(1548,1,tile3) --change itemID
        doCreateItem(1548,1,tile4) --change itemID
        doTransformItem(item.uid,item.itemid-1) 	
		exhaustion.set(cid,exhaustionStorage,time)
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end
		end

    return 1
end
 
Back
Top