• 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 Remove storage of action

Pank

New Member
Joined
Jul 21, 2007
Messages
34
Reaction score
1
Hi all.

What I wanted was simple for those who understand. I would certainly remove the line that makes storing this action, allowing it to be performed as many times as the player wants.
Currently I use the server YurOTS 0.9.4d 7.6.

Action:

Lua:
function onUse(cid, item, frompos, item2, topos)
       
       if item.uid == 3158 then
       if item.itemid == 1945 then
 
           player1pos = {x=164, y=148, z=5, stackpos=253}
           player1 = getThingfromPos(player1pos)
         doSendMagicEffect(frompos, 13)
 
 
       if player1.itemid > 0 then
 
           player1level = getPlayerLevel(player1.uid)
           questlevel = 300
 
       if player1level >= questlevel then
 
           queststatus1 = getPlayerStorageValue(player1.uid,3158)
           
                        
       if queststatus1 == -1 then
 
           nplayer1pos = {x=35, y=75, z=7}
           doSendMagicEffect(player1pos,2)
           doTeleportThing(player1.uid,nplayer1pos)
        doSendMagicEffect(nplayer1pos,14)
           
else
doPlayerSendCancel(cid,"Somebody in your team has already done this quest.")
end

else
doPlayerSendCancel(cid,"All players must have level 300 to enter.")
end

else                   
doPlayerSendCancel(cid,"You need 1 players in your team.")
end
 
elseif item.itemid == 1946 then
if getPlayerAccess(cid) > 0 then
doTransformItem(item.uid,item.itemid-1)

else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end
end

return 1
end


Ty.
 
That is one ugly script, fixed it for you and removed storage. Not sure if this quest is supposed to be for more than one player, if so then the script will need further adjustment. If it's just for one player then this should work fine:

Lua:
function onUse(cid, item, frompos, item2, topos)
local config = {
	questlevel = 300,
	questPos = {x=35, y=75, z=7},
}
	if item.itemid == 1945 then
		if getPlayerLevel(cid) >= config.questlevel then
			doSendMagicEffect(getThingPos(cid), 2)
			doTeleportThing(cid, config.questPos)
			doSendMagicEffect(config.questPos, 14)
			doTransformItem(item.uid, item.itemid + 1)
		else
			doPlayerSendCancel(cid,"All players must have level 300 to enter.")
		end  
	elseif item.itemid == 1946 then
		doTransformItem(item.uid,item.itemid-1)
	end 
return true
end
 
Last edited:
There are no errors in the script above, the problem is that it stores the value of the action, and the player can not do it again.
 
The script that's in my comment now is tested and working fine on newer tfs. If it isn't working it's either because of bad installation or because of some difference between tfs and the engine you are using, without seeing any errors there's no way for me to troubleshoot it.
 
It would be possible to use the script I posted, even if ugly, and only remove the lines referring to storage?
 
Hi all.

What I wanted was simple for those who understand. I would certainly remove the line that makes storing this action, allowing it to be performed as many times as the player wants.
Currently I use the server YurOTS 0.9.4d 7.6.

Action:

Lua:
function onUse(cid, item, frompos, item2, topos)
       
       if item.uid == 3158 then
       if item.itemid == 1945 then
 
           player1pos = {x=164, y=148, z=5, stackpos=253}
           player1 = getThingfromPos(player1pos)
         doSendMagicEffect(frompos, 13)
 
 
       if player1.itemid > 0 then
 
           player1level = getPlayerLevel(player1.uid)
           questlevel = 300
 
       if player1level >= questlevel then
 
           nplayer1pos = {x=35, y=75, z=7}
           doSendMagicEffect(player1pos,2)
           doTeleportThing(player1.uid,nplayer1pos)
        doSendMagicEffect(nplayer1pos,14)
           

else
doPlayerSendCancel(cid,"All players must have level 300 to enter.")
end

else                   
doPlayerSendCancel(cid,"You need 1 players in your team.")
end
 
elseif item.itemid == 1946 then
if getPlayerAccess(cid) > 0 then
doTransformItem(item.uid,item.itemid-1)

else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
end

return 1
end


Ty.

Removed that part of the script above, try it.
 

Similar threads

Back
Top