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

my 2 creaturescripts error please help

magdy capone

Tibia-Egypt.com
Joined
Jan 12, 2014
Messages
34
Reaction score
0
My Friend Give Me 2 Script But Have Problem:(
my tfs : 0.4

script 1 :-
{lua}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) = return true
end
getPlayerSkullType(cid) >= 4
thendoCreatureSetDropLoot(cid, false)
return true
end{/lua}

script 2 :-
{lua}
local level = 1200 -- level

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) = return true
end
if getPlayerLevel(cid) <= level then
doPlayerSetLossPercent(cid, experience, 0)
return true
end{/lua}

info script 1 : i need player can't lose any loot when die if he have red skull and black skull and if he dont have any skull can't lose item's but i can't need player do !bless and !aol to can't lose items's my mined i can't need player lose any item's without bless and aol

info script 2 : i need player can't lose any level without bless and aol only when get level 1200 or higher lose 1 level

this is my error in server :-
p7bKuHVn.png


sorry for my english but please help me :)
 
You can try these:
Code:
-- script 1
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

if isPlayer(cid) then
return true
end

if getPlayerSkullType(cid) >= 4 then
doCreatureSetDropLoot(cid, false)
end

return true
end

-- script 2
local level = 1200 -- level
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) then
return true
end

if getPlayerLevel(cid) <= level then
doPlayerSetLossPercent(cid, experience, 0)
end

return true
end
 
Code:
if isPlayer(cid) then
    return true
end
This means it stops the script if the creature who dies is a player and will ignore everything under it (so the script won't do anything since it's ment for players).
If the script is registered in login.lua, it will only work for players, so checking if cid is a player won't be needed.
If experience is not defined somewhere, change it to this.
Code:
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
 
Thank's :) script 2 is working but when get level 1200 or higher can't lose any level i need when get 1200 level or higher lose 1 level
my script 2 : {lua}
local level = 1200 -- level
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

if getPlayerLevel(cid) <= level then
doPlayerSetLossPercent(cid, experience, 0)
end

return true
end{/lua}

script 1 : can't working i can't have any proplem in server but i lose item's when die i need script when die can't lose any item's and if i have blackskull or red skull can't lose any item's please help :):)
 
Change doPlayerSetLossPercent(cid, experience, 0) to doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0).

What is the first script supposed to do?
 
Working Thank's :)
this is my first script :
{lua}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)

if isPlayer(cid) then
return true
end

if getPlayerSkullType(cid) >= 4 then
doCreatureSetDropLoot(cid, false)
end

return true
end
{/lua}
i need player can't lose item's if have skull or can't have skull can't lose any item's Thank's
 
Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    doCreatureSetDropLoot(cid, false)
    return true
end
 
Nice It's Very Good Script
but script dont lose level only in 1200 level or higher when get level 1200 dont lose 1 level ??
my script is :
local level = 1200 -- level
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

if getPlayerLevel(cid) <= level then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
end

return true
end
 
I don't understand what you mean, but remove doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0), since there is no reason to have this 2x like this.
Also use code tags.
[ code]
your scripts
[/code]
 
i mean i need this script. i want when players die before level 1200 dont lose levels and when they get 1200+ they lose only 1 level:):):)
 
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

if getPlayerLevel(cid) <= level then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)​
end
return true​
end

~~
Remove the part that I made red.
 
Back
Top