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

buyskill tfs 0.2.11pl2 client 9.1

marcelao777

New Member
Joined
Sep 9, 2011
Messages
81
Reaction score
0
My script buyskill removes the item the 9971 from bp but not add the skill, i use tfs 0.2.11pl2 mystic spirit client 9.1

my buyskill.lua
function onSay(cid, words, param, channel)
local x = {
item = 9971, -- Item que vai ser removido
quantidade = 1, -- Quantidade vai ser removido
quantidadeskill = 1, -- Quantidade que o player irá comprar
limiteskill = 349 -- Se o limite for 350, faz 350-1(quantidade de skill) = 349
}

local xml = {
item = 9971, -- Item para poder comprar
quantidade = 3, -- Quantidade de item que vai gastar
quantidademl = 1, -- Quantidade que o player irá comprar
limitedeml = 199 -- Se o limite for 200, faz 200-1(quantidade de ml) = 199
}

local pid = getPlayerGUID(cid) -- Não mecha

local id = {
["skillclub"] = 1, -- Não mecha
["skillsword"]= 2, -- Não mecha
["skillaxe"] = 3, -- Não mecha
["skilldistance"] = 4, -- Não mecha
["skillshielding"] = 5 -- Não mecha
}

local voc = {
["skillclub"] = {4, 8, 9, 10}, -- Vocações que irá comprar club
["skillsword"] = {4, 8}, -- Vocações que irá comprar sword
["skillaxe"] = {4, 8}, -- Vocações que irá comprar axe
["skilldistance"] = {3, 7}, -- Vocações que irá comprar distance
["skillshielding"] = {4, 8, 9, 10} -- Vocações que irá comprar shielding
}

local vocml = {1, 2, 11, 5, 6, 12} -- Vocações que irá comprar magic level

local pz = "sim"

if(pz == "sim") and (getTilePzInfo(getCreaturePosition(cid)) == false) then
doPlayerSendCancel(cid, "Você precisa estar em protection zone pra poder comprar.")
return true
end

if (param == '') then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Como usar: !comprar skillclub.")
return true
end

if (param == 'magiclevel') then
if getPlayerMagLevel(cid) <= xml.limitedeml then
if isInArray(vocml, getPlayerVocation(cid)) == true then
if doPlayerRemoveItem(cid, xml.item, xml.quantidade) then
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + ".. xml.quantidademl .." WHERE `id` = ".. pid .. "")
else
doPlayerSendCancel(cid, "Você não tem 3 Barras de ouro.")
end
else
doPlayerSendCancel(cid, "Voce não pode comprar magic level.")
end
else
doPlayerSendCancel(cid, "Você chegou no limite de magic level.")
end
return true
end

if(id[param:lower()]) then
if(getPlayerSkill(cid, id[param:lower()]) <= x.limiteskill) then
if isInArray(voc[param:lower()], getPlayerVocation(cid)) == true then
if doPlayerRemoveItem(cid, x.item, x.quantidade) then
doRemoveCreature(cid, true)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. x.quantidadeskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";")
else
doPlayerSendCancel(cid, "Você não tem 1 Barra de ouro.")
end
else
doPlayerSendCancel(cid, "Voce não pode comprar este skill.")
end
else
doPlayerSendCancel(cid, "Você chegou no limite de skill.")
end
else
doPlayerSendCancel(cid, "Skill desconhecida.")
end
return true
end

help
 
Lua:
 -- made by Fire Element
