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

Solved Add one script to another.

richux

Tibera.org
Joined
Aug 18, 2008
Messages
3,666
Reaction score
26
Location
---------
Hello! So today Im trying to set up bountyhunters/svargrond arena and guildWars on my server. If I implant only one system at same time, it works, but I want make them all working. The problem is that each of them has some modifications in Kill.lua. I already got 2 systems(bountyhunters and svar arena) working at same time, but I can't figure out how to add Guild wars.

Here is my kill lua:

LUA:
function onKill(cid, target)
local monster = getCreatureName(target)
local room = getArenaMonsterIdByName(monster)
if room > 0 then
setPlayerStorageValue(cid, room, 1)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, 'You can enter next arena room!')
end

if isPlayer(target) == TRUE then
---- BOUNTY HUNTERS START -----
pid = cid
pid2 = getPlayerGUID(target)
local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
if(result_plr:getID() ~= -1) then
prize = tonumber(result_plr:getDataInt("prize"))
bid = tonumber(result_plr:getDataInt("id"))
result_plr:free()
else
prize = 0
bid = 0
end

if (bid ~= 0 and prize ~= 0 and getTileInfo(getCreaturePosition(cid)).pvp ~= true) then
db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
doPlayerAddMoney(cid,prize*1000)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[BOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
end	
---- BOUNTY HUNTERS END -----
end
return TRUE
end

and here is the script I need to add(GUILDWAR):

LUA:
dofile("./GuildWar.lua")

local PZ = createConditionObject(CONDITION_INFIGHT)
setConditionParam(PZ, CONDITION_PARAM_TICKS, getConfigInfo('pzLocked'))

function onKill(cid, target)
	if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
		local myGuild = getPlayerGuildId(cid)
		local enemyGuild = getPlayerGuildId(target)
		if myGuild ~= 0 and enemyGuild ~= 0 then
			if enemyGuild == getGuildWarInfo(myGuild).With then
				removeFrag(cid)
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "This Frag will not count") --Remove this if you wish
				doAddCondition(cid, PZ)
				registerDeath(myGuild, enemyGuild, cid, target)
			end
		end
        end
	return TRUE
end

I did my best, but since Im just wannabe script kiddie, I failed :(

I know its probably deadly simple to do this. You can contact me on msn([email protected]) or post a working script here.

Thank you!:thumbup:



THANK YOU ScorpiOOn93! SOLVED!
 
Last edited:
Just leave this kill.lua and create new file called war.lua and there put this:
dofile("./GuildWar.lua")

local PZ = createConditionObject(CONDITION_INFIGHT)
setConditionParam(PZ, CONDITION_PARAM_TICKS, getConfigInfo('pzLocked'))

function onKill(cid, target)
if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
local myGuild = getPlayerGuildId(cid)
local enemyGuild = getPlayerGuildId(target)
if myGuild ~= 0 and enemyGuild ~= 0 then
if enemyGuild == getGuildWarInfo(myGuild).With then
removeFrag(cid)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "This Frag will not count") --Remove this if you wish
doAddCondition(cid, PZ)
registerDeath(myGuild, enemyGuild, cid, target)
end
end
end
return TRUE
end
Now to login.lua add:
registerCreatureEvent(cid, "PlayerWar")

Now to creaturescripts.xml add:
<event type="kill" name="PlayerWar" script="war.lua"/>
 
Back
Top