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

PLAYER LOSS EXPERIENCE

Prince Mego

New Member
Joined
Feb 11, 2016
Messages
20
Reaction score
1
Hello. ^_^
i have a problem with my PLAYER LOSS EXPERIENCE
i use tfs 0.4 version 8.60
when the players die from monster or pvp lose much exp 3 or 4 level
and i use this code in my login.lua

Code:
function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

but when i try to edit
Code:
PLAYERLOSS_EXPERIENCE, loss * 10
player back to level 1
and my player table in php `loss_EXPERIENCE` = '100'
and my bless.lua talkaction is

Code:
-- [(  Script edited by: DoidinMapper )] --
function onSay(cid, words, param)
if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
doPlayerSendCancel(cid,'You have already got one or more blessings!')
else
if doPlayerRemoveMoney(cid, 50000) == TRUE then
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doSendMagicEffect(getPlayerPosition(cid), 28)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE, 'You have been blessed by the gods!')
else
doPlayerSendCancel(cid, "You need 5cc to get blessed!")
end
end
return TRUE
end

and i need when the player die lose Very few of experience max 1 level
and i can compiler just i need how to edit it
sorry for my english and thank's :) :)
 
Open ur config and Ctrl +F this (deathLostPercent = 10) thats 10% of the total exprience the account have /Im not sure tho ;P
 
  1. function onLogin(cid)
  2. local loss = getConfigValue('deathLostPercent')
  3. if(loss ~= nil) then
  4. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
  5. end
i edit this code (cid, PLAYERLOSS_EXPERIENCE, loss * 10)
and i edit in config : deathLostPercent = 10
and when i edit number 10 Get Player back to level 1 when die
Sorry For My English
 
  1. function onLogin(cid)
  2. local loss = getConfigValue('deathLostPercent')
  3. if(loss ~= nil) then
  4. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
  5. end
i edit this code (cid, PLAYERLOSS_EXPERIENCE, loss * 10)
and i edit in config : deathLostPercent = 10
and when i edit number 10 Get Player back to level 1 when die
Sorry For My English
because it's loss * 10
when you put deathLostPercent = 10 in config "loss" in your login.lua is 10 right?
so 10 * 10 = 100
so the player loses 100% of their exp when they die
remove the * 10 and see if that helps
 
because it's loss * 10
when you put deathLostPercent = 10 in config "loss" in your login.lua is 10 right?
so 10 * 10 = 100
so the player loses 100% of their exp when they die
remove the * 10 and see if that helps

you mean script will be like that
  1. function onLogin(cid)
  2. local loss = getConfigValue('deathLostPercent')
  3. if(loss ~= nil) then
  4. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss)
  5. end
OR What ??
 
you mean script will be like that
  1. function onLogin(cid)
  2. local loss = getConfigValue('deathLostPercent')
  3. if(loss ~= nil) then
  4. doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss)
  5. end
OR What ??
yes
before asking if you're right, try it first :)
 
yes
before asking if you're right, try it first :)

the problem was not solved With this edit but thank's Xeraphus and God Nixez for help

The problem has been resolved in another way
i edit the login.lua
from :

Code:
function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

to :

Code:
local edit = 2 -- lose precent
function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil and not getPlayerPromotionLevel(cid) ~= 1) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 5)
    else
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * edit)
    end

and update all player sql :

PHP:
UPDATE `players` SET `loss_experience` = 100;
UPDATE `players` SET `loss_mana` = 100;
UPDATE `players` SET `loss_skills` = 100;
UPDATE `players` SET `loss_containers` = 100;
UPDATE `players` SET `loss_items` = 100;

and chnage bless.lua talkaction to :

Code:
function onSay(cid, words, param)
    if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
        doPlayerSendCancel(cid,'You have already got one or more blessings!')
    else
        if doPlayerRemoveMoney(cid, 50000) == TRUE then
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
        else
            doPlayerSendCancel(cid, "You need 50k to get blessed!")
        end
    end   
    return 1
end

and its works :):););)
 
Back
Top