Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 18:01

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]5165 code to prohibit Guard attack

Discussion on [Release]5165 code to prohibit Guard attack within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2006
Posts: 127
Received Thanks: 91
Thumbs up [Release]5165 code to prohibit Guard attack Update

hi guys let me share you this simple code that will prohibit players from attacking the guards in most city of CO. i hope this release will be useful.

here is the guide:

1. open Attack.cs in PacketHandling.

2. in Attack.cs look for this code
Code:
public static void Handle(Main.GameClient GC, byte[] Data)
3. above it add this code
Code:
        public static bool isCity(ushort mapID)
        {
            bool  retValue=false;
            switch(mapID)
            {
                case 1000:
                case 1002:
                case 1039:
                case 1213:
                case 1011:
                case 1036:
                case 2020:
                case 2021:
                    {
                        retValue = true;
                        break;
                    }
            }
       
            return(retValue); 
        }
4. then find this code
Code:
  if (Game.World.H_Mobs.Contains(GC.MyChar.Loc.Map))
                    {
                        Hashtable MapMobs = (Hashtable)Game.World.H_Mobs[GC.MyChar.Loc.Map];
                        if (MapMobs.Contains(TargetUID))
                        {
5. lastly add this code below;
Code:
if (PossMob.Mesh == 900 && isCity(PossMob.Loc.Map))
{
   GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name, "you cannot attack guard in this server", 2001, 0));
                        return;
 }
For Skills not to hit Guards follow this steps.

1. Open Skills.cs and search for
Quote:
void GetMobTargets(uint Single)
{
if (Info.ExtraEff == ExtraEffect.Ride || Info.ExtraEff == ExtraEffect.UnMount) return;
if (Info.Targetting == TargetType.Single)
{
if (World.H_Mobs.Contains(User.Loc.Map))
{
Mob M = (Mob)((Hashtable)(World.H_Mobs[User.Loc.Map]))[Single];
if (M != null && M.Alive && M.Mesh!=900)
MobTargets.Add(M, GetDamage(M));
}
}
else
{
bool RangeFromChar = true;
if (Info.Targetting == TargetType.FromSingle)
{
Mob M = (Mob)((Hashtable)(World.H_Mobs[User.Loc.Map]))[Single];
if (M != null && M.Alive && M.Mesh != 900)
{
MobTargets.Add(M, GetDamage(M));
AimX = M.Loc.X;
AimY = M.Loc.Y;
RangeFromChar = false;
}
}
else if (Info.Targetting != TargetType.Sector && Info.Targetting != TargetType.Linear && Info.Targetting != TargetType.Range && Info.Targetting != TargetType.FromPoint)
{
AimX = User.Loc.X;
AimY = User.Loc.Y;
RangeFromChar = true;
}
else
RangeFromChar = false;
Hashtable MapMobs = (Hashtable)World.H_Mobs[User.Loc.Map];
List<coords> Line = new List<coords>(5);
if (Info.Targetting == TargetType.Linear)
Line = MyMath.LineCoords(User.Loc.X, User.Loc.Y, AimX, AimY, 10);
if (MapMobs != null)
foreach (Mob M in MapMobs.Values)
{
if (M.Alive && M.Mesh != 900)
{
if ((!RangeFromChar && MyMath.PointDistance(AimX, AimY, M.Loc.X, M.Loc.Y) <= Info.MaxDist) || MyMath.PointDistance(User.Loc.X, User.Loc.Y, M.Loc.X, M.Loc.Y) <= Info.MaxDist)
if (Info.Targetting == TargetType.Sector && InSector(M.Loc.X, M.Loc.Y) || Info.Targetting != TargetType.Sector)
if (Info.Targetting == TargetType.Linear && Line.Contains(new coords(M.Loc.X, M.Loc.Y)) || Info.Targetting != TargetType.Linear)
if (User.PKMode == PKMode.PK || !M.NeedsPKMode && !MobTargets.Contains(M))
MobTargets.Add(M, GetDamage(M));
}
}
}
}
2. Change Your code with the red one.
end...
kamote is offline  
Thanks
3 Users
Old 01/31/2010, 11:58   #2
 
ImmuneOne's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 754
Received Thanks: 544
Hey,

The thread is posted in the wrong sectioin, you are reported for doing that.
Please read the rules next time before you post in any section.

Regards,
ImmuneOne.
ImmuneOne is offline  
Old 01/31/2010, 11:59   #3
 
Huseby's Avatar
 
