Vice Underdogs

Scripting => Script Showroom => Topic started by: Charley on February 22, 2012, 07:32:19 pm

Title: Charley's Attack/Defend Script
Post by: Charley on February 22, 2012, 07:32:19 pm
Charley's Attack/Defend Script 1.0 22/02/2012

This script was made for use with VC:MP 0.3. An updated version for use with 0.4 can be found here (http://forum.vc-mp.org/?topic=2015.30).

This script is in part a squirrel remake of Murid's NPT. It has various features that have been adjusted and updated but the format and bases remain the same. I thank Murid for the original script and putting work into finding all the bases. I made this script as sadly NPT is notoriously unstable and has upset many clan wars. This script should be more stable.

Attack/Defend Gamemode:

- Play in rounds
- 2 teams
- 35 bases to choose from
- One team attacks the base and one team defends
- For the attackers to win, they must either eliminate all the defenders or one of their players must stand in the base's checkpoint for 20 seconds.
- For defenders to win, they must either eliminate all the attackers or hold them off until the 10 minute timer runs out.

Features:

- 35 bases
- "Top Scorer" award each round
- Stats system (not saved on exit)
- 6 Weapon sets for players to choose from, limits on number of players who can use some sets
- Referee class
- Ability to pause rounds; add and remove players from rounds.


Download Link: http://www.sendspace.com/file/ylpiri


Note: I have not gone through and optimised this script. There are certainly better ways of doing some of the things that are done, however the improvement would be hardly noticeable ingame. This was just designed to work and to be stable, not to be perfect.
Title: Re: Charley's Attack/Defend Script
Post by: Charley on February 22, 2012, 08:25:30 pm
Fixed a small bug, updated download link.
Title: Re: Charley's Attack/Defend Script
Post by: Knucis on February 22, 2012, 08:51:26 pm
Really awesome :D
Title: Re: Charley's Attack/Defend Script
Post by: Face* on February 23, 2012, 07:02:56 am
Good work bro
Title: Re: Charley's Attack/Defend Script
Post by: Amenine on February 23, 2012, 07:08:04 am
Will be a fun ...  :D
Title: Re: Charley's Attack/Defend Script
Post by: Thijn on February 23, 2012, 10:06:26 am
We can have clan wars with a working IRC echo :o

Very Very nice work!
Title: Re: Charley's Attack/Defend Script
Post by: ToXic on February 23, 2012, 02:09:04 pm
We can have clan wars with a working IRC echo :o

Very Very nice work!

echo in NPT

sounds good ...
Title: Re: Charley's Attack/Defend Script
Post by: Charley on February 23, 2012, 02:21:35 pm
We can have clan wars with a working IRC echo :o

Very Very nice work!

echo in NPT CAD

sounds good ...
Title: Re: Charley's Attack/Defend Script
Post by: Eddy on February 23, 2012, 05:01:51 pm
Nice job  ;)
Title: Re: Charley's Attack/Defend Script
Post by: WiLsOn on February 24, 2012, 08:17:36 am
Nice script + Good job  :) ;) :thumbsup:
Title: Re: Charley's Attack/Defend Script
Post by: Sora_Blue on February 24, 2012, 10:22:54 am
awesome im looking forward to see this improvement in action
Title: Re: Charley's Attack/Defend Script
Post by: yazeen on February 25, 2012, 11:06:49 am
pro script nice work  :thumbsup:

But may i ask you why did ya add:
Code: [Select]
" || " + player.Name along with all
Code: [Select]
ClientMessageToAll Commands?

Title: Re: Charley's Attack/Defend Script
Post by: Thijn on February 25, 2012, 12:01:26 pm
Thats how it was on the original pawn script.
Title: Re: Charley's Attack/Defend Script
Post by: Zeke on February 25, 2012, 12:36:15 pm
This script is fantastic!
Title: Re: Charley's Attack/Defend Script
Post by: Knucis on February 25, 2012, 03:36:07 pm
There were some bugs regarding the round function, which would make /c base not work, and not setting the CPCount to 20 when you finish a round.