function onSay(cid, words, param, channel)
        local x = {
                item = 9971,
                amount = 10,
                amountskill = 10,
                limitskill = 340
        }
 
        local xml = {
                item = 9971,
                amount = 15,
                amountml = 5,
                limitml = 195
        }
 
        local pid = getPlayerGUID(cid)
 
        local id = {
                ["skillclub"] = 1,
                ["skillsword"]= 2,
                ["skillaxe"] = 3,
                ["skilldistance"] = 4,
                ["skillshielding"] = 5
        }
 
        local voc = {
                ["skillclub"] = {4, 8},
                ["skillsword"] = {4, 8},
                ["skillaxe"] = {4, 8},
                ["skilldistance"] = {3, 7},
                ["skillshielding"] = {4, 8}
        }
 
        local vocml = {1, 2, 5, 6}
 
        local pz = "yes"
 
        if(pz == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == false) then
           doPlayerSendCancel(cid, "You need be in protect zone to buy.")
           return true
        end
 
        if (param == '') then
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Example: !buy skillshielding.")
           return true
        end
 
        if (param == 'magiclevel') then
            if getPlayerMagLevel(cid) <= xml.limitml then
                    if isInArray(vocml, getPlayerVocation(cid)) == true then
                            if doPlayerRemoveItem(cid, xml.item, xml.amount) then
                                            doRemoveCreature(cid, true)
                                            db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + ".. xml.amountml .." WHERE `id` = ".. pid .. "")
                                    else
                                            doPlayerSendCancel(cid, "You don't have required item.")
                                    end
                        else
                                   doPlayerSendCancel(cid, "You can't buy magic level.")
                        end
            else
                    doPlayerSendCancel(cid, "You've reached the limit of magic level.")
            end
return true
end
 
                if(id[param:lower()]) then
                        if(getPlayerSkill(cid, id[param:lower()]) <= x.limitskill) then
                                if isInArray(voc[param:lower()], getPlayerVocation(cid)) == true then
                                if doPlayerRemoveItem(cid, x.item, x.amount) then
                                        doRemoveCreature(cid, true)
                                        db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. x.amountskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";")
                                else
                                        doPlayerSendCancel(cid, "You don't have required item.")
                                end
                              else
                                 doPlayerSendCancel(cid, "You can't buy this skill.")
                              end 
                        else            
                                doPlayerSendCancel(cid, "You've reached the limit of this skill.")
                        end
                else
                        doPlayerSendCancel(cid, "Unknown skill.")
                end
return true
end
 
Lua:
 -- made by Fire Element
function onSay(cid, words, param, channel)
        local x = {
                item = 9971,
                amount = 10,
                amountskill = 10,
                limitskill = 340
        }
 
        local xml = {
                item = 9971,
                amount = 15,
                amountml = 5,
                limitml = 195
        }
 
        local pid = getPlayerGUID(cid)
 
        local id = {
                ["skillclub"] = 1,
                ["skillsword"]= 2,
                ["skillaxe"] = 3,
                ["skilldistance"] = 4,
                ["skillshielding"] = 5
        }
 
        local voc = {
                ["skillclub"] = {4, 8},
                ["skillsword"] = {4, 8},
                ["skillaxe"] = {4, 8},
                ["skilldistance"] = {3, 7},
                ["skillshielding"] = {4, 8}
        }
 
        local vocml = {1, 2, 5, 6}
 
        local pz = "yes"
 
        if(pz == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == false) then
           doPlayerSendCancel(cid, "You need be in protect zone to buy.")
           return true
        end
 
        if (param == '') then
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Example: !buy skillshielding.")
           return true
        end
 
        if (param == 'magiclevel') then
            if getPlayerMagLevel(cid) <= xml.limitml then
                    if isInArray(vocml, getPlayerVocation(cid)) == true then
                            if doPlayerRemoveItem(cid, xml.item, xml.amount) then
                                            doRemoveCreature(cid, true)
                                            db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + ".. xml.amountml .." WHERE `id` = ".. pid .. "")
                                    else
                                            doPlayerSendCancel(cid, "You don't have required item.")
                                    end
                        else
                                   doPlayerSendCancel(cid, "You can't buy magic level.")
                        end
            else
                    doPlayerSendCancel(cid, "You've reached the limit of magic level.")
            end
