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

Lua Buyskill

Fire Element

Member
Joined
Sep 10, 2010
Messages
193
Reaction score
22
Location
Brazil
The skill is limited by the client, but when you add the datebase, it reboots, is to do it on command?

script:

LUA:
local itemretirado = 9971
function onSay(cid, words, param, channel)
local alpha={}
confere(cid)
        if doPlayerRemoveItem(cid,itemretirado,10) then
                if(param == 'fist') and alpha[1] ~= 0 then
                        doPlayerAddSkill(cid,0,10)
                elseif(param == 'club') and alpha[2] ~= 1 then
                        doPlayerAddSkill(cid,1,10)
                elseif(param == 'sword') and alpha[3] ~= 2 then
                        doPlayerAddSkill(cid,2,10)
                elseif(param == 'axe') and alpha[4] ~= 3 then
                        doPlayerAddSkill(cid,3,10)
                elseif(param == 'distance') and alpha[5] ~= 4 then
                        doPlayerAddSkill(cid,4,10)
                elseif(param == 'shield') and alpha[6] ~= 5 then
                        doPlayerAddSkill(cid,5,10)
                else
                        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você já atingiu o número máxido de skills para se poder comprar mais.")
                end
                doSendMagicEffect(getThingPos(cid),12)
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Skill comprado com sucesso.")
        else
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você não tem o necessário para comprar esta skill.")
        end
		return true
end

function confere(cid)

for x=0,5 do
        if getPlayerSkillLevel(cid,x) >= 350 then
                alpha[x+1] = x
        end
end
end

function:

LUA:
function doPlayerAddSkill(cid, skill, amount, round)
	local amount = amount or 1
	if(skill == SKILL__LEVEL) then
		return doPlayerAddLevel(cid, amount, round)
	elseif(skill == SKILL__MAGLEVEL) then
		return doPlayerAddMagLevel(cid, amount)
	end

	for i = 1, amount do
		doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
	end

	return true
end
 
Please explain your problem and what you want us to help you with again.. I dont get it
 
The command only adds up to the skill level 202, if the edit of datebase to place as you want, is to do this with the command? in order to put how much skill you want

sorry for my english
 
This should do it, it will add skills by using database.
NOTE: Player has to be logged off if you want this command to work.
LUA:
function setSkill(cid, skillid, amount)
	local playerid = getPlayerGUID(cid)
	db.executeQuery("UPDATE `player_skills` SET `value` = `value` + " .. amount .. " WHERE `player_id` = " .. playerid .. " and`skillid` = " .. skillid .. ";")
end
 
Last edited:
I think your script is wrong even as the skill resets instead of adding
-----
This resets the skill o/

I think you do not understand...

in datebase, you put skill 350, will stay in the game 94, only game

in command, the skill comes in 202 and not to add more

I wanted to give a command to be equal to datebase

after i reach 202 in command, would become 0 but the player still would get like skill 202

sorry for my english
 
Edited my post.
I don't really get what you wanna say with this, but try my script again.
in datebase, you put skill 350, will stay in the game 94, only game
 
Back
Top