Just replace this on the function.nut (line 87) :
Code: [Select]
function RoundUpdate()
{
AttHp = 0;
DefHp = 0;
if (RoundActive == false)
{
UpdateTimer.Stop();
local i = 0, p = GetPlayers();
while (i <= p)
{
local plr = FindPlayer(i);
if (plr)
{
if (plr.IsSpawned) Announce("~r~C~b~AD", plr, 1);
}
i++;
}
return;
}

if (Paused == true) return;

SecRemain--;
if(SecRemain < 0)
    {
        SecRemain = 59;
    MinRemain--;
    if(MinRemain < 0)
    {
ClientMessageToAll("Base time exceeded", 255,127,36);
    EndRound(1);
    return;
    }
    }

if(PlayerInCP != -1)
    {
        if(IsPlayerInCP(PlayerInCP) == true)
        {
CPCount--;
if(CPCount == 0)
{
    EndRound(3);
CPCount = 20;
    return;
    }
  }
  else
  {
PlayerInCP = -1;
CPCount = 20;
  }
    }
local i = 0, p = GetPlayers(), aalive = 0, dalive = 0;

while (i <= p)
{
local plr = FindPlayer(i);
if (plr)
{
if (pinfo[i].InRound)
{
if (pinfo[i].Side == "Att")
{
aalive++;
AttHp += plr.Health;
AttHp += plr.Armour;
plr.Score = (plr.Health + plr.Armour);
if (PlayerInCP == -1)
{
if (IsPlayerInCP(i))
{
PlayerInCP = i;
}
}

}
else if (pinfo[i].Side == "Def")
{
dalive++;
DefHp += plr.Health;
DefHp += plr.Armour;
plr.Score = (plr.Health + plr.Armour);

}
}
}
i++;
}
local y = 0, h = GetPlayers();
while (y <= h)
{
local plr = FindPlayer(y);
if (plr)
{
if (plr.IsSpawned)
{
if (PlayerInCP == -1)
{
if (SecRemain > 9)
{
Announce("~b~" + MinRemain + ":" + SecRemain, plr, 1);
}
else Announce("~b~" + MinRemain + ":0" + SecRemain, plr, 1);
}
else Announce("~y~ " + CPCount, plr, 1);
}
}
y++;
}
if ((aalive < 1) || dalive < 1) Debug();

}

function.nut: 542
Code: [Select]
function round(num, idp)
{
local mult = 10 ^ idp.tointeger();
return floor( num * mult + 0.5 ) / mult;
}

main.nut: 230
Code: [Select]
else if (cmd == "base")
{
if (RoundActive)
{
local dist = distance(player.Pos.x, player.Pos.y, CurrentCP.x, CurrentCP.y);
local dir = direction(player.Pos.x, player.Pos.y, CurrentCP.x, CurrentCP.y);
if (dist > 1000) dist = round((dist/1000), 2) + "Km";
else dist = round(dist, 2) + "m";
ClientMessage("Base: " + Bases[CurrentBase].Name + ", " + dist + " " + dir, player, 255,127,36);
}
else ClientMessage("Round is not active.", player, 255,127,36);
}

And hopefully it will work.
Title: Re: Charley's Attack/Defend Script
Post by: Charley on February 27, 2012, 05:12:20 pm
Thanks Knucis, updated download link.
Title: Re: Charley's Attack/Defend Script
Post by: Midiox on February 28, 2012, 09:22:48 pm
This script is fantastic!
Title: Re: Charley's Attack/Defend Script
Post by: Sora_Blue on March 01, 2012, 02:43:39 pm
theres a bug with set 4 if you choose it you keep the m4 from set 0 and also have the m60
Title: Re: Charley's Attack/Defend Script
Post by: morphine on March 02, 2012, 06:38:12 pm
Charley please check the command "end". It kills the server when you use it during a round.
Title: Re: Charley's Attack/Defend Script
Post by: Charley on March 02, 2012, 07:47:50 pm
Remove line 387 as a temporary fix. I'll add a permanent one when people can connect to my server again, which should hopefully be tomorrow.
Title: Re: Charley's Attack/Defend Script
Post by: Gudio on March 11, 2012, 01:40:17 pm
onScriptLoad last line:

Code: [Select]
local player;
for ( local i = 0; i <= GetMaxPlayers(); i++ )
{
player = FindPlayer( i );
if ( player ) pinfo[i] = PlayerInfo();
}

Funny fix. I heard you had problems with reloading scripts.

If you want to hide enemies, put it in onPlayerSpawn:

Code: [Select]
local plr;
for ( local i = 0; i <= GetMaxPlayers(); i++ )
{
plr = FindPlayer( i );
if ( plr )
{
if ( plr.Team != player.Team )
{
player.RemoveLocalMarker( plr );
plr.RemoveLocalMarker( player );
}
}
}

If I find free time, I'll optimize these scripts a bit.
Title: Re: Charley's Attack/Defend Script
Post by: kevinsito on March 16, 2012, 12:33:01 am
Mind if I provide a mirror download link?
Title: Re: Charley's Attack/Defend Script
Post by: Charley on March 16, 2012, 11:36:13 am
Go ahead, you'll have to keep an eye out though as I'm hoping to release a revised edition soon(ish). Probably around the first week of April.
Title: Re: Charley's Attack/Defend Script
Post by: Sora_Blue on March 17, 2012, 05:37:24 pm
dont forget about set 4 its still giving a m4 with the m60
Title: Re: Charley's Attack/Defend Script
Post by: kevinsito on March 21, 2012, 05:00:11 am
Well I can wait until the "final" version of the script.
Title: Re: Charley's Attack/Defend Script
Post by: FaF on March 21, 2012, 02:08:35 pm
Just saw this thread, so thought of posting bugs we encountered as we also use the same script on our training server

