• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Fixed Guild War System for Website [include all]-[will not count frags] (TFS 0.3+)

Status
Not open for further replies.
I put step 3a but my problem isnt fixed..
Help
The Following Errors Have Occurred:
# Invalid guild name format.
 
I change what the warkill?

use this one:
Lua:
--[[
Master-m
&
Colandus
]]--
local PZ = createConditionObject(CONDITION_INFIGHT)
setConditionParam(PZ, CONDITION_PARAM_TICKS, getConfigInfo('whiteSkullTime'))

function onKill(cid, target, lastHit)
	if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
		local GUID = getPlayerGUID(cid)
		local namec = getPlayerName(cid)
		local namet = getPlayerName(target)
		local skull = getCreatureSkullType(cid)
		local skullend = getPlayerSkullEnd(cid)
		local cidd = cid

		local timeA = os.time()
		local timesA = {today = (timeA - 86400), week = (timeA - (7 * 86400))}

		local contentsA, resultA = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (timeA - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
		if(resultA:getID() ~= -1) then
			repeat
				local contentA = {
					name = resultA:getDataString("name"),
					level = resultA:getDataInt("level"),
					date = resultA:getDataInt("date")
				}
				if(contentA.date > timesA.today) then
					table.insert(contentsA.day, contentA)
				elseif(contentA.date > timesA.week) then
					table.insert(contentsA.week, contentA)
				else
					table.insert(contentsA.month, contentA)
				end
			until not resultA:next()
			resultA:free()
		end

		local sizeA = {
			day = table.maxn(contentsA.day),
			week = table.maxn(contentsA.week),
			month = table.maxn(contentsA.month)
		}

		local function removeFrag(cid)

			local timeB = os.time()
			local timesB = {today = (timeB - 86400), week = (timeB - (7 * 86400))}

			local contentsB, resultB = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. GUID .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (timeB - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
			if(resultB:getID() ~= -1) then
				repeat
					local contentB = {
						name = resultB:getDataString("name"),
						level = resultB:getDataInt("level"),
						date = resultB:getDataInt("date")
					}
					if(contentB.date > timesB.today) then
						table.insert(contentsB.day, contentB)
					elseif(contentB.date > timesB.week) then
						table.insert(contentsB.week, contentB)
					else
						table.insert(contentsB.month, contentB)
					end
                until not resultB:next()
                resultB:free()
			end

			local sizeB = {
                day = table.maxn(contentsB.day),
                week = table.maxn(contentsB.week),
                month = table.maxn(contentsB.month)
			}


			if sizeB.day > sizeA.day or sizeB.week > sizeA.week or sizeB.month > sizeA.month then
				db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = "..GUID..") ORDER BY `death_id` DESC LIMIT 1;")
				doPlayerSendTextMessage(cidd, 21, "Frag from "..namet.." wasn't counted.")
			end

			if skull == SKULL_RED then
				if getCreatureSkullType(cidd) == SKULL_BLACK then
						doPlayerSetSkullEnd(cidd, skullend, SKULL_RED)
						doCreatureSetSkullType(cidd, SKULL_RED)
				end
			elseif skull == SKULL_WHITE then
				if getCreatureSkullType(cidd) == SKULL_RED then
						doPlayerSetSkullEnd(cidd, timeB, SKULL_RED)
						doCreatureSetSkullType(cidd, SKULL_WHITE)
				end
			end
		end

		local myGuild = getPlayerGuildId(cid)
		local enemyGuild = getPlayerGuildId(target)

		if myGuild ~= 0 and enemyGuild ~= 0 then
			if enemyGuild == getGuildWarInfo(myGuild).With then
				local guildc = getPlayerGuildName(cid)
				local guildt = getPlayerGuildName(target)
				doAddCondition(cid, PZ)

				if lastHit == TRUE then
					if getShowInfo(myGuild) == 1 then
						registerDeathOne(myGuild, enemyGuild, cid, target)
					else
						registerDeathTwo(myGuild, enemyGuild, cid, target)
					end    
				end
				addEvent(removeFrag, 150)

				local guildcKills = getKills(guildc)
				local guildtKills = getKills(guildt)
				local resulta, resultb = getMinMax(guildcKills, guildtKills)

				local players = getOnlinePlayers()
				for i,playerName in ipairs(players) do
					local player = getPlayerByName(playerName);
					if getPlayerGuildId(player) == myGuild then
							doPlayerSendChannelMessage(player, "", "Opponent "..namet.." of the "..guildt.." was killed by "..namec..". The new score is "..resulta..":"..resultb.." frags.", TALKTYPE_CHANNEL_W, CHANNEL_GUILD)
					end
				end
			end
		end
	end
	return TRUE
end

@Xampy
You modified guilds.php to show guilds by name insteed of id, your forgot to change this in wars.php.
 
use this one:
@Xampy
You modified guilds.php to show guilds by name insteed of id, your forgot to change this in wars.php.
Nope, files are okey (both wars.php files). Then I'm going to remove the attached guilds.rar, so people doesn't know if it's by name or id //.

PS Oh, I didn't know that function "getMinMax(guildcKills, guildtKills)" :p

PS2 Why must he use a creaturescript instead of MOD?
 
Last edited:
I don't know what to updatE! XDDD
|\\ I have no imagination //|
 
Improved War System xd but I think it's not possible. Which invites several guilds to a war.
 
Nope, files are okey (both wars.php files). Then I'm going to remove the attached guilds.rar, so people doesn't know if it's by name or id //.

PS Oh, I didn't know that function "getMinMax(guildcKills, guildtKills)" :p

PS2 Why must he use a creaturescript instead of MOD?

1)
yeah I ment like in wars.php when pressing a guildname it goes to
"action=show&guild=guildid"

