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

TFS 1.X+ doPlayerSetLossPercent

Obito

0x1337
Joined
Feb 17, 2011
Messages
350
Solutions
8
Reaction score
145
Location
Egypt
Trying to convert this script to 1.x but I don't know how to call it since 1.x doesn't support this function
Code:
doPlayerSetLossPercent
can someone rewrite it or gives some hint info how to call it in 1.x?
Lua:
local storage = 45001
function onPrepareDeath(cid)
    local vocation = getPlayerVocation(cid)
    if vocation == 25 then
        if not isInArray({SKULL_RED, SKULL_BLACK}, getCreatureSkullType(cid)) then
            doCreatureSetSkullType(cid, SKULL_RED)
            setPlayerStorageValue(cid, storage, 1)
        end
        return true
    end
    if isInArray({1, 2,}, vocation) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 0)
        doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINERS, 0)
    end
    return true
end

Lua:
local storage = 45001
function onPrepareDeath(cid)
   local player = Player(cid)
   if not player then
    return false
end
   local vocation = player:getVocation():getId()
    if vocation == 25 then
    if not isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull()) then
        player:setSkull(SKULL_RED)
              player:setStorageValue(storage, 1)
           end
       return true
     end
      if isInArray({1, 3, 4}, vocation) then
      return true
         end
     end
Thanks in advance!
P.S The idea is that I need spectife vocations drop their loot with red skull when they die and the other vocations save their items from lossing.
Edit:-
when the character dies there's nothing happen no error in console or anything.
 
Last edited:
Solution
E
look how latest droploot.lua is done:


Lua:
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

just add a vocation check at the beginning of it and return true if you don't want to execute the rest of the script
I've removed the droploot from
Rich (BB code):
playerdeath.lua
and the exp loss from the source code still can't finish the script when the spectife vocation die that I called it
Code:
vocation == 25
nothing happen I don't take red skull.
 
Last edited:
look how latest droploot.lua is done:


Lua:
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

just add a vocation check at the beginning of it and return true if you don't want to execute the rest of the script
 
Last edited by a moderator:
Solution
look how latest droploot.lua is done:


Lua:
    if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end

just add a vocation check at the begging of it and return true if you don't want to execute the rest of the script
Thanks so much Evil 😘
 
Back
Top