juansanchez
Intermediate OT User
- Joined
- Apr 2, 2015
- Messages
- 217
- Reaction score
- 129
Hey guys, i have this quest on my server that is supossed to give skills to players.
Mages get Magic Level, Knights and Paladins Skills.
I have a working script but it is way too glitchy.. Whenever a player does the quest, it does not give the right amount of skills, if someone is using some kind of equipment that gives skills, the quest will add skill on top of that, and if for example, a knight uses "utito tempo" right before using the chest, they'll get the skill set to whatever skill they go to when they use utito tempo + the amount of skill that the quest should give. (Skill 100, utito tempo goes to 130, quest gives 12, they go to 142 [Example]).
Also, whenever a player clicks on the chest, the server lags.
That's the script. I did find another one, that seems to use database to add the skills, which i believe is better. However when i try to use it, it gives me this error:
Here's the script:
Bottomline is, can anyone help me either fix the first one, or make the second one work?
Longstory short: Gives skill, can't use spells to boost skill nor itens. If the player could logout when the skill is added (i believe it's via the db this happens).
Tfs 0.3.6 10.10
Sorry for the long post.
Mages get Magic Level, Knights and Paladins Skills.
I have a working script but it is way too glitchy.. Whenever a player does the quest, it does not give the right amount of skills, if someone is using some kind of equipment that gives skills, the quest will add skill on top of that, and if for example, a knight uses "utito tempo" right before using the chest, they'll get the skill set to whatever skill they go to when they use utito tempo + the amount of skill that the quest should give. (Skill 100, utito tempo goes to 130, quest gives 12, they go to 142 [Example]).
Also, whenever a player clicks on the chest, the server lags.
Lua:
function onUse(cid, item, frompos, item2, topos)
local pS = getPlayerStorageValue(cid, 2357)
local pV = getPlayerVocation(cid)
if pS > 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ja fez a quest.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
else
if pV == 5 or pV == 6 or pV == 12 then
setPlayerStorageValue(cid, 2357, 1)
doPlayerAddMagLevel(cid, 6)
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Magic Up", TEXTCOLOR_BLUE)
elseif pV == 7 then
setPlayerStorageValue(cid, 2357, 1)
doPlayerAddSkill(cid, SKILL_DISTANCE, doPlayerAddSkill(cid, SKILL_DISTANCE, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Distance Up", TEXTCOLOR_BLUE)
elseif pV == 10 then
setPlayerStorageValue(cid, 2357, 1)
doPlayerAddSkill(cid, SKILL_CLUB, doPlayerAddSkill(cid, SKILL_CLUB, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
elseif pV == 14 then
setPlayerStorageValue(cid, 2357, 1)
doPlayerAddSkill(cid, SKILL_FIST, doPlayerAddSkill(cid, SKILL_FIST, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Fist Up", TEXTCOLOR_BLUE)
elseif pV == 8 then
setPlayerStorageValue(cid, 2357, 1)
local highest = "SKILL_CLUB"
if getPlayerSkillLevel(cid, SKILL_SWORD) > getPlayerSkillLevel(cid, highest) then
highest = "SKILL_SWORD"
end
if getPlayerSkillLevel(cid, SKILL_AXE) > getPlayerSkillLevel(cid, highest) then
highest = "SKILL_AXE"
end
if highest == "SKILL_CLUB" then
doPlayerAddSkill(cid, SKILL_CLUB, doPlayerAddSkill(cid, SKILL_CLUB, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Club Up", TEXTCOLOR_BLUE)
elseif highest == "SKILL_SWORD" then
doPlayerAddSkill(cid, SKILL_SWORD, doPlayerAddSkill(cid, SKILL_SWORD, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Sword Up", TEXTCOLOR_BLUE)
else
doPlayerAddSkill(cid, SKILL_AXE, doPlayerAddSkill(cid, SKILL_AXE, 12))
doSendMagicEffect(getPlayerPosition(cid), 28)
doSendAnimatedText(getPlayerPosition(cid), "Axe Up", TEXTCOLOR_BLUE)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao tem a vocacao necessaria.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
return true
end
That's the script. I did find another one, that seems to use database to add the skills, which i believe is better. However when i try to use it, it gives me this error:
[20:58:56.702] [Error - Test Interface]
[20:58:56.704] data/actions/scripts/lagartos.lua
[20:58:56.707] Description:
[20:58:56.708] (internalGetPlayerInfo) Player not found when requesting player info #18
[20:58:56.710] [Error - Test Interface]
[20:58:56.711] data/actions/scripts/lagartos.lua
[20:58:56.711] Description:
[20:58:56.715] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.718] [Error - Test Interface]
[20:58:56.720] data/actions/scripts/lagartos.lua
[20:58:56.721] Description:
[20:58:56.721] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.723] [Error - Test Interface]
[20:58:56.729] data/actions/scripts/lagartos.lua
[20:58:56.730] Description:
[20:58:56.731] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.731] [Error - Event::checkScript] Event onUse not found (data/actions/scripts/lagartos.lua)
[20:58:56.704] data/actions/scripts/lagartos.lua
[20:58:56.707] Description:
[20:58:56.708] (internalGetPlayerInfo) Player not found when requesting player info #18
[20:58:56.710] [Error - Test Interface]
[20:58:56.711] data/actions/scripts/lagartos.lua
[20:58:56.711] Description:
[20:58:56.715] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.718] [Error - Test Interface]
[20:58:56.720] data/actions/scripts/lagartos.lua
[20:58:56.721] Description:
[20:58:56.721] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.723] [Error - Test Interface]
[20:58:56.729] data/actions/scripts/lagartos.lua
[20:58:56.730] Description:
[20:58:56.731] (internalGetPlayerInfo) Player not found when requesting player info #6
[20:58:56.731] [Error - Event::checkScript] Event onUse not found (data/actions/scripts/lagartos.lua)
Here's the script:
Code:
local playerid = getPlayerGUID(cid)
local ml = 6
local skillnew = 12
if isInArray({5,6}, getPlayerVocation(cid)) then
db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + ".. newml .." WHERE `players`.`id`= ".. playerid .."")
elseif isInArray({8}, getPlayerVocation(cid)) then
local club = getPlayerSkillLevel(cid, SKILL_CLUB)
local sword = getPlayerSkillLevel(cid, SKILL_SWORD)
local axe = getPlayerSkillLevel(cid, SKILL_AXE)
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (axe + skillnew) .. ", `count` = 0 WHERE `skillid` = 3 and `player_id` = " .. playerid .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (sword + skillnew) .. ", `count` = 0 WHERE `skillid` = 2 and `player_id` = " .. playerid .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (club + skillnew) .. ", `count` = 0 WHERE `skillid` = 1 and `player_id` = " .. playerid .. ";")
elseif isInArray({7}, getPlayerVocation(cid)) then
local distance = getPlayerSkillLevel(cid, SKILL_DISTANCE)
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (distance + skillnew) .. ", `count` = 0 WHERE `skillid` = 4 and `player_id` = " .. playerid .. ";")
end
Bottomline is, can anyone help me either fix the first one, or make the second one work?
Longstory short: Gives skill, can't use spells to boost skill nor itens. If the player could logout when the skill is added (i believe it's via the db this happens).
Tfs 0.3.6 10.10
Sorry for the long post.
Last edited: