• 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 [Action] problem

Real Vandta

Member
Joined
Jun 16, 2020
Messages
56
Solutions
1
Reaction score
11
Location
Egypt
How to make this script people can use it 1 more after using and you will cannot use again how? help me please


local storage = 4595 -- point left storage
local level = 1
function onUse(cid, item, frompos, item2, topos)
if not(isPlayer(cid)) then return true end
if getPlayerLevel(cid) >= level then
doCreatureSetStorage(cid, storage, math.max(0, getCreatureStorage(cid, storage)) + 10)
doSendMagicEffect(getPlayerPosition(cid), 14)
doPlayerPopupFYI(cid, "You have added 10 talents points to your account.")
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid,22, "Sorry, but you need to be level "..level.."+ to enter here")
doSendMagicEffect(getThingPos(cid),10)
doTeleportThing(cid, fromPosition)
end
return true
end
 
So you want players to only use it once? I can't understand.
 
players use this items 1 more not 2 more or 3, 1 more only
Post automatically merged:

ana 3ayz a3mlha lw 1 darbha mara wa7da lama yagy yadrb el tanya y2olo "You cannot use this item more you was using the last time"
 
ana 3ayz a3mlha lw 1 darbha mara wa7da lama yagy yadrb el tanya y2olo "You cannot use this item more you was using the last time"
Edit your franko letters, Its only allowed to write English in Support board.
I got what you meant.
Here is a script try it.
Lua:
local storage = 4595 -- point left storage
local level = 1
function onUse(cid, item, frompos, item2, topos)
if not(isPlayer(cid)) then return true end
if getPlayerLevel(cid) >= level then
if getCreatureStorage(cid, storage) < 1 then
doCreatureSetStorage(cid, storage, 1)
doSendMagicEffect(getPlayerPosition(cid), 14)
doPlayerPopupFYI(cid, "You have added 10 talents points to your account.")
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid,22, "Sorry, but you need to be level "..level.."+ to enter here")
doSendMagicEffect(getThingPos(cid),10)
doTeleportThing(cid, frompos)
end
else
doPlayerSendTextMessage(cid,22, "You have already used it.")
doSendMagicEffect(getThingPos(cid),10)
end
return true
end
 
Last edited:
What error? Copy/paste it.
Edit: I can see it, Your first script wasn't even working.
doTeleportThing(cid, fromPosition)
Changed fromPosition to frompos try it.
 
Back
Top