Explain exactly how it works and maybe I make & release it.
I hate that I'm-pro-pay-or-bye guys.
Well, I'm currently TRYING really HARD to make this, but since I'm not good in this it will take.. around 2 years or something
And who will be the "angel"? xD
Gesior @ OTFans said:LUA script to count team and player frags:
Code:local fragTime = getConfigInfo('timeToDecreaseFrags') function onKill(cid, target) local team = 0 local id = 0 if isPlayer(target) == TRUE and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) > 0 then local inWar_team1 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(cid) ..",%' AND `team_2` like '%".. getPlayerGuildId(target) ..",%';") if(inWar_team1:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 1 inWar_team1:free() else local inWar_team2 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(target) ..",%' AND `team_2` like '%".. getPlayerGuildId(cid) ..",%';") if(inWar_team2:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 2 inWar_team2:free() end end if team > 0 then db.executeQuery("INSERT INTO `war_deaths` (`war_id`, `team`, `from_guild`, `to_guild`, `player_id`, `killed_by`) VALUES (" .. id .. ", " .. team .. ", " .. getPlayerGuildId(cid) .. ", " .. getPlayerGuildId(target) .. ", " .. getPlayerGUID(target) .. ", " .. getPlayerGUID(cid) .. ");") doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid)-fragTime) end end return TRUE end
Example of war:PHP:CREATE TABLE IF NOT EXISTS `wars_list` ( `id` int(11) NOT NULL auto_increment, `team_1` varchar(255) NOT NULL, `team_2` varchar(255) NOT NULL, PRIMARY KEY (`id`) ); CREATE TABLE IF NOT EXISTS `war_deaths` ( `war_id` int(11) NOT NULL, `team` int(11) NOT NULL, `from_guild` int(11) NOT NULL default '0', `to_guild` int(11) NOT NULL default '0', `player_id` int(11) NOT NULL default '0', `killed_by` int(11) NOT NULL default '0' );
(guild ID 3 vs. guild ID 38)PHP:INSERT INTO `wars_list` (`id`, `team_1`, `team_2`) VALUES (1, '3,', '38,');
(guild ID 3 and guild ID 6 vs. guild ID 38 and guild ID 23 )PHP:INSERT INTO `wars_list` (`id`, `team_1`, `team_2`) VALUES (1, '3,6,', '38,23,');
Always "," at end of guilds list.
Script save info:
1 - war id = 1PHP:INSERT INTO `war_deaths` (`war_id`, `team`, `from_guild`, `to_guild`, `player_id`, `killed_by`) VALUES (1, 1, 3, 38, 17797, 15422), (1, 1, 3, 38, 17797, 15422);
1 - frag for team 1
3 - killer was from guild id 3
38 - killed player was from guild id 38
17797 - id of killed player
15422 - id of killer
with this table you can generate any stats of war.. like:
- top 5 fragers from 1 team (or 1 guild)
PHP:SELECT `players`.`name`, COUNT(`war_deaths`.`killed_by`) frags FROM `war_deaths`, `players` WHERE `war_deaths`.`war_id` = 1 AND `players`.`id` = `war_deaths`.`killed_by` AND `war_deaths`.`team` = 1 GROUP BY `war_deaths`.`killed_by` ORDER BY COUNT(`war_deaths`.`killed_by`) DESC
- number of frags of teams from 'war id 1'
PHP:SELECT `team`, COUNT(`war_deaths`.`team`) frags FROM `war_deaths` WHERE `war_deaths`.`war_id` = 1 GROUP BY `war_deaths`.`team` ORDER BY COUNT(`war_deaths`.`team`) DESC
Script remove frags (can't get more then 1 frag if kill only enemy team members)
Now someone must write PHP scripts to invite guilds and show stats on page.
EDIT:
First page - informations about teams
local fragTime = getConfigInfo('timeToDecreaseFrags')
function onKill(cid, target)
local team = 0
local id = 0
if isPlayer(target) == TRUE and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) > 0 then
local inWar_team1 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(cid) ..",%' AND `team_2` like '%".. getPlayerGuildId(target) ..",%';")
if(inWar_team1:getID() ~= -1) then
id = tonumber(inWar_team1:getDataInt("id"))
team = 1
inWar_team1:free()
else
local inWar_team2 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(target) ..",%' AND `team_2` like '%".. getPlayerGuildId(cid) ..",%';")
if(inWar_team2:getID() ~= -1) then
id = tonumber(inWar_team1:getDataInt("id"))
team = 2
inWar_team2:free()
end
end
if team > 0 then
db.executeQuery("INSERT INTO `war_deaths` (`war_id`, `team`, `from_guild`, `to_guild`, `player_id`, `killed_by`) VALUES (" .. id .. ", " .. team .. ", " .. getPlayerGuildId(cid) .. ", " .. getPlayerGuildId(target) .. ", " .. getPlayerGUID(target) .. ", " .. getPlayerGUID(cid) .. ");")
doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid)-fragTime)
end
end
return TRUE
end
local fragTime = getConfigInfo('timeToDecreaseFrags') function onKill(cid, target) local team = 0 local id = 0 if isPlayer(target) == TRUE and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) > 0 then local inWar_team1 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(cid) ..",%' AND `team_2` like '%".. getPlayerGuildId(target) ..",%';") if(inWar_team1:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 1 inWar_team1:free() else local inWar_team2 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(target) ..",%' AND `team_2` like '%".. getPlayerGuildId(cid) ..",%';") if(inWar_team2:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 2 inWar_team2:free() end end if team > 0 then db.executeQuery("INSERT INTO `war_deaths` (`war_id`, `team`, `from_guild`, `to_guild`, `player_id`, `killed_by`) VALUES (" .. id .. ", " .. team .. ", " .. getPlayerGuildId(cid) .. ", " .. getPlayerGuildId(target) .. ", " .. getPlayerGUID(target) .. ", " .. getPlayerGUID(cid) .. ");") doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid)-fragTime) end end return TRUE end 
local fragTime = getConfigInfo('timeToDecreaseFrags') function onKill(cid, target) local team = 0 local id = 0 if isPlayer(target) == TRUE and getPlayerGuildId(cid) > 0 and getPlayerGuildId(target) > 0 then local inWar_team1 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(cid) ..",%' AND `team_2` like '%".. getPlayerGuildId(target) ..",%';") if(inWar_team1:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 1 inWar_team1:free() else local inWar_team2 = db.getResult("SELECT * FROM `wars_list` WHERE `team_1` like '%".. getPlayerGuildId(target) ..",%' AND `team_2` like '%".. getPlayerGuildId(cid) ..",%';") if(inWar_team2:getID() ~= -1) then id = tonumber(inWar_team1:getDataInt("id")) team = 2 inWar_team2:free() end end if team > 0 then db.executeQuery("INSERT INTO `war_deaths` (`war_id`, `team`, `from_guild`, `to_guild`, `player_id`, `killed_by`) VALUES (" .. id .. ", " .. team .. ", " .. getPlayerGuildId(cid) .. ", " .. getPlayerGuildId(target) .. ", " .. getPlayerGUID(target) .. ", " .. getPlayerGUID(cid) .. ");") doPlayerSetRedSkullTicks(cid, getPlayerRedSkullTicks(cid)-fragTime) end end return TRUE end