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

When you kill a player you gain money

drosah

New Member
Joined
Aug 16, 2007
Messages
69
Reaction score
0
go to creature script, after go to playerdeath.lua and under function onDeath add:


HTML:
	count = math.random((getPlayerLevel(cid) - 75)*5, (getPlayerLevel(cid) - 75)*6)
	doPlayerAddMoney(killer, count)
	doPlayerSendTextMessage(killer, 22, "You gains"..count.." gold coins for"..getPlayerName(cid).."kill.")	
end


just simple when you kill a player you will wins money
according the level

you can edit the formula
HTML:
count = math.random((getPlayerLevel(cid) - 75)*5, (getPlayerLevel(cid) - 75)*6)

the sintax is ok, i belive, but doesn't works here

but they can try here and test ^^
 
Can you make so, if you kill him? You gain 100x gold hi's/shes lvl?

So if hi's lvl 100, you gain 10k :p

100x100
 
that's easy:
Code:
	count = getPlayerLevel(cid)*100
	doPlayerAddMoney(killer, count)
	doPlayerSendTextMessage(killer, 22, "You gained "..count.." gold coins for "..getPlayerName(cid).." kill.")	
end
 
Do not forgot to add a condition to see if the killer and the killed are a players, maybe can bring headaches.
 
Can you add something like, only recieve gold when killing players -10 - +10 lvls than yourself?
 
Can you explain how to do that then? I'd like to do that ;)

something like:
Code:
cid1pos = getPlayerPosition(cid)
cid1pos.stackpos = 1
cid1 = getThingfromPos(cid1pos)
count = getPlayerLevel(cid)
	doPlayerAddMoney(cid1.uid, count)
	doPlayerSendTextMessage(killer, 22, "You gained "..count.." gold coins for "..getPlayerName(cid).." kill.")	
end
 
something like:
Code:
cid1pos = getPlayerPosition(cid)
cid1pos.stackpos = 1
cid1 = getThingfromPos(cid1pos)
count = getPlayerLevel(cid)
	doPlayerAddMoney(cid1.uid, count)
	doPlayerSendTextMessage(killer, 22, "You gained "..count.." gold coins for "..getPlayerName(cid).." kill.")	
end

I don't see the purpose of that code?

Also, I think he wanted to remove money from the killer not vice-versa but I might be wrong :eek:
 
@Colandus, please read the whole thread before posting that im not doing as he asks. Its getting quite annoying.

FightingElf said if its possible to add the gold to the dead players body and i tried to do that but i dont think it will work :p

EDIT: ive just realised something, wouldnt it work just with this?
Code:
count = getPlayerLevel(cid)
	doPlayerAddMoney(cid, count)
	doPlayerSendTextMessage(killer, 22, "You gained "..count.." gold coins for "..getPlayerName(cid).." kill.")	
end
 
Rather not, you should read. Check #9 then #10, then #11 and at last yours.


Edit: I think I get it lol, but I thought he pointed at the "Sure just change blalbala~" xD

PHP:
	count = getPlayerLevel(killer)
	pos = getThingPos(cid)
	pos.stackpos=1
	body = getThingfromPos(pos)
	doAddItemContainer(body, itemid, count)
end

although, this won't work perfectly, since you can't use doPlayerAddMoney on a body, you'd need to make a function to calculate what money types etc to place there :p
 
Last edited:
someone can make if killer is higher lvl than the killed then dont execute the script

sorry for my bad english
 
Can someone help me with tfs 0.3.3?

Because i've a script that send a message to the killer "doPlayerSendTextMessage(killer, ..."

But now.. the parameters of onDeath was changed from "cid, corpse, killer" to "cid, corpse, lastHitKiller, mostDamageKiller"
 
@up

change doPlayerSendTextMessage(killer, 22, "TEXT")

to doPlayerSendTextMessage(mostDamageKiller, 22, "TEXT")
 
oks.. but if i try to set a storage value to the player it will give error :S! "Player not found"
 
Back
Top