1. It happens at time that it doesnt let you choose a set and says already many players with that set, or at times suppose if i do !set 1 and then !set 2 then i have weapons of both sets...

2. I guess when we put someone in set selection, there isnt any loading bar.

3. starting random bases instead of specific ones made some players crash everytime.

4. The vehicles dont respawn after round has ended, the still remain at their last position where they were left.

5. sometimes the checkpoint timer increases to infinity in negative form (-1,-2,-3 and so on) to solve this we just get out of pickup and get back in.


these are the core ones that i remember...i might post more later if i recall any...


but yea since it was made in a hurry so thats quite expected so yea I would like to thank charley for the script and putting it up for download as we atleast have some playable script other then having nothing...
Title: Re: Charley's Attack/Defend Script
Post by: Charley on March 21, 2012, 06:53:30 pm
Hmm I'll try and release a little update asap

Edit- I've edited the download link with an updated version.

It should have fixed all the mentioned bugs. There is still no loading bar in setchoice though.
Title: Re: Charley's Attack/Defend Script
Post by: FinchDon on July 27, 2015, 06:45:37 am
Haha Nice Work Charley

Link Broken
Title: Re: Charley's Attack/Defend Script
Post by: stormeus on July 27, 2015, 08:47:53 am
Haha Nice Work Charley

Link Broken

This thread is three years old and the script was written for 0.3 anyway.
Title: Re: Charley's Attack/Defend Script
Post by: FinchDon on July 27, 2015, 09:10:51 am
i will convert it please any link?
Title: Re: Charley's Attack/Defend Script
Post by: Thijn on July 27, 2015, 10:42:22 am
i will convert it please any link?
We made this scripting board on the VU forums so that people like you wouldn't start posting stuff like this. Please, give up.
This script was for 0.3, and there's no way you can convert it for 0.4.
Title: Re: Charley's Attack/Defend Script
Post by: FinchDon on July 27, 2015, 01:04:38 pm
ok sorry i can't convert but please give me this script
Title: Re: Charley's Attack/Defend Script
Post by: Angela on July 27, 2015, 01:55:34 pm
ok sorry i can't convert but please give me this script
(https://viceunderdogs.com/proxy.php?request=http%3A%2F%2Fi1160.photobucket.com%2Falbums%2Fq490%2FMeluu_Amezagaa%2Ftumblr_m9sgey9TN21rt9tnd.gif&hash=203e1432ed697a338c500444b2fce4a99733c5b1)
Title: Re: Charley's Attack/Defend Script
Post by: Thijn on July 27, 2015, 05:09:03 pm
ok sorry i can't convert but please give me this script
Get lost.
Title: Re: Charley's Attack/Defend Script
Post by: Shemiqq on July 27, 2015, 05:28:58 pm
ok sorry i can't convert but please give me this script

I blame people like you for ruining VC:MP's reputaion.
Title: Re: Charley's Attack/Defend Script
Post by: klein. on January 29, 2017, 10:29:14 am
Download link dead  :o :o
Title: Re: Charley's Attack/Defend Script
Post by: WiLsOn on January 29, 2017, 11:17:04 am
Go jump off roof and die.
Title: Re: Charley's Attack/Defend Script
Post by: klein. on March 15, 2017, 12:44:51 am
Go jump off roof and die.
Title: Re: Charley's Attack/Defend Script
Post by: SMD on March 15, 2017, 11:47:48 pm
@klein.
 Clickhere (http://www.youareanidiot.org/)
Title: Re: Charley's Attack/Defend Script
Post by: pagal on March 31, 2017, 04:18:06 am
Can you give me the link of this script attack and defence
Title: Re: Charley's Attack/Defend Script
Post by: Azal on March 31, 2017, 05:15:08 am
Can you give me the link of this script attack and defence

Hey pagal,  i've not written this script nor do i have any scripting knowledge. But i can quite confidently tell you that whatever this script was intended for it is no longer useful for that purpose. You also may have noticed that this thread is from the year 2012 which is quite sufficient to understand that bumping it or asking for a download link can result in a negative response. 

PS: if someone would lock this topic that could be helpful imo.
Title: Re: Charley's Attack/Defend Script
Post by: klein. on March 31, 2017, 05:22:36 am
This is the real script (http://forum.vc-mp.org/?topic=2015.0)
I apologize if,i did wrong post
Title: Re: Charley's Attack/Defend Script
Post by: Charley on March 31, 2017, 07:55:02 am
This is the real script (http://forum.vc-mp.org/?topic=2015.0)
I apologize if,i did wrong post

Thanks, I've updated the first post. It links to not the 'real' script, but the one that is an updated version of this one.
Title: Re: Charley's Attack/Defend Script
Post by: klein. on April 01, 2017, 04:32:36 am
Okay,Welcome