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

[REQ] Command Sell Skill

Beyond Sky

Weed is Life
Joined
Sep 6, 2010
Messages
120
Reaction score
162
Location
Brazil - CWB
[REQ] Command Sell Skill

I need a talkaction that sells skills/magic level points, but with some requeriments:

Magic Level Points: Only Druid and Sorc can buy, and with a limits of 200 Magic Level.
Skill, Distance: Only Paladin can buy, with a limits of 350 Distance Skill.
Skill, Sword, Club and Axe: Only Knight can buy, with a limits of 350 skill.​

U can use this function that i Add in my Server. Maked by Vodkart from a Brazilian Fórum.

Code:
function doPlayerSetSkill(cid, skill, amount)
local pid = getPlayerGUID(cid)  
doRemoveCreature(cid,true) 
db.executeQuery("UPDATE `player_skills` SET `value` = ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")  
return TRUE
end

function doPlayerSetMagic(cid, amount)
local pid = getPlayerGUID(cid)  
doRemoveCreature(cid,true) 
db.executeQuery("UPDATE `players` SET `maglevel` = " .. amount .. " WHERE `id` = "..pid)
return TRUE
end

And this sample:

Code:
function onSay(cid, words, param)
local add = 10 -- quanto vc quer adicionar de magic level
doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
return TRUE 
end
 