elite*gold: 106
Join Date: Oct 2006
Posts: 6,047
Received Thanks: 1,165
#Moved
Huseby is offline  
Old 01/31/2010, 20:22   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Minor note: Why not use the guard name instead of the mesh? While people should be able to do that themselves... seems like some people might want to use the same mesh guards have for special quests/bosses or w/e. Ruling out an entire mesh instead of just a guard name (which shouldn't be changing on a regular basis anyways) seems a bit silly.

Other then that, good job!
pro4never is offline  
Old 02/01/2010, 05:20   #5
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 534
Received Thanks: 66
My chars are still running at and attacking guards >.<
WHITELIONX is offline  
Old 02/01/2010, 08:04   #6
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by WHITELIONX View Post
My chars are still running at and attacking guards >.<
Are those chars GM chars?
Arcо is offline  
Old 02/01/2010, 09:41   #7
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 534
Received Thanks: 66
[GM] and [PM] and normal chars lol
WHITELIONX is offline  
Old 02/01/2010, 09:42   #8
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Try taking out,
if (GC.GM)
return;
Arcо is offline  
Old 02/01/2010, 10:50   #9
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 534
Received Thanks: 66
Would love to but I can`t build it until I have sorted the problem with the FB/SS thing lol. My source is throwing only two errors now "Extension methods must be defined in a non-generic static class" both are in MyMath.cs
WHITELIONX is offline  
Old 02/01/2010, 10:57   #10
 
elite*gold: 0
Join Date: May 2006
Posts: 127
Received Thanks: 91
Quote:
Originally Posted by pro4never View Post
Minor note: Why not use the guard name instead of the mesh? While people should be able to do that themselves... seems like some people might want to use the same mesh guards have for special quests/bosses or w/e. Ruling out an entire mesh instead of just a guard name (which shouldn't be changing on a regular basis anyways) seems a bit silly.

Other then that, good job!
thanks for your suggestion... and for the compliment...
kamote is offline  
Old 02/01/2010, 14:00   #11
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 534
Received Thanks: 66
Ok I have it now so that chars do not attack Guards but the only issue that caused it was because I called them Watchers and the source will only not attack anything with the word "Guard" in it. I stumbled across this because you can not attack WHSGuardian either ^^

Has anybody figured out how to not attack NPCs with magic attack yet?
WHITELIONX is offline  
Old 02/02/2010, 02:51   #12
 
elite*gold: 0
Join Date: May 2006
Posts: 127
Received Thanks: 91
Quote:
Originally Posted by WHITELIONX View Post
Ok I have it now so that chars do not attack Guards but the only issue that caused it was because I called them Watchers and the source will only not attack anything with the word "Guard" in it. I stumbled across this because you can not attack WHSGuardian either ^^

Has anybody figured out how to not attack NPCs with magic attack yet?
change PossMob.Mesh==900 to PossMob.Name == "Watchers" .

check the updates...
kamote is offline  
Thanks
1 User
Old 02/03/2010, 05:13   #13
 
elite*gold: 0
Join Date: Jan 2010
Posts: 116
Received Thanks: 33
#reported - double post
Jedex is offline  
Old 02/03/2010, 07:20   #14
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 534
Received Thanks: 66
Thank you kamote I might try that I am more concerned on being able to magic attack the NPCs though lol. I want to be able to not magic attack the NPCs.
WHITELIONX is offline  
Old 02/03/2010, 08:24   #15
 
elite*gold: 0
Join Date: May 2006
Posts: 127
Received Thanks: 91
your welcome WHITELIONX... and don't forget to hit thanks if it work for you...
kamote is offline  
Reply


Similar Threads Similar Threads
[Release]Reviver Guard[5165]
10/02/2010 - CO2 PServer Guides & Releases - 46 Replies
Sup, I have not released anything yet so I will release a reviver guard.... go into Program.cs and find foreach (Hashtable H in Game.World.H_Mobs.Values) { foreach (Mob M in H.Values) {
[RELEASE] 5165 attack bug fixed. and Vote npc!
04/01/2010 - CO2 PServer Guides & Releases - 27 Replies
Ok so Snow and Para (coders and owners of Conquer 3.0) are releasing a few codes to solve the bugs on all 5165 sources. The main and major bug everyone has problems with is WeaponMaster (item upgrading) seems to give every brilliant attack unless they relog. So we have coded it so it disconnects you. But you have otpion to continue upgrading so you dont have to keep dcin every single upgrade. Here it is. #region WeaponMaster case...



All times are GMT +1. The time now is 18:03.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.