return true
end
 
                if(id[param:lower()]) then
                        if(getPlayerSkill(cid, id[param:lower()]) <= x.limitskill) then
                                if isInArray(voc[param:lower()], getPlayerVocation(cid)) == true then
                                if doPlayerRemoveItem(cid, x.item, x.amount) then
                                        doRemoveCreature(cid, true)
                                        db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. x.amountskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";")
                                else
                                        doPlayerSendCancel(cid, "You don't have required item.")
                                end
                              else
                                 doPlayerSendCancel(cid, "You can't buy this skill.")
                              end 
                        else            
                                doPlayerSendCancel(cid, "You've reached the limit of this skill.")
                        end
                else
                        doPlayerSendCancel(cid, "Unknown skill.")
                end
return true
end


error in console
deler.jpg
 
try

Lua:
-- made by Fire Element
dofile("./config.lua")
function onSay(cid, words, param, channel)
	local x = {
		item = 9971,
		amount = 10,
		amountskill = 10,
		limitskill = 340
	}
	
	local xml = {
		item = 9971,
		amount = 15,
		amountml = 5,
		limitml = 195
	}
	
	local pid = getPlayerGUID(cid)
	
	local id = {
		["skillclub"] = 1,
		["skillsword"]= 2,
		["skillaxe"] = 3,
		["skilldistance"] = 4,
		["skillshielding"] = 5
	}
	
	local voc = {
		["skillclub"] = {4, 8},
		["skillsword"] = {4, 8},
		["skillaxe"] = {4, 8},
		["skilldistance"] = {3, 7},
		["skillshielding"] = {4, 8}
	}
	
	local vocml = {1, 2, 5, 6}
	
	local pz = "yes"

	if sqlType == "mysql" then
		env = assert(luasql.mysql())
		con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
	else -- sqlite
		env = assert(luasql.sqlite3())
		con = assert(env:connect(sqliteDatabase))
	end

	if(pz == "yes") and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
		doPlayerSendCancel(cid, "You need be in protect zone to buy.")
		return true
	end
	
	if (param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Example: !buy skillshielding.")
		return true
	end
	
	if (param == 'magiclevel') then
		if getPlayerMagLevel(cid) <= xml.limitml then
			if isInArray(vocml, getPlayerVocation(cid)) then
				if doPlayerRemoveItem(cid, xml.item, xml.amount) then
					doRemoveCreature(cid, true)
					assert(con:execute("UPDATE `players` SET `maglevel` = `maglevel` + ".. xml.amountml .." WHERE `id` = ".. pid .. ""))
				else
					doPlayerSendCancel(cid, "You don't have required item.")
				end
			else
				doPlayerSendCancel(cid, "You can't buy magic level.")
			end
           else
			doPlayerSendCancel(cid, "You've reached the limit of magic level.")
		end
		return true
	end
	
	if(id[param:lower()]) then
		if(getPlayerSkill(cid, id[param:lower()]) <= x.limitskill) then
			if isInArray(voc[param:lower()], getPlayerVocation(cid)) then
				if doPlayerRemoveItem(cid, x.item, x.amount) then
					doRemoveCreature(cid, true)
					assert(con:execute("UPDATE `player_skills` SET `value` = `value` + ".. x.amountskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";"))
				else
					doPlayerSendCancel(cid, "You don't have required item.")
				end
			else
				doPlayerSendCancel(cid, "You can't buy this skill.")
			end 
		else            
			doPlayerSendCancel(cid, "You've reached the limit of this skill.")
		end
	else
		doPlayerSendCancel(cid, "Unknown skill.")
	end
	return true
end
 
i change
doRemoveCreature(cid, true) --- (doRemoveCreature(cid)
assert(con:execute("UPDATE `player_skills` SET `value` = `value` + ".. x.amountskill .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id[param:lower()] ..";"))

very very thank - :D
 

Similar threads

Replies
8
Views
1K
Evil Puncker
E
Back
Top