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

[Request] Gold to Killer

Blobe

New Member
Joined
Mar 26, 2008
Messages
7
Reaction score
0
Hello, I'm useing The Forgotten Server 0.3.5pl1 (Crying Damson).
I've been trying to get a script that when you kill someone, it gives you a gold coin. I've tried multiple codes that people have posted, and none will work. Dose anyone have a working script that they can share with me, or can anyone make one? Thanks in advance.
 
I made this real quick, in class ATM.

data/creaturescripts/scripts/login.lua
PHP:
registerCreatureEvent(cid, "profitKiller")

data/creaturescripts/creaturescripts.xml
PHP:
<event type="kill" name="profitKiller" event="script" script="money_kill.lua"/>

data/creaturescripts/scripts/money_kill.lua
Lua:
local money = 
{
    [2160] = {count = 100}
}

function onKill(cid, target, lastHit)
local playerSkull = getCreatureSkullType(cid)
    if isPlayer(target) == TRUE and playerSkull == SKULL_RED or playerSkull == SKULL_WHITE then
	doPlayerAddItem(cid, money[item.itemid], money[item.itemid].count)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." and have been rewarded ".. money[item.itemid].count .." crystal coins.")
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
    end
    return TRUE
end
 
data/creaturescripts/scripts/login.lua
PHP:
registerCreatureEvent(cid, "profitKiller")

data/creaturescripts/creaturescripts.xml
PHP:
<event type="kill" name="profitKiller" event="script" script="money_kill.lua"/>

data/creaturescripts/scripts/money_kill.lua
Lua:
local money = 
{
    [2160] = {count = 100}
}

function onKill(cid, target, lastHit)
local playerSkull = getCreatureSkullType(cid)
    if isPlayer(target) == TRUE and playerSkull == SKULL_RED or playerSkull == SKULL_WHITE then
	doPlayerAddItem(cid, money[item.itemid], money[item.itemid].count)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." and have been rewarded ".. money[item.itemid].count .." crystal coins.")
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
    end
    return TRUE
end

Wrong! Where's defined item??
 
When i try to run that, i get an error, Asserction failed, or something like that. I really need this script can anyone help me fast? Thanks
 
Lua:
local money =
{
	item = 2160,
	count = 5
}

function onKill(cid, target, lastHit)
local playerSkull = getCreatureSkullType(cid)
    if isPlayer(target) == TRUE and playerSkull == SKULL_RED or playerSkull == SKULL_WHITE then
        doPlayerAddItem(cid, money.item, money.count)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." and have been rewarded ".. money.count .." crystal coins.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
    end
    return TRUE
end
 
Last edited:
Ok, whenever i put this code in and try to run server this is what comes up.

Assertion failed!
Program: ...ci\Desktop\cryingdamson5-gui\Crying Damson.exe
File: ../luascript.h
Line: 265

Expression: m_scriptEvnIndex >=0 &&m scriptEvnIndex < 21
 
Its because u gotta change <event type="kill" name="profitKiller" event="script" script="money_kill.lua"/>

to
<event type="kill" name="profitKiller" event="script" Value="money_kill.lua"/>
 
Create A New File: creaturescripts\scripts\fragreward.lua

function onKill(cid, target)
if isPlayer(target) == TRUE then
if getPlayerIp(cid) ~= getPlayerIp(target) then
loot = 2160
item = doPlayerAddItem(cid,loot,5)
elseif getPlayerName(cid) == getPlayerName(target) then
doPlayerAddItem(cid,loot,1)
else
doPlayerAddExperience(cid, -100)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
end
end
return TRUE
end

Then Go To creaturescripts.xml and add :

<event type="kill" name="FragReward" event="script" value="fragreward.lua"/>

Its Tested With TFS

Regards,

// Zarby

Please Rep ++
 
Back
Top