but with ur atached guilds.php it goes to "action=show&guild=guildname"

2)
yeah colandus added that one, he said it is better lol:p.

3)
the 0.3.5 version I was using didn't had mods yet, thats why O,o.
 
1)
yeah I ment like in wars.php when pressing a guildname it goes to
"action=show&guild=guildid"

but with ur atached guilds.php it goes to "action=show&guild=guildname"

2)
yeah colandus added that one, he said it is better lol:p.

3)
the 0.3.5 version I was using didn't had mods yet, thats why O,o.
1) But newbie people won't know if they are by name or by id, since they must Search in the file about CTRL+F -> "show&guild=" and most people will say me, "What?", "How can I do that?", "Idk how to do it..." ...xDDD (Sorry if I hurt someone's feelings xDDDD).

2)w00t! (xd?¿?)

3)Maybe you deleted MODS folder?? xDDDD (j0king). I guess 0.3.5 (not pl1) already have got mods folder.


4) I want you as MOD of OtLand :$!!!
 
1) But newbie people won't know if they are by name or by id, since they must Search in the file about CTRL+F -> "show&guild=" and most people will say me, "What?", "How can I do that?", "Idk how to do it..." ...xDDD (Sorry if I hurt someone's feelings xDDDD).

2)w00t! (xd?¿?)

3)Maybe you deleted MODS folder?? xDDDD (j0king). I guess 0.3.5 (not pl1) already have got mods folder.


4) I want you as MOD of OtLand :$!!!

hehe is possible la0l. Or maybe we have custom version idk. I want mod 2 ^^
 
when someone kills an enemy player guild, the player does not die up with "0" of life ... and it begins to appear this log in my TFS ...
[05/01/2010 12:13:52] Lua Script Error: [CreatureScript Interface]
[05/01/2010 12:13:52] data/creaturescripts/scripts/WarKill.lua: onKill

