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

How to redirecting damge

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,638
Solutions
35
Reaction score
352
i'm working in spell for knight.
this spell help knight to protection other players for 4 seconds but i want when knight protection players the damge redirecting to knight.

part for protection other player is {done}

I want help in redirecting damge to knight

I'm use 0.4
 
Last edited:
I don't this request turned into who isn't lying about their big dick. Stop posting if its not his request.
 
You can try this out.

Spell
Code:
local storage = 48503
local time = 5 -- seconds


function onCastSpell(cid, var)
party = getPlayerParty(cid)
    for i = 1, #party do
        if getPlayerStorageValue(party[i], storage) <= 0 and getPlayerGUID(party[i]) ~= getPlayerGUID(cid) then
            setPlayerStorageValue(party[i], storage, getPlayerGUID(cid))
            doPlayerSendTextMessage(party[i], MESSAGE_STATUS_CONSOLE_BLUE, "You are now being protected by "..getPlayerName(cid)..".")
        end
    end
   
    addEvent(removeStorages, time * 1000, cid)
     return true
end

function removeStorages(cid)
    party = getPlayerParty(cid)
        for i = 1, #party do
            if getPlayerStorageValue(party[i], storage) > 0 and getPlayerGUID(party[i]) ~= getPlayerGUID(cid) then
                setPlayerStorageValue(party[i], storage, 0)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are no longer being protected.")
            end
        end
end


stats change
Code:
local storage = 48503

function onStatsChange(cid, attacker, type, combat, value)
    if type == STATSCHANGE_HEALTHLOSS then
        if getPlayerStorageValue(cid, storage) > 0 then
            party = getPlayerParty(cid)
                for i = 1, #party do
                    if getPlayerStorageValue(cid, storage) == getPlayerGUID(party[i]) then
                        doPlayerAddHealth(party[i], value)
                        return false
                    end
                end
        end
    end
return true
end


put this in your login.lua
Code:
setPlayerStorageValue(cid, 48503, 0)
 
Well, I obviously didnt see you want it for a single person to person. I can make something like that for you too if you ask.
 
Don't help this ungrateful bastard.
Well you see, unlike most the people who are on this forum, for a useless reason, I am here to help people when its needed. I don't blame him for acting the way he is as he asked for a simple request and all I see is non-helpful banter. Which is what I am doing right now unfortunately but, its here already so what the hay. I wouldn't ever let someones aggression on a forum change my mood. So whether he is calling me an asshole or he is kissing it, I am still going to help because THAT'S WHY I TYPE OTLAND.NET into my browser and there is no other reason.

The only people I don't help are ones that don't speak English well enough for me to help them.

Heba if you do still need/want help with this send me a PM. This thread wont be closed because I don't think the admin really care that much. Maybe 6 or so years ago they did.
 
This thread wont be closed because I don't think the admin really care that much.
image.jpg
 
Back
Top