• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Frag problem

ameer

New Member
Joined
Dec 31, 2010
Messages
83
Reaction score
0
Hello !

I got a cool script i liked but dont where to put it..
Can someone show me please :)

heres the script.

PHP:
function onDeath(cid, corpse, killer)
local totalFragStorage = 30001 -- storage value to count total frags
local currentFragStorage = 30002 -- storage value to count current frags

if isPlayer(killer) and isPlayer(cid) then

-- level check
lvl = getPlayerLevel(cid) -- level on player who dies

-- plats = platinum coins you get in this level range
if lvl > 59 and lvl < 64 then
plats = 1
elseif lvl >= 65 and lvl < 79 then
plats = 2
elseif lvl >= 80 and lvl < 99 then
plats = 3
elseif lvl >= 100 and lvl < 149 then
plats = 4
elseif lvl >= 150 and lvl < 199 then
plats = 5
elseif lvl >= 200 then
plats = 10
else
plats = 1
end


if getPlayerIp(cid) == getPlayerIp(killer) then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE, "You killed your friend! No reward for you!")
else
doPlayerAddExp(killer, 200000)
doPlayerAddItem(killer, 2152, plats)
-- Give frag point to killer
setPlayerStorageValue(killer, totalFragStorage, (getPlayerStorageValue(killer, totalFragStorage) + 1))
setPlayerStorageValue(killer, currentFragStorage, (getPlayerStorageValue(killer, currentFragStorage) + 1))
if getPlayerStorageValue(killer, totalFragStorage) < 1 and getPlayerStorageValue(killer, currentFragStorage) < 1 then -- Incase its their first frag, default is -1 so it needs an additional point to sum up.
setPlayerStorageValue(killer, totalFragStorage, (getPlayerStorageValue(killer, totalFragStorage) + 1))
setPlayerStorageValue(killer, currentFragStorage, (getPlayerStorageValue(killer, currentFragStorage) + 1))
end

-- If you die, reset your "online fragcount"ish
setPlayerStorageValue(cid, currentFragStorage, 0)

-- Frag announcer
if getPlayerStorageValue(killer, currentFragStorage) == 1 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"First Blood! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "First Blood!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 2 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Double Kill!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Double Kill!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 3 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Triple Kill!!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Triple Kill!!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 4 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MULTI KILL! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MULTI KILL!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 5 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"ULTRA KILL!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "ULTRA KILL!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 5 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MONSTER KILL!!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MONSTER KILL!!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 7 and getPlayerStorageValue(killer, currentFragStorage) < 9 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Another One...! INSANE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Another One...! INSANE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 10 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"UNSTOPABLE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "UNSTOPABLE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 11 and getPlayerStorageValue(killer, currentFragStorage) < 19 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MWUAHAHA! OWNAGE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MWUAHAHA! OWNAGE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 20 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"GODLIKE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "GODLIKE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 21 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"You are the chosen one. "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Im the chosen one!", TALKTYPE_ORANGE_1)
end


-- Broadcast
if getPlayerStorageValue(killer, currentFragStorage) == 10 then
broadcastMessage(getCreatureName(killer).." is UNSTOPABLE!!")
elseif getPlayerStorageValue(killer, currentFragStorage) == 20 then
broadcastMessage(getCreatureName(killer).." is GODLIKE!!")
end

end
end
return true
end

-- function onDeath(cid, corpse, deathList)
-- local cidpos = getPlayerPosition(deathList[1])
PHP:
 
creaturescripts/scripts/fragrewards.lua
LUA:
function onDeath(cid, corpse, killer)
local totalFragStorage = 30001 -- storage value to count total frags
local currentFragStorage = 30002 -- storage value to count current frags

if isPlayer(killer) and isPlayer(cid) then

-- level check
lvl = getPlayerLevel(cid) -- level on player who dies

-- plats = platinum coins you get in this level range
if lvl > 59 and lvl < 64 then
plats = 1
elseif lvl >= 65 and lvl < 79 then
plats = 2
elseif lvl >= 80 and lvl < 99 then
plats = 3
elseif lvl >= 100 and lvl < 149 then
plats = 4
elseif lvl >= 150 and lvl < 199 then
plats = 5
elseif lvl >= 200 then
plats = 10
else
plats = 1
end


if getPlayerIp(cid) == getPlayerIp(killer) then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE, "You killed your friend! No reward for you!")
else
doPlayerAddExp(killer, 200000)
doPlayerAddItem(killer, 2152, plats)
-- Give frag point to killer
setPlayerStorageValue(killer, totalFragStorage, (getPlayerStorageValue(killer, totalFragStorage) + 1))
setPlayerStorageValue(killer, currentFragStorage, (getPlayerStorageValue(killer, currentFragStorage) + 1))
if getPlayerStorageValue(killer, totalFragStorage) < 1 and getPlayerStorageValue(killer, currentFragStorage) < 1 then -- Incase its their first frag, default is -1 so it needs an additional point to sum up.
setPlayerStorageValue(killer, totalFragStorage, (getPlayerStorageValue(killer, totalFragStorage) + 1))
setPlayerStorageValue(killer, currentFragStorage, (getPlayerStorageValue(killer, currentFragStorage) + 1))
end

-- If you die, reset your "online fragcount"ish
setPlayerStorageValue(cid, currentFragStorage, 0)

-- Frag announcer
if getPlayerStorageValue(killer, currentFragStorage) == 1 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"First Blood! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "First Blood!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 2 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Double Kill!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Double Kill!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 3 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Triple Kill!!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Triple Kill!!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 4 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MULTI KILL! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MULTI KILL!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 5 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"ULTRA KILL!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "ULTRA KILL!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 5 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MONSTER KILL!!! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MONSTER KILL!!!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 7 and getPlayerStorageValue(killer, currentFragStorage) < 9 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"Another One...! INSANE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Another One...! INSANE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 10 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"UNSTOPABLE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "UNSTOPABLE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 11 and getPlayerStorageValue(killer, currentFragStorage) < 19 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"MWUAHAHA! OWNAGE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "MWUAHAHA! OWNAGE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) == 20 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"GODLIKE! "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "GODLIKE!", TALKTYPE_ORANGE_1)
elseif getPlayerStorageValue(killer, currentFragStorage) >= 21 then
doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_BLUE,"You are the chosen one. "..getPlayerStorageValue(killer, currentFragStorage).." frags!")
doCreatureSay(killer, "Im the chosen one!", TALKTYPE_ORANGE_1)
end


-- Broadcast
if getPlayerStorageValue(killer, currentFragStorage) == 10 then
broadcastMessage(getCreatureName(killer).." is UNSTOPABLE!!")
elseif getPlayerStorageValue(killer, currentFragStorage) == 20 then
broadcastMessage(getCreatureName(killer).." is GODLIKE!!")
end

end
end
return true
end

-- function onDeath(cid, corpse, deathList)
-- local cidpos = getPlayerPosition(deathList[1])

data/creaturescripts.xml
XML:
	<event type="death" name="FragRewards" event="script" value="fragrewards.lua"/>

data/creaturescripts/scripts/login.lua (on the bottom, you will see things like this, put there.
LUA:
	registerCreatureEvent(cid, "FragRewards")
 
Thank you !
But the problem is that its not working on tfs 0.3.6 i think becouse it says it cant load and no such file or directory ......

could u maybe fix it ^^
 
Back
Top