Fire Element
Member
A query (not function(doPlayerAddSkill)) that adds 10 skill of sword in the player who clicks on the chest.
sorry for my english
sorry for my english
local id = {club = 1, sword = 2, axe = 3, distance = 4, shield = 5}
local pid = getPlayerGUID(cid)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + 10 WHERE `player_id` = "..pid.." and `skillid` = "..id.sword..";")
db.query('UPDATE player_skills SET value = value+10 WHERE skillid = 2 AND player_id = ' .. getPlayerGUID(cid))
function onUse(cid, item)
if getPlayerItemCount(cid,1) then
db.executeQuery('UPDATE player_skills SET value = value+10 WHERE skillid = 1 AND player_id = ' .. getPlayerGUID(cid))
doRemoveItem(item.uid)
else
return false
end
end
local STORAGE = 12455
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getCreatureStorage(cid, STORAGE) > 0 then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'It is empty.')
end
local p = getThingPos(cid)
local positions =
{
[1] = {
{x=p.x+1,y=p.y,z=p.z}, 100, 900
},
[2] = {
{x=p.x+1,y=p.y+1,z=p.z}, 200, 980
},
[3] = {
{x=p.x,y=p.y+1,z=p.z}, 300, 1060
},
[4] = {
{x=p.x-1,y=p.y+1,z=p.z}, 400, 1140
},
[5] = {
{x=p.x-1,y=p.y,z=p.z}, 500, 1220
},
[6] = {
{x=p.x-1,y=p.y-1,z=p.z}, 600, 1300
},
[7] = {
{x=p.x,y=p.y-1,z=p.z}, 700, 1380
},
[8] = {
{x=p.x+1,y=p.y-1,z=p.z}, 800, 1460
}
}
for i = 1, 8 do
addEvent(doSendDistanceShoot, positions[i][2], positions[i][1], p, 24)
addEvent(doSendDistanceShoot, positions[i][3], positions[i][1], p, 24)
end
doCreatureSetStorage(cid, STORAGE, 1)
addEvent(doSendMagicEffect, 900, p, 49)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found a reward of ten sword skill levels.')
db.executeQuery('UPDATE player_skills SET value = value+10 WHERE skillid = 2 AND player_id = ' .. getPlayerGUID(cid))
return true
end
doRemoveCreature(cid,true) -- This =P
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. w.count .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. id.sword ..";")
function doPlayerAddSkill(cid, skill, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")
end
function doPlayerRemoveSkill(cid, skill, amount)
local pid = getPlayerGUID(cid)
doRemoveCreature(cid,true)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` - ".. amount .." WHERE `player_id` = ".. pid .. " and `skillid` = ".. skill ..";")
end