• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

how to add using time to this script? +rep

kimokimo

Kimo
Joined
Jan 25, 2011
Messages
821
Solutions
6
Reaction score
156
GitHub
karimadnan
some days ago i found this script but i want to add using time for it like player can use it every 10sec here is the script


local speed = 1500 --- Put the speed you'd like
function onUse(cid, item, fromPosition, itemEx, toPosition)
doCreatureAddMana(cid, 10000000)
doChangeSpeed(cid, speed)
doSendAnimatedText(getPlayerPosition(cid), "FULL MP!", 11)
doSendMagicEffect(getPlayerPosition(cid), 30)
addEvent(doChangeSpeed, 10*1000, cid, -speed)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,message) ---- If you don't want messages displayed then erase this line
return true
end
 
EDITED!, sorry i dont like to dissapoint people :p so i fixed it and tested it on my server.
now its fully working and as you can see you can set:
-how much speed would you like
-cooldown time
-minimun lvl to use
-the storage number used for this script
-the msg type
-and the msgs that people will read on different situations.


if there is anything else you would like to add to the script sendme a PM with the modifications and the link to this thread so i can re edit it :p



LUA:
-- fully working and tested script by Tymofek --
-- implemented some more things like "minimun lvl" --
-- Enjoy ;p 

 
local speed = 1500 -- Put the speed you would like
local time = 10 --secs to use it again
local minlvl = 1 -- minimun lvl to use it
local notyet = "you can not yet use it" -- edit it as you wish
local used = "you have used it!" --edit as you wish
local nowyoucan = "The item is ready to be used" --edit as you wish
local minlvlmsg = "you have to be lvl " .. minlvl .. " to use it"
local storage = 5055 -- change it if you are using it
local msgtype = 17 -- this is the msginfodescrb you can change it from 13 to 22
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue (cid, storage) <= os.time () and getPlayerLevel(cid) >= minlvl then
setPlayerStorageValue(cid, storage, os.time () + time)
addEvent(doPlayerSendTextMessage,time*1000,cid,msgtype,nowyoucan) -- eliminate the nowyoucan msg
doPlayerAddMana(cid, 10000000)-- depending on the TFS version this can be "doCreatureAddMana"
doChangeSpeed(cid, speed)
doSendAnimatedText(getPlayerPosition(cid), "FULL MP!", 11)
doSendMagicEffect(getPlayerPosition(cid), 30)
addEvent(doChangeSpeed, 10*1000, cid, -speed) 
doPlayerSendTextMessage(cid,msgtype,used) --eliminate the used msg
elseif getPlayerStorageValue(cid, storage) > os.time () then
doPlayerSendTextMessage(cid,msgtype,notyet) -- eliminate the notyet msg
elseif getPlayerLevel(cid) < minlvl then
doPlayerSendTextMessage(cid,msgtype,minlvlmsg) 
end



return true
end
 
Last edited:
LUA:
--[[ BY SUMM ]]--
 
local config = {
	storage = 5455,
	cooldown = 10,
	speed = 1500
}

 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue (cid, config.storage) >= os.time() then
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot use it yet.")
	end
	
	setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown)
	doCreatureAddMana(cid, 10000000)
	doChangeSpeed(cid, config.speed)
	doSendAnimatedText(getPlayerPosition(cid), "FULL MP!", 11)
	doSendMagicEffect(getPlayerPosition(cid), 30)
	addEvent(doChangeSpeed, 10*1000, cid, -config.speed) 
	
	return true
end
 
LUA:
--[[ BY SUMM ]]--
 
local config = {
	storage = 5455,
	cooldown = 10,
	speed = 1500
}

 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue (cid, config.storage) >= os.time() then
		return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot use it yet.")
	end
	
	setPlayerStorageValue(cid, config.storage, os.time() + config.cooldown)
	doCreatureAddMana(cid, 10000000)
	doChangeSpeed(cid, config.speed)
	doSendAnimatedText(getPlayerPosition(cid), "FULL MP!", 11)
	doSendMagicEffect(getPlayerPosition(cid), 30)
	addEvent(doChangeSpeed, 10*1000, cid, -config.speed) 
	
	return true
end

Better
LUA:
doCreatureAddMana(cid, getCreatureMaxMana(cid))
 
yeah i tought about that but in my tfs version the function is "doPlayerAddMana" so i didnt wanted the script to fail in another TFS version :p.

anyway in the original script there amount of mana added its for sure full filling your max mana :p
 
Back
Top