Having some trouble with a small script I am trying to write.
The basic idea of it is, if a high level kills a noob, he will lose the entire exp that the lower leveled player has gained.
Not sure why exactly it wont work
Hopefully you guys can help, thank you
I thought it would be rather simple, but it does not seem to be working at all right now
Any help is appreciated,
Thank you
Michael
The basic idea of it is, if a high level kills a noob, he will lose the entire exp that the lower leveled player has gained.
Not sure why exactly it wont work
Hopefully you guys can help, thank you
Code:
function onKill(cid, target, lastHit)
local killerLevel = getPlayerLevel(cid)
local victimLevel = getPlayerLevel(target)
local pkCalc = (10 - getPlayerFrags(cid))
if victimLevel < 80 and victimLevel < (0.5 * killerLevel) then
doPlayerAddExperience(cid, -(getPlayerExperience(target)))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a noob! You lost " .. getPlayerExperience(target) .. " EXP. You have " .. pkCalc .. " kills left till Red Skull.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Good kill. You have " .. pkCalc .. " kills left till Red Skull.")
return TRUE
end
end
I thought it would be rather simple, but it does not seem to be working at all right now
Any help is appreciated,
Thank you
Michael