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

PvP Exp with skull + Frag reward fix

Pnurt

New Member
Joined
Apr 22, 2009
Messages
205
Reaction score
0
So i saw this war script rewarding exp when killed + 1 platinum coin, sadly it was for 0.2 and i want to use it on 0.3.6/0.4. So could someone help me convert it?
Here it is:
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])

+ another script that gives error then makes the server crash. this is also a 0.2 script

PHP:
function onLogin(cid)

	registerCreatureEvent(cid, "Advanced")
	registerCreatureEvent(cid, "Broadcast")
	registerCreatureEvent(cid, "FirstItems")
	registerCreatureEvent(cid, "KillReward")
	registerCreatureEvent(cid, "LevelUp")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "Reward")
	
	---- Player exp
	if getPlayerVocation(cid) > 0 then -- As long as you are not "no vocation/AKA account manager
		while getPlayerLevel(cid) < 60 do
			 doPlayerAddExp(cid, 125000)
		end

		---- Vocation skills
		-- Sorcerers and Druids
		if getPlayerVocation(cid) <= 2 then
			-- magic level
			while getPlayerMagLevel(cid) < 40 do
				doPlayerAddManaSpent(cid, 1)
			end
			-- shielding
			while getPlayerSkill(cid, 5) < 20 do
				doPlayerAddSkillTry(cid, 5, 1)
			end

		-- Paladin
		elseif getPlayerVocation(cid) == 3 then
			-- magic level
			while getPlayerMagLevel(cid) < 13 do
				doPlayerAddManaSpent(cid, 1)
			end
			-- distance
			while getPlayerSkill(cid, 4) < 50 do
				doPlayerAddSkillTry(cid, 4, 1)
			end
			-- shielding
			while getPlayerSkill(cid, 5) < 40 do
				doPlayerAddSkillTry(cid, 5, 1)
			end

		-- Knight
		elseif getPlayerVocation(cid) == 4 then
			-- magic level
			while getPlayerMagLevel(cid) < 5 do
				doPlayerAddManaSpent(cid, 1)
			end
			-- club
			while getPlayerSkill(cid, 1) < 65 do
				doPlayerAddSkillTry(cid, 1, 1)
			end
			-- sword
			while getPlayerSkill(cid, 2) < 65 do
				doPlayerAddSkillTry(cid, 2, 1)
			end
			-- axe
			while getPlayerSkill(cid, 3) < 65 do
				doPlayerAddSkillTry(cid, 3, 1)
			end
			-- shielding
			while getPlayerSkill(cid, 5) < 65 do
				doPlayerAddSkillTry(cid, 5, 1)
			end
		end
	end
	return TRUE
end


Would be really nice if someone could help me with this!

Thanks!
 
what are the error's in the console?

These are the errors i get when i log into a character for the first time.
PHP:
[20/4/2012 19:4:45] [Error - CreatureScript Interface] 
[20/4/2012 19:4:45] data/creaturescripts/scripts/login.lua:onLogin
[20/4/2012 19:4:45] Description: 
[20/4/2012 19:4:45] data/creaturescripts/scripts/login.lua:22: attempt to call global 'doPlayerAddManaSpent' (a nil value)
[20/4/2012 19:4:45] stack traceback:
[20/4/2012 19:4:46] 	data/creaturescripts/scripts/login.lua:22: in function <data/creaturescripts/scripts/login.lua:1>
 
Back
Top