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

Frag reward in a special area

Tarielle

New Member
Joined
Nov 4, 2007
Messages
214
Reaction score
0
Location
Sweden
Hi how can I add that you only get a frag reward if you are in a special area with the code:

PHP:
function onPrepareDeath(cid, killer)
loot = xxxx
doPlayerAddItem(killer,loot,1)

end
 
PHP:
function isInArea(pos, fromPos, toPos) 
    if pos.x >= fromPos.x and pos.x <= toPos.x then 
        if pos.y >= fromPos.y and pos.y <= toPos.y then 
            if pos.z >= fromPos.z and pos.z <= toPos.z then 
                return true 
            end 
        end 
    end 
    return false 
end

PHP:
local deathReward = xxxx 
local fromPos = {x=x, y=y, z=z}
local toPos = {x=x, y=y, z=z}

function onPrepareDeath(cid, killer)  
    if isInArea(getPlayerPosition(cid), fromPos, toPos) then
        doPlayerAddItem(killer, deathReward, 1) 
    end
    return TRUE
end
 
Just a hint, it would be smart to use:
PHP:
if isPlayer(killer) == TRUE then
Otherwise you get some errors on console when a player is killed by a monster.
 
Back
Top