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

Training without Training monks

Status
Not open for further replies.

Adiko

GetOnMyHorse
Joined
Apr 25, 2009
Messages
177
Reaction score
0
Location
Poland \ Wodzisław
Like in topic. I need script for tile. You walk on some tile an then showing messenge "Train will start in 30 sec". After that you start train and all skills are adding like in normal training

Sry 4 my bad english
 
Version 1.0 beta :)

- Fixed in/out bug

- Player now loses mana

need to modify creaturescripts/scripts/login.lua because if player logout or server drop during the 10 seconds wait he will never be able to train again lol (better way to deal with this?)

add this line
PHP:
setPlayerStorageValue(cid, 18010, 0)


PHP:
-- Config --
local skilltries = 10 -- Number of tries per skill
local t = 2 * 1000 -- Set the time before try is added to skills
local lock = 10 * 1000 -- Time to wait before start again
-------------------------------------------------------------------------
function onStepIn(cid, item, pos, fromPos)
	local p = {cid = cid, item = item, pos = pos}
	if getPlayerStorageValue(p.cid, 18010) == 2 then
		doTeleportThing(p.cid, fromPos, TRUE)
		doPlayerSendTextMessage(p.cid,22,"You must wait 10 seconds before you start again")
		return false
	end
	setPlayerStorageValue(p.cid, 18010, 1)
	if isPlayer(p.cid) and getPlayerStorageValue(p.cid, 18010) == 1 then
		if p.item.actionid == 900 then
			doPlayerSendTextMessage(p.cid,22,"Your training session will now begin")
			addEvent(trainMe, t, p)
		end
	end
	return true
end
function onStepOut(cid, item)
	if getPlayerStorageValue(cid, 18010) == 2 then
		return false
	end
	setPlayerStorageValue(cid, 18010, 2)
	addEvent(trainLock, lock, cid)
	doPlayerSendTextMessage(cid,22,"Your training session has now ended")
	return true
end
function trainLock (cid)
	if isPlayer(cid) then
		setPlayerStorageValue(cid, 18010, 0)
	end
end
function trainMe(p)
	if isPlayer(p.cid) and getPlayerStorageValue(p.cid, 18010) == 1  then
		if p.item.actionid == 900 then
			manaspent = getPlayerMana(p.cid) -- Total player mana
			doPlayerAddSkillTry(p.cid, SKILL_FIST, skilltries)
			doPlayerAddSkillTry(p.cid, SKILL_SWORD, skilltries)
			doPlayerAddSkillTry(p.cid, SKILL_CLUB, skilltries)
			doPlayerAddSkillTry(p.cid, SKILL_AXE, skilltries)
			doPlayerAddSkillTry(p.cid, SKILL_DISTANCE, skilltries)
			doPlayerAddSkillTry(p.cid, SKILL_SHIELD, skilltries)
			doPlayerAddSpentMana(p.cid, manaspent)
			doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)
			doSendMagicEffect(getPlayerPosition(p.cid),34)
		end
		addEvent(trainMe, t, p)
	end
	return true
end

YEA IM PRETTY NEW WITH LUA!
 
Last edited:
Status
Not open for further replies.
Back
Top