[05/01/2010 12:13:52] data/creaturescripts/scripts/WarKill.lua:113: attempt to call global 'getKills' (a nil value)
[05/01/2010 12:13:52] stack traceback:
[05/01/2010 12:13:52] data/creaturescripts/scripts/WarKill.lua:113: in function <data/creaturescripts/scripts/WarKill.lua:9>
note: I'm using the tutorial for TFS 0.3.4 for the reason that the tutorial for TFS 0.3.5 does not work ... on my server.
 
You missed this function:
Lua:
function getKills(name)
        local Info = db.getResult("SELECT `kills` FROM `guilds` WHERE `name` = '"..name.."'")
        if Info:getID() ~= -1 then
                local killy = Info:getDataInt("kills")
                Info:free()
                return killy
        end
        return -1
end
 
You missed this function:
Lua:
function getKills(name)
        local Info = db.getResult("SELECT `kills` FROM `guilds` WHERE `name` = '"..name.."'")
        if Info:getID() ~= -1 then
                local killy = Info:getDataInt("kills")
                Info:free()
                return killy
        end
        return -1
end

where I put this script?
 
Xampy, About that "You need to be offline to join guild" Some players also have it when they are OFFLINE. And as you said about the ONLINE = 1(online) 0 (offline). I checked the player and he had ONLINE =0 and still couldnt join the guild...

Could u help me..
And for a reason the war system rly dont work on my OT (0.3.6pl1) People keep getting frags and I just followed ur tutorial.
 
of this error only after a player, with guild war ja die activated by an enemy guild member.
[05/01/2010 14:45:46] Lua Script Error: [CreatureScript Interface]
[05/01/2010 14:45:46] data/creaturescripts/scripts/WarKill.lua:eek:nKill

[05/01/2010 14:45:46] data/creaturescripts/scripts/WarKill.lua:13: attempt to call global 'getPlayerRedSkullTicks' (a nil value)
[05/01/2010 14:45:46] stack traceback:
[05/01/2010 14:45:46] data/creaturescripts/scripts/WarKill.lua:13: in function <data/creaturescripts/scripts/WarKill.lua:4>
quit!
 
I put step 3a but my problem isnt fixed..
Help
The Following Errors Have Occurred:
# Invalid guild name format.

2x Post..
u cannot help me?
 
Xampy, About that "You need to be offline to join guild" Some players also have it when they are OFFLINE. And as you said about the ONLINE = 1(online) 0 (offline). I checked the player and he had ONLINE =0 and still couldnt join the guild...

Could u help me..
And for a reason the war system rly dont work on my OT (0.3.6pl1) People keep getting frags and I just followed ur tutorial.
I'll check it later then :p.

----------------------------------------------------------------------------------------------------
of this error only after a player, with guild war ja die activated by an enemy guild member.

quit!
Yes... Don't use 0.3.4 creaturescripts! TFS 0.3.5+ doesn't have the getPlayerRedSkullTicks function... Use the MODS file please, you're doing something wrong.

----------------------------------------------------------------------------------------------------
I put step 3a but my problem isnt fixed..
Help
The Following Errors Have Occurred:
# Invalid guild name format.

2x Post..
u cannot help me?
Did you use my guilds.php? If yes, replace it by your previous guilds.php file. After doing that, do this:
4) Go to guilds.php [it's inside htdocs folder (xampp)] and AFTER (line 1740~):
PHP:
if($guild_leader) {
if($_POST['todo'] == 'save') {
delete_guild($guild->getId());
$saved = TRUE;
}
paste this:
PHP:
$war = $guild->getCustomField("in_war_with");

if($war == 0) {
and BEFORE (line 1760~):
PHP:
else
{
$guild_errors[] = 'You are not a leader of guild!';
}
}
paste this:
PHP:
else
{
$guild_errors[] = 'You are in war with with some other guild!';
}
}
 
Xamppy could you give yours guilds.php for 0.3.6pl1 ?Plx:peace:
 
Last edited:
The PHP is for website, not server. Btw, you used the wars.php file from 3a or 3b step?
 
Status
Not open for further replies.
Back
Top