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

Solved Trohpy System

imback1

Unknown member
Joined
Jul 11, 2013
Messages
785
Solutions
1
Reaction score
46
Hello

i wants a scripts of trophy on humans i mean when someone kill another one ,find a throphy on his human and when i look on it i find my name/level and his name/level and data too if is it possible
 
On data/creaturescripts/scripts/fragreward.lua

Change Loot ID (XXXX) Crystal Coin > 2160.
PHP:
function onDeath(cid, corpse, deathList)
if isPlayer(deathList[1]) then
local item = doAddContainerItem(corpse.uid, 5943, 1)
doItemSetAttribute(item, "description", "This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..getPlayerName(deathList[1])..".")
doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
doSendMagicEffect(getPlayerPosition(deathList[1]), CONST_ME_MAGIC_BLUE)
end
return true
end

creaturescript/login.lua

PHP:
 registerCreatureEvent(cid, "Reward")

Creaturescripts/creaturescripts.xml

PHP:
<event type="death" name="Reward" event="script" value="reward.lua"/>
 
Last edited:
On data/creaturescripts/scripts/fragreward.lua

Change DoPlayerAdditem (XXXX) Crystal Coin > 2160.
PHP:
function onKill(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
if getPlayerIp(cid) == getPlayerIp(target) then
doPlayerAddExperience(cid, -1000000)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
else
local attackerLevel, level = getPlayerLevel(cid), getPlayerLevel(target)
if level >= math.floor(attackerLevel * 0.5) and level <= math.floor(attackerLevel * 1.5) then
doPlayerAddItem(cid, 2160, 1)
end
end
end
return true
end

creaturescript/login.lua
Lua:
[php]registerCreatureEvent(cid, "FragReward")[/php]

[I]Creaturescripts/[B]c[/B]reaturescripts.xml[/I]

[php] <event type="kill" name="FragReward" event="script" value="fragreward.lua"/>[/php][/QUOTE]
did you understand what i need? lol i need to find something on human of died one btw i made this script and nothing when i kill another char >.<
 
If youre using 3.0.6 my script should work, so check if you've added this.

Data/Creaturescript/Creaturescript.xml
<event type="death" name="Reward" event="script" value="reward.lua"/>

Data/Creaturescript/login.lua
registerCreatureEvent(cid, "Reward")
 
Last edited:
Post your server version.
Code:
function onDeath(cid, corpse, deathList)
The third parameter in TFS 0.3.6 is a deathlist table, to get the killer use
Code:
deathList[1]
Or lastHitKiller[1] if you call it like that.
 
If youre using 3.0.6 my script should work, so check if you've added this.

Data/Creaturescript/Creaturescript.xml
<event type="death" name="Reward" script="reward.lua"/>

Data/Creaturescript/login.lua
registerCreatureEvent(cid, "Reward")
sorry but i made all what you said and still nothing

Post your server version.
Code:
function onDeath(cid, corpse, deathList)
The third parameter in TFS 0.3.6 is a deathlist table, to get the killer use
Code:
deathList[1]
Or lastHitKiller[1] if you call it like that.
0.3.6
 
I know because I saw that in other threads but other people don't, you have to add that in every new thread you make.

The third parameter in function onDeath in TFS 0.3.6 is a table with the killers, to get the killer use [1] behind it to get the first value in the table which is the creatureid of the killer.
Code:
function onDeath(cid, corpse, deathList)
The third parameter in TFS 0.3.6 is a deathlist table, to get the killer use
Code:
deathList[1]
Or lastHitKiller[1] if you call it like that.

In creaturescripts.xml you have to use event and value.
Code:
<event type="death" name="Reward" event="script" value="reward.lua"/>
 
I know because I saw that in other threads but other people don't, you have to add that in every new thread you make.

The third parameter in function onDeath in TFS 0.3.6 is a table with the killers, to get the killer use [1] behind it to get the first value in the table which is the creatureid of the killer.


In creaturescripts.xml you have to use event and value.
Code:
<event type="death" name="Reward" event="script" value="reward.lua"/>
aff sorry i can't do it that's what i did and still nothing -.- please edit it and give me it cuz im not good at scripting just edit it and give me it please
 
Show the script how you edited it. It doesn't matter if you're not good at it, you will only learn if you try and then you can do more things yourself.
 
thats what i made

function onDeath(cid, corpse, deathList)local cidpos = getPlayerPosition(lastHitKiller[1])loot = 5943
item = doPlayerAddItem(lastHitKiller,loot,1)
if(isPlayer(lastHitKiller[1]) == TRUE) then
hitKillerName = getPlayerName(lastHitKiller)doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")doSendMagicEffect(cidpos,12)
elsehitKillerName = getCreatureName(lastHitKiller)doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")end
setItemName(item, ""..getPlayerName(cid).."\'s Heart")
return TRUE
end
 
Change lastHitKiller[1] and lastHitKiller to deathList[1]
i gave up !! affi dont need it -.-!!!!!

Change lastHitKiller[1] and lastHitKiller to deathList[1]
function onDeath(cid, corpse, deathList[1], mostDamageKiller)local cidpos = getPlayerPosition(deathList[1])loot = 5943
item = doPlayerAddItem(deathList[1],loot,1)
if(isPlayer(deathList[1]) == TRUE) then
hitKillerName = getPlayerName(deathList[1])doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")doSendMagicEffect(cidpos,12)
elsehitKillerName = getCreatureName(deathList[1])doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")end
setItemName(item, ""..getPlayerName(cid).."\'s Heart")
return TRUE
end

i changed lasthitkiller to deathlist[1] as you said and still nothing
 
Last edited by a moderator:
Code:
function onDeath(cid, corpse, deathList)
     if isPlayer(deathList[1]) then
         local item = doAddContainerItem(corpse.uid, 5943, 1)
         doItemSetAttribute(item, "description", "This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..getPlayerName(deathList[1])..".")
         doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
         doSendMagicEffect(getPlayerPosition(deathList[1]), CONST_ME_MAGIC_BLUE)
     end
     return true
end
 
[03/12/2014 01:20:31] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/reward.lua:1: ')' expected near '['
[03/12/2014 01:20:32] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/reward.lua)
[03/12/2014 01:20:32] data/creaturescripts/scripts/reward.lua:1: ')' expected near '['

Code:
function onDeath(cid, corpse, deathList)
     if isPlayer(deathList[1]) then
         local item = doAddContainerItem(corpse.uid, 5943, 1)
         doItemSetAttribute(item, "description", "This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..getPlayerName(deathList[1])..".")
         doPlayerSendTextMessage(deathList[1], MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
         doSendMagicEffect(getPlayerPosition(deathList[1]), CONST_ME_MAGIC_BLUE)
     end
     return true
end
i'm very sorry but still not working
 
Last edited by a moderator:
Back
Top