hello, I've been looking and looking for a 0.2 + script that does that when I kill a player, I get 1 platinum coin in my bp, all scripts are getting bugged, so were going to do a post and see if someone could help me with a scripts, rep ++
function onKill(cid, target, lastHit)
local reward = {
item = 2152, --ITEM ID!
count = 1 -- How many?
}
if(isPlayer(cid) and isPlayer(target)) then
if getPlayerIp(cid) ~= getPlayerIp(target) then
doPlayerAddItem(cid, reward.item, reward.count)
else
doPlayerAddExperience(cid, -1000000)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
end
end
return TRUE
end
registerCreatureEvent(cid, "FragReward")
<event type="kill" name="FragReward" event="script" value="fragreward.lua"/>
Here it is:
Go to data/creaturescripts/scripts/fragreward.lua
LUA:function onKill(cid, target, lastHit) local reward = { item = 2152, --ITEM ID! count = 1 -- How many? } if(isPlayer(cid) and isPlayer(target)) then if getPlayerIp(cid) ~= getPlayerIp(target) then doPlayerAddItem(cid, reward.item, reward.count) else doPlayerAddExperience(cid, -1000000) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.") end end return TRUE end
Now data/creaturescripts/scripts/login.lua
Add this before "return true"
LUA:registerCreatureEvent(cid, "FragReward")
Let's finish this: Go to data/creaturescripts/creaturescripts.xml
LUA:<event type="kill" name="FragReward" event="script" value="fragreward.lua"/>
Tell me if you have problems.
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, 2152, 1)
end
end
end
return true
end