yes, add to login.luai tried this and work it
now i need one to not gain more skills in these vocations haaha can u help me?Lua:local vocationIDS = {13, 14, 15, 16} function onDeath(cid, corpse, deathList) if isInArray(vocationIDS, getPlayerVocation(cid)) then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 0) end return true end
local vocationIDS = {13, 14, 15, 16}
if isInArray(vocationIDS, getPlayerVocation(cid)) then
doPlayerSetRate(cid, SKILL_FIST, 0)
doPlayerSetRate(cid, SKILL_CLUB, 0)
doPlayerSetRate(cid, SKILL_SWORD, 0)
doPlayerSetRate(cid, SKILL_AXE, 0)
doPlayerSetRate(cid, SKILL_DISTANCE, 0)
doPlayerSetRate(cid...
data\creaturescripts\scripts
and name it whatever you want then add this to it and change yourvocationid
to the id of your vocation.function onDeath(cid, corpse, deathList)
if getPlayerVocation(cid) == yourvocationid then
doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0)
end
return true
end
data\creaturescripts\creaturescripts.xml
like this and change Yourscriptname
to your Lua script name.<event type="death" name="PreventSkillloss" event="script" value="Yourscriptname.lua"/>
data\creaturescripts\scripts\login.lua
like thisregisterCreatureEvent(cid, "PreventSkillloss")
Just create a Lua script heredata\creaturescripts\scripts
and name it whatever you want then add this to it and changeyourvocationid
to the id of your vocation.
then register it hereLua:function onDeath(cid, corpse, deathList) if getPlayerVocation(cid) == yourvocationid then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0) end return true end
data\creaturescripts\creaturescripts.xml
like this and changeYourscriptname
to your Lua script name.
then add it hereXML:<event type="death" name="PreventSkillloss" event="script" value="Yourscriptname.lua"/>
data\creaturescripts\scripts\login.lua
like this
Lua:registerCreatureEvent(cid, "PreventSkillloss")
UPDATE `players` SET `loss_skills` = 0 WHERE 'vocation' = 'vocation_id_here';
Just create a Lua script heredata\creaturescripts\scripts
and name it whatever you want then add this to it and changeyourvocationid
to the id of your vocation.
then register it hereLua:function onDeath(cid, corpse, deathList) if getPlayerVocation(cid) == yourvocationid then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0) end return true end
data\creaturescripts\creaturescripts.xml
like this and changeYourscriptname
to your Lua script name.
then add it hereXML:<event type="death" name="PreventSkillloss" event="script" value="Yourscriptname.lua"/>
data\creaturescripts\scripts\login.lua
like this
Lua:registerCreatureEvent(cid, "PreventSkillloss")
no, sorry for not specifying, whenever I login with the character, this appears, he is already "dead" with life at 0 and mana tooI can't understand what you mean with this screenshot? He died so OFC he'll have 0 health/mana
im using the lua script.... the SQL query I tested and it didn't work, the character with the vocation continued to lose his skills ...You are using Lua script or SQL query one? Does it happen only to the vocations you added on script? or every vocation?
did not workremove thereturn true
and retry, If it didn't work post here how your final script looks like.
function onDeath(cid, corpse, deathList)
if getPlayerVocation(cid) >= 13 and getPlayerVocation(cid) <= 16 then
doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0)
end
end
try using an onPrepareDeath insteaddid not work
Lua:function onDeath(cid, corpse, deathList) if getPlayerVocation(cid) >= 13 and getPlayerVocation(cid) <= 16 then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0) end end
local vocationIDS = {5, 6, 7}
function onPrepareDeath(cid, deathList)
if isInArray(vocationIDS, getPlayerVocation(cid)) then
doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0)
end
return true
end
if isInArray({5, 6, 7}, getPlayerVocation(cid)) then
doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0)
doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0)
end
try using an onPrepareDeath instead
Lua:local vocationIDS = {5, 6, 7} function onPrepareDeath(cid, deathList) if isInArray(vocationIDS, getPlayerVocation(cid)) then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0) end return true end
btw there is really no need to add all this, you could just add the following to your onLogin script and it should work:
Lua:if isInArray({5, 6, 7}, getPlayerVocation(cid)) then doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 0) doPlayerSetLossPercent(cid, PLAYERLOSS_MAGIC, 0) end
no errors on the console, and it didn't work just switching on onloginany errors in console? and what about the change only on onLogin?
oh I found a new function (new to me since I don't use 0.4 xD)
just add this on login and should work:
Lua:if isInArray({5, 6, 7}, getPlayerVocation(cid)) then doPlayerSetLossSkill(cid, false) end