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

War system :)

Ates.tr

Im back
Joined
Nov 11, 2007
Messages
1,046
Reaction score
2
Location
Sweden
Can anyone make me a war system script ? like chrstiandb have in hes server ?


Like auto count frag's and shiet ;) thanks <3!
 
Too many crap here 8)

i didnt made the script for fun, it was a private request and i accepted, now read I WONT release it because he payed for keep it private and of course i wont fuck him.

i dont care about the rep and shitty decorations, a stupid rep point less wont make me forget the things i know ^.-
i stop releasing scripts long time ago because of people as Zonet/Pwnet and few other reasons.


if someone make it, i dont care, make it and get your rep.
 
It would be very handy to have :) Though I wont buy it. Because sooner or later an angel steps forward and releases it for free (A) :D
 
Here is code:
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
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'
);
Example of war:
PHP:
INSERT INTO `wars_list` (`id`, `team_1`, `team_2`) VALUES
(1, '3,', '38,');
(guild ID 3 vs. guild ID 38)
PHP:
INSERT INTO `wars_list` (`id`, `team_1`, `team_2`) VALUES
(1, '3,6,', '38,23,');
(guild ID 3 and guild ID 6 vs. guild ID 38 and guild ID 23 )
Always "," at end of guilds list.
Script save info:
PHP:
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 - war id = 1
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
war1gz2.jpg
 
please tutorial, where do i need to put this:

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
Sorry my english!
 
i had this error

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 
 
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 
What's that, what do i need?
 
Back
Top