Mister Budex
BudexOT.com
- Joined
- Jun 22, 2016
- Messages
- 1,547
- Solutions
- 18
- Reaction score
- 378
Hello, can someone give script to me to works like this, When i kill player i want to get 5 platinum coins
thanks
thanks
mmm, I think onKill only works for the person who last hit the target.yeah was about to post this, i sadly don't remember the old main function arguments, thought onDeath would work (wanted it to only give it to the actual killer, not all players that did damage with onKill)
uint32_t flags = 0;
if(entry.isLast())
flags |= 1;
if(entry.isJustify())
flags |= 2;
if(entry.isUnjustified())
flags |= 4;
function onKill(cid, target, damage, flags)
if bit.band(flags, 1) == 1 then...
function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
if killer:getPlayer() then
killer:getPlayer():addItem(coinID,5, false)
end
[...]
dont even have playerdeath.lua should i create and copy/paste that code?playerdeath.lua
Code:function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) if killer:getPlayer() then killer:getPlayer():addItem(coinID,5, false) end [...]
Maybe stupid question , but where to put it?Code:function onDeath(cid, corpse, killer, mostDamageKiller) if isPlayer(cid) and isPlayer(killer) then doPlayerAddItem(killer, plat coin id, 5) end return true end
<event type="death" name="goldkill" event="script" value="scriptname.lua"/>
are you sure you registered it correctly in login.lua?okey i putted changed id no erros in console but not works.
[01/02/2017 18:33:51] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/reward.lua:4: ')' expected near 'coin'
[01/02/2017 18:33:51] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/reward.lua)
[01/02/2017 18:33:51] data/creaturescripts/scripts/reward.lua:4: ')' expected near 'coin'
okey i putted changed id no erros in console but not works.
Yes, I Amare you sure you registered it correctly in login.lua?
try puttingYes, I Am
print(1)
function onDeath(cid, corpse, killer, mostDamageKiller)
try what i recommended in the last posthttp://prntscr.com/e3aixs
http://prntscr.com/e3ajdh
http://prntscr.com/e3ajnt
here you go, all of these
print(cid, corpse, killer, mostDamageKiller)
did you reload creaturescripts, and relog your character?http://prntscr.com/e3anvv
still not on that print (1)
and where to put
print(cid, corpse, killer, mostDamageKiller)
I dont know what u means to say, in items is same id like in tibia if u means on thatfind "plat coin id" in the script, and change it to the numerical number assigned to "platinum coin" in your server.
function onKill(cid, target, damage, flags)
if isPlayer(cid) and isPlayer(target) then
doPlayerAddItem(cid, 2152, 5)
end
return true
end