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

Frags help

Maniucza

~Lua~ Noob
Joined
Aug 2, 2009
Messages
86
Reaction score
6
Location
Poland / Rzeszów
Helo, I need help with this script, the WAR ots if you kill a player does not get frags or items, or the message does not show up, please quick help

My Scripts:
Lua:
local fragConfig = 
{
	ip = getConfigInfo('fragLimitIP'),
	guid = getConfigInfo('fragLimitGUID'),
	account = getConfigInfo('fragLimitAccount')
}

STORAGE_LAST_KILLER_GUID = 10100
STORAGE_LAST_KILLER_GUID_TIMES = 10101
STORAGE_LAST_KILLER_IP = 10200
STORAGE_LAST_KILLER_IP_TIMES = 10201
STORAGE_LAST_KILLER_ACCOUNT = 10300
STORAGE_LAST_KILLER_ACCOUNT_TIMES = 10301

function Regeneration(Param)
	local Player = Param.cid
	doCreatureAddHealth(Player, getCreatureMaxHealth(Player))
	doPlayerAddMana(Player, getPlayerMaxMana(Player))
	return true
end

function onDeath(cid, corpse, deathList)

	doCreatureAddHealth(cid, getCreatureMaxHealth(cid))	
	doRemoveConditions(cid)
	
	local addFrag = true
	if(isPlayer(killer) == TRUE) then
		if getPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID) ~= getPlayerGUID(cid) then
			setPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID, getPlayerGUID(cid))
			setPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID_TIMES, 0)
		else
			return setPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID_TIMES, getPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID_TIMES) +1)
		end	
	
		if getPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP) ~= getPlayerIp(cid) then
			setPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP, getPlayerIp(cid))
			setPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP_TIMES, 0)
		else
			return setPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP_TIMES, getPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP_TIMES) +1)
		end
		
			if getPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT) ~= getPlayerAccountId(cid) then
				setPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT, getPlayerAccountId(cid))
				setPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT_TIMES, 0)
			else
				return setPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT_TIMES, getPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT_TIMES) +1)
			end
			
				if getPlayerIp(killer) == getPlayerIp(cid) then
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed player with same IP as yours. You will not gain frag. Multi-client?")
					addFrag = false
				elseif getPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID_TIMES) >= fragConfig.guid then
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed same player " .. getPlayerStorageValue(killer, STORAGE_LAST_KILLER_GUID_TIMES) .. " times. You will not gain frag. Friend give you frags?")
					addFrag = false
				elseif getPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP_TIMES) >= fragConfig.ip then
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed player with same IP " .. getPlayerStorageValue(killer, STORAGE_LAST_KILLER_IP_TIMES) .. " times. You will not gain frag. Friend give you frags?")
					addFrag = false
				elseif getPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT_TIMES) >= fragConfig.account then
					doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed player with same account number " .. getPlayerStorageValue(killer, STORAGE_LAST_KILLER_ACCOUNT_TIMES) .. " times. You will not gain frag. Friend give you frags?")
					addFrag = false
				end	
				
					if addFrag(killer) then			
						doPlayerAddSoul(killer, 1)
						doPlayerAddItem(killer, 2151, 1)
						doPlayerAddItem(killer, 5944, 1)
			
						setPlayerStorageValue(killer, 666, getPlayerStorageValue(killer, 666) +1)
						doBroadcastMessage(getCreatureName(killer) .. " (level " .. getPlayerLevel(killer) .. ") murdered " .. getCreatureName(cid) .. " (level " .. getPlayerLevel(cid) .. ")",MESSAGE_STATUS_DEFAULT) 
						doPlayerSendTextMessage(killer, MESSAGE_EVENT_ADVANCE, "You have " .. getPlayerStorageValue(killer, 666) .. " frags and you gained " .. getPlayerSoul(killer) .. " frags from login.")
						return true
					end
		
			if (isPlayer(killer) == TRUE) then
				if getPlayerSoul(killer) >= 10 and getPlayerSoul(killer) < 20 then
					return doCreatureSetSkullType(killer, SKULL_GREEN)
				elseif getPlayerSoul(killer) >= 20 and getPlayerSoul(killer) < 30 then
					return doCreatureSetSkullType(killer, SKULL_WHITE)
				elseif getPlayerSoul(killer) >= 30 and getPlayerSoul(killer) < 40 then
					return doCreatureSetSkullType(killer, SKULL_YELLOW)
				elseif getPlayerSoul(killer) >= 40 then
					return doCreatureSetSkullType(killer, SKULL_RED)
				end
			end
			
		local DB_addFrag = 0
		local DB_assist = 0
		local DB_assist_ip = 0
		if addFrag == true then
			DB_addFrag = 1
		end
		
		if isPlayer(mostDamageKiller) == TRUE then
			DB_assist = getPlayerGUID(mostDamageKiller)
			DB_assist_ip = getPlayerIp(mostDamageKiller)
			
		end
		db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `player_ip`, `killer`, `killer_level`, `killer_ip`, `killer_2`, `killer_2_level`, `killer_2_ip`, `add_frag`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. getPlayerIp(cid) .. ", " .. getPlayerGUID(killer) .. ", " .. getPlayerLevel(killer) .. ", " .. getPlayerIp(killer) .. ", " .. getPlayerGUID(mostDamageKiller) .. ", " .. getPlayerLevel(mostDamageKiller) .. ", " .. getPlayerIp(mostDamageKiller) .. ", " .. tonumber(DB_addFrag) .. ");")
	end
return true
end
 
Back
Top Bottom