Last edited:
Features:
* You can easy change GoldIgnot's ID.
* You can easy change the quantity of price for each skill.
* You can easy change vocations.
* You can change how many skill`s player can bought.
* You can set up the Real Animation feature
- yes - only players when staying near character seeing the animation of bought skills
- no - all players see the effect

Lua:
function onSay(cid, words, param)
-- Changeable ------------------------------------------------------------------
local add = 10 -- how much skills add.
local druid_id = getPlayerVocation(cid, 1)
local sorcerer_id = getPlayerVocation(cid, 2)
local knight_id = getPlayerVocation(cid, 3)
local paladin_id = getPlayerVocation(cid, 4)
-- Price Changeable ------------------------------------------------------------
local itemid = 9971 -- gold ignots ID
local mlvl = 10 -- how many gold ignot per skill
local dist = 10
local sword = 10
local club = 10
local axe = 10
--------------------------------------------------------------------------------
-- Real Animation
-- Shows Message - "Skills" when bought?
local msgs = "no" -- if set yes, the msg is showing only near of player (1sqm x 1sqm) 
--------------------------------------------------------------------------------

-- here check for Skill -> Magic Levels
if (doPlayerRemoveItem(cid, itemid) == mlvl) == true then
	if druid_id and sorcerer_id and getPlayerSkill(cid, 7) <= 200 then -- the limit of skill
		return doPlayerSendCancel(cid, "You cannot buy magic levels, when your magic level is higher than 200.")
	else
		doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
			end
			end
			end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. mlvl .. " ignots.")
end
-- here check for Skill -> Distance
if (doPlayerRemoveItem(cid, itemid) == dist) == true then
	if paladin_id and getPlayerSkill(cid, 4) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy distance fighting, when your distance is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 4)+add)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
			end
			end
			end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. dist .. " ignots.")
end
-- here check for Skill -> Sword
if (doPlayerRemoveItem(cid, itemid) == sword) == true then
	if knight_id and getPlayerSkill(cid, 1) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy sword fighting, when your sword is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 1)+add)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
			end
			end
			end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. sword .. " ignots.")
end
-- here check for Skill -> Club
if (doPlayerRemoveItem(cid, itemid) == club) == true then
	if knight_id and getPlayerSkill(cid, 2) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy club fighting, when your club is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 2)+add)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
			end
			end
			end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. club .. " ignots.")
end
-- here check for Skill -> Axe
if (doPlayerRemoveItem(cid, itemid) == axe) == true then
	if knight_id and getPlayerSkill(cid, 3) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy axe fighting, when your axe is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 3)+add)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
			end
			end
			end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. axe .. " ignots.")
end
-- done
return true
end
 
Last edited:
No Worked man :(.

Player say the command: /skill and add Magic Level... In Kina, Pally, Druid, Sorc...

say /skill distance, /skill axe... but the script add Magic level in all vocations.

I'M TESTING NEW SCRIPT
 
Last edited:
You test in tfs 0.4 svn 8.6 ?
I dont have Donator status on OtLand.

@Topic
Anyway,
Test this one.

Lua:
function onSay(cid, words, param)
-- Changeable ------------------------------------------------------------------
local add = 10 -- how much skills add.
local druid_id = getPlayerVocation(cid, 1)
local sorcerer_id = getPlayerVocation(cid, 2)
local knight_id = getPlayerVocation(cid, 3)
local paladin_id = getPlayerVocation(cid, 4)
-- Price Changeable ------------------------------------------------------------
local itemid = 9971 -- gold ignots ID
local mlvl = 10 -- how many gold ignot per skill
local dist = 10
local sword = 10
local club = 10
local axe = 10
--------------------------------------------------------------------------------
-- Real Animation
-- Shows Message - "Skills" when bought?
local msgs = "no" -- if set yes, the msg is showing only near of player (1sqm x 1sqm) 
--------------------------------------------------------------------------------

-- here check for Skill -> Magic Levels
if getPlayerItem(cid, itemid, mlvl) == true then
	if druid_id and sorcerer_id and getPlayerSkill(cid, 7) <= 200 then -- the limit of skill
		return doPlayerSendCancel(cid, "You cannot buy magic levels, when your magic level is higher than 200.")
	else
		doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
		doPlayerRemoveItem(cid, itemid, mlvl)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. mlvl .. " ignots.")
end
-- here check for Skill -> Distance
if getPlayerItem(cid, itemid, dist) == true then
	if paladin_id and getPlayerSkill(cid, 4) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy distance fighting, when your distance is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 4)+add)
		doPlayerRemoveItem(cid, itemid, dist)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. dist .. " ignots.")
end
-- here check for Skill -> Sword
if getPlayerItem(cid, itemid, sword) == true then
	if knight_id and getPlayerSkill(cid, 1) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy sword fighting, when your sword is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 1)+add)
		doPlayerRemoveItem(cid, itemid, sword)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. sword .. " ignots.")
end
-- here check for Skill -> Club
if getPlayerItem(cid, itemid, club) == true then
	if knight_id and getPlayerSkill(cid, 2) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy club fighting, when your club is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 2)+add)
		doPlayerRemoveItem(cid, itemid, club)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. club .. " ignots.")
end
-- here check for Skill -> Axe
if getPlayerItem(cid, itemid, axe) == true then
	if knight_id and getPlayerSkill(cid, 3) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy axe fighting, when your axe is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 3)+add)
		doPlayerRemoveItem(cid, itemid, axe)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. axe .. " ignots.")
end
-- done
return true
end
 
On use talkaction with new script... appear this error in TFS

i38470_xd.png
 
Here is good version without any changes (i add boolean string an c++ based but in lua):
Lua:
function onSay(cid, words, param)
-- Changeable ------------------------------------------------------------------
local add = 10 -- how much skills add.
local druid_id = getPlayerVocation(cid, 1)
local sorcerer_id = getPlayerVocation(cid, 2)
local knight_id = getPlayerVocation(cid, 3)
local paladin_id = getPlayerVocation(cid, 4)
-- Price Changeable ------------------------------------------------------------
local itemid = 9971 -- gold ignots ID
local config = {
		mlvl = 10 -- how many gold ignot per skill
		dist = 10
		sword = 10
		club = 10
		axe = 10
}
config.mlvl = getBooleanFromString(config.mlvl)
config.dist = getBooleanFromString(config.dist)
config.sword = getBooleanFromString(config.sword)
config.club = getBooleanFromString(config.club)
config.axe = getBooleanFromString(config.axe)
--------------------------------------------------------------------------------
-- Real Animation
-- Shows Message - "Skills" when bought?
local msgs = "no" -- if set yes, the msg is showing only near of player (1sqm x 1sqm) 
--------------------------------------------------------------------------------

-- here check for Skill -> Magic Levels
if getPlayerItem(cid, itemid, config.mlvl) == true then
	if druid_id and sorcerer_id and getPlayerSkill(cid, 7) <= 200 then -- the limit of skill
		return doPlayerSendCancel(cid, "You cannot buy magic levels, when your magic level is higher than 200.")
	else
		doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
		doPlayerRemoveItem(cid, itemid, config.mlvl)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. config.mlvl .. " ignots.")
end
-- here check for Skill -> Distance
if getPlayerItem(cid, itemid, config.dist) == true then
	if paladin_id and getPlayerSkill(cid, 4) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy distance fighting, when your distance is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 4)+add)
		doPlayerRemoveItem(cid, itemid, config.dist)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. config.dist .. " ignots.")
end
-- here check for Skill -> Sword
if getPlayerItem(cid, itemid, config.sword) == true then
	if knight_id and getPlayerSkill(cid, 1) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy sword fighting, when your sword is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 1)+add)
		doPlayerRemoveItem(cid, itemid, config.sword)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. config.sword .. " ignots.")
end
-- here check for Skill -> Club
if getPlayerItem(cid, itemid, config.club) == true then
	if knight_id and getPlayerSkill(cid, 2) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy club fighting, when your club is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 2)+add)
		doPlayerRemoveItem(cid, itemid, config.club)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. config.club .. " ignots.")
end
-- here check for Skill -> Axe
if getPlayerItem(cid, itemid, config.axe) == true then
	if knight_id and getPlayerSkill(cid, 3) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy axe fighting, when your axe is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 3)+add)
		doPlayerRemoveItem(cid, itemid, config.axe)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. config.axe .. " ignots.")
end
-- done
return true
end
 
Code:
function onSay(cid, words, param)
-- Changeable ------------------------------------------------------------------
local add = 10 -- how much skills add.
local druid_id = getPlayerVocation(cid, 1)
local sorcerer_id = getPlayerVocation(cid, 2)
local knight_id = getPlayerVocation(cid, 3)
local paladin_id = getPlayerVocation(cid, 4)
-- Price Changeable ------------------------------------------------------------
local itemid = 9971 -- gold ignots ID
local mlvl = 10 -- how many gold ignot per skill
local dist = 10
local sword = 10
local club = 10
local axe = 10
--------------------------------------------------------------------------------
-- Real Animation
-- Shows Message - "Skills" when bought?
local msgs = "no" -- if set yes, the msg is showing only near of player (1sqm x 1sqm) 
--------------------------------------------------------------------------------
 
-- here check for Skill -> Magic Levels
if getPlayerItem(cid, itemid, 10) == true then
	if druid_id and sorcerer_id and getPlayerSkill(cid, 7) <= 200 then -- the limit of skill
		return doPlayerSendCancel(cid, "You cannot buy magic levels, when your magic level is higher than 200.")
	else
		doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
		doPlayerRemoveItem(cid, itemid, 10)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. mlvl .. " ignots.")
end
-- here check for Skill -> Distance
if getPlayerItem(cid, itemid, 10) == true then
	if paladin_id and getPlayerSkill(cid, 4) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy distance fighting, when your distance is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 4)+add)
		doPlayerRemoveItem(cid, itemid, dist)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. dist .. " ignots.")
end
-- here check for Skill -> Sword
if getPlayerItem(cid, itemid, 10) == true then
	if knight_id and getPlayerSkill(cid, 1) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy sword fighting, when your sword is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 1)+add)
		doPlayerRemoveItem(cid, itemid, sword)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. sword .. " ignots.")
end
-- here check for Skill -> Club
if getPlayerItem(cid, itemid, 10) == true then
	if knight_id and getPlayerSkill(cid, 2) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy club fighting, when your club is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 2)+add)
		doPlayerRemoveItem(cid, itemid, club)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. club .. " ignots.")
end
-- here check for Skill -> Axe
if getPlayerItem(cid, itemid, 10) == true then
	if knight_id and getPlayerSkill(cid, 3) <= 350 then
		return doPlayerSendCancel(cid, "You cannot buy axe fighting, when your axe is higher than 350.")
	else
		doPlayerSetSkill(cid, getPlayerSkill(cid, 3)+add)
		doPlayerRemoveItem(cid, itemid, axe)
	if(not msgs) then
		doSendAnimatedText(pos, "Skills!", 18)
	else
			for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doSendAnimatedText(pos, "Skills!", 18)
	end
	end
	end
end
else
doPlayerSendTextMessage(cid,22,"You don't have enough gold ignots. It cost " .. axe .. " ignots.")
end
-- done
return true
end

so?

the error is persisting
 
Strange :( the last version that u post no work too.
I say the talk fail and no appear any error :(

Shit, why no work in my server :(?

The first version that no had options to buy work... with bug but work.
 
Man u can only put here

For can't use if the player have 200 Magic Level
Code:
function onSay(cid, words, param)
if getPlayerVocation(cid) == 2 and 1 then
doPlayerRemoveItem(cid,IDITEM,QUANTIDADE)
local add = 1 
doPlayerSetMagic(cid, getPlayerMagLevel(cid)+add)
end
return TRUE
end

And here can't use if the player have 350 skill?
Code:
function onSay(cid, words, param)
if getPlayerVocation(cid) == 3 then
doPlayerRemoveItem(cid,IDITEM,QUANTIDADE)
local add = 1 
doPlayerSetDISTANCE(cid, getPlayerDISTANCE(cid)+add)
end
return TRUE
end
 
Back
Top