[Help] Anti-Abuse Gm/Pm

06/18/2010 19:58 flex30#1
Hi,

Im using Source 5165.
In the source GM/PM Can't trade, can't drop and can't PK. But they can still drop when they get kill, and buy item in Personnal Shop of players.

So i tried to fix that.
On my server Guard 1 Hit Everybody who get blue name:

Quote:
if (Mesh == 900 && PlayerTarget.BlueName)
PlayerTarget.CurHP = 0;
But they 1 hit Gm under /protection too. I would like to make that if a GM or Pm is Bluename they don't attack him. But i just began to C# ( Gm can't attack players but can attack Guards and become blue name. The prohibit guard scrip on this forum, spam my console, and make some bugs like people can't pk sometimes.)

Or maybe Someone know how to make Gm/Pm Invincible in .cs. Without command.

2nd Thing is to make Gm/Pm unable to Buy player's items in stalls ( personnal shops market)

So i tried in packetHandler.cs:

Quote:
case 24:
{
uint ItemUID = BitConverter.ToUInt32(Data, 4);
uint StallID = BitConverter.ToUInt32(Data, 8);

if (Game.World.H_PShops.Contains(StallID))
{
Features.PersonalShops.Shop S = (Features.PersonalShops.Shop)Game.World.H_PShops[StallID];
S.Buy(ItemUID, GC.MyChar);
}
else if (GC.GM)
{
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name, "You're GM, you can't buy player's Items!", 2001, 0));
return;
}
break;
}
Don't work. I tried lot of possibility and i always can buy...

I know it can seems easy for you, but i begin i try to learn.
So if someone can or want to help me with the code, i think it will help others people too. Thx
06/18/2010 20:06 _DreadNought_#2
errrr
Code:
case 24:
{
uint ItemUID = BitConverter.ToUInt32(Data, 4);
uint StallID = BitConverter.ToUInt32(Data, 8);

if (Game.World.H_PShops.Contains(StallID))
{
if (!GC.GM)
{
Features.PersonalShops.Shop S = (Features.PersonalShops.Shop)Game.World.H_PShops[StallID];
S.Buy(ItemUID, GC.MyChar);
}
else
{
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name + " you are a " + GC.MyChar.AuthInfo.Status + " you cannot buy items ", 2011, 0));
}
}
break;
}
I'll think about how the other one is dont why done u just do
Code:
if (PlayerTarget.BlueName = true && (PlayerTarget.AuthInfo != ("GM") && (PlayerTarget.AuthInfo != ("PM")))
06/18/2010 20:22 flex30#3
Quote:
if (PlayerTarget.BlueName = true && (PlayerTarget.AuthInfo != ("GM") && (PlayerTarget.AuthInfo != ("PM")))
You didn't put the mesh of guard.

So i tried:

Quote:
if (Mesh == 900 && PlayerTarget.BlueName = true && (PlayerTarget.AuthInfo != ("GM") && (PlayerTarget.AuthInfo != ("PM")))
But i get an error :
Quote:
Error 1 Operator '!=' cannot be applied to operands of type 'method group' and 'string' C:\CoSX\CoSX\Game\Mob.cs 854 69 CoSX
06/18/2010 20:39 _DreadNought_#4
Code:
if (Mesh == 900 && PlayerTarget.BlueName = true)
{
//;
}
else if (Mesh == 900 && (PlayerTarget.AuthInfo.Status != ("GM")))
{
return;
}
06/18/2010 21:00 flex30#5
Don't works lol

Quote:
Error 1 'CoSX.Game.Character.AuthInfo(string)' is a 'method', which is not valid in the given context C:\CoSX\CoSX\Game\Mob.cs 854 87 CoSX
06/18/2010 21:38 _DreadNought_#6
uhhh
Make it this
in Character.cs add under
Code:
DateTime LastSave = DateTime.Now;
add
Code:
public bool GmPmBlueName = false;
In Chat.cs under
Code:
if (Cmd[0] == "/guard")
                        {
                            StreamWriter SW = new StreamWriter(@"C:\CoSX\Database\MobSpawns.txt", true);
                            SW.WriteLine(97 + " " + 1 + " " + GC.MyChar.Loc.Map + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y + " " + GC.MyChar.Loc.X + " " + GC.MyChar.Loc.Y);
                            SW.Flush();
                            SW.Close();
                        }
Add
Code:
                        if (Cmd[0] == "/falsee")
                        {
                            GC.MyChar.GmPmBlueName = true;
                        }
And make the shit in mob.cs this
Code:
if (Mesh == 900 && (PlayerTarget.BlueName = true && (PlayerTarget.GmPmBlueName == true)))
                    {
There they use /falseee and they cant be attacked by guard :P
06/18/2010 21:45 flex30#7
lol but if you do that they can get killed by guard when they want and drop items, and so players can pick them up lol

Or if you know how to make that Gm can't be bluename maybe it would be easier lol

So If a GM or Pm attack a guard he will not flash blue.
06/18/2010 21:49 _DreadNought_#8
ermmmmm I will quickly do the can't drop thing btw for auto-no bluename just do
Code:
if (Mesh == 900 && (PlayerTarget.BlueName = true && (PlayerTarget.MyClient.AuthInfo.Status != ("GM") || (PlayerTarget.MyClient.AuthInfo.Status != ("PM"))))
                    {
I'll look into letting them not be bluenamed

Bluenamed shit
Code:
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue)
            {
                Attacker.BlueName = true;
                if (Attacker.BlueNameLasts < 60)
                    Attacker.BlueNameLasts = 15;
            }
Make that
Code:
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue)
            {
                if (!Attacker.MyClient.GM)
                {
                    Attacker.BlueName = true;
                    if (Attacker.BlueNameLasts < 60)
                        Attacker.BlueNameLasts = 15;
                }
            }
Find
Code:
if (Type != MobBehaveour.HuntMobsAndBlue || C.BlueName)
                                            {
                                                NDist = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
                                                PlayerTarget = C;
                                            }
Make that
Code:
if (Type != MobBehaveour.HuntMobsAndBlue || C.BlueName && !C.MyClient.GM)
                                            {
                                                NDist = (byte)MyMath.PointDistance(Loc.X, Loc.Y, C.Loc.X, C.Loc.Y);
                                                PlayerTarget = C;
                                            }
Find
Code:
if (PlayerTarget != null && (PlayerTarget.CanBeMeleed || AtkType != AttackType.Melee) && PlayerTarget.Alive && PlayerTarget.MyClient != null && MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) < Math.Max(15, (int)AttackDist) && (Type != MobBehaveour.HuntMobsAndBlue || PlayerTarget.BlueName))
                    {
Make that
Code:
if (PlayerTarget != null && (PlayerTarget.CanBeMeleed || AtkType != AttackType.Melee) && PlayerTarget.Alive && PlayerTarget.MyClient != null && MyMath.PointDistance(Loc.X, Loc.Y, PlayerTarget.Loc.X, PlayerTarget.Loc.Y) < Math.Max(15, (int)AttackDist) && (Type != MobBehaveour.HuntMobsAndBlue || PlayerTarget.BlueName && !PlayerTarget.MyClient.GM))
                    {
Find
Code:
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue)
                    return true;
make that
Code:
if (Type == MobBehaveour.HuntBlueNames || Type == MobBehaveour.HuntMobsAndBlue && !PlayerTarget.MyClient.GM)
                    return true;
And for not dropping
find
Code:
f (!World.FreePKMaps.Contains(Loc.Map))
                    LoseInvItemsAndSilvers();
make that
Code:
f (!World.FreePKMaps.Contains(Loc.Map) && !MyClient.GM)
                    LoseInvItemsAndSilvers();
DONE!
06/18/2010 22:26 flex30#9
Your code for not dropping don't work.

BUT! My Gm can't be blue name anymore and can't attack guard. it still stay that if a Gm be kileld by a monster it can die. So maybe there is a way to take the cde of /protect and make that when a gm log in they get the protect staut automaticaly, and i delete the /protect command?

And for the other problem i rly don't find how to fix it >.<

GM can buy items in personal shop at market. So Users can sell an item for 100000cp and the gm buy it :/
06/18/2010 23:32 _DreadNought_#10
Right ive done too much work for you
Code:
case 24:
{
uint ItemUID = BitConverter.ToUInt32(Data, 4);
uint StallID = BitConverter.ToUInt32(Data, 8);

if (Game.World.H_PShops.Contains(StallID))
{
if (!GC.GM)
{
Features.PersonalShops.Shop S = (Features.PersonalShops.Shop)Game.World.H_PShops[StallID];
S.Buy(ItemUID, GC.MyChar);
}
else
{
GC.AddSend(Packets.ChatMessage(0, "SYSTEM", GC.MyChar.Name + " you are a " + GC.MyChar.AuthInfo.Status + " you cannot buy items ", 2011, 0));
}
}
break;
}
06/19/2010 11:26 flex30#11
Quote:
Originally Posted by Eliminationn View Post
Right ive done too much work for you
Yea, and thanks to you, now my gm can't help players with items or cps ;p
And hopefully there is people like you here.

I think i'll find where to put the /protection code to make GM/Pm invincible when they login and i'll post it, can always help someone.
If someone find before me don't hesitate to post it :p
06/19/2010 12:20 _DreadNought_#12
uhhhhhhhhhh
In teleport.cs add
[CODE]
if (GC.MyChar.Name.Contains("GM"))
{
GC.MyChar.Protection = true
}
06/19/2010 12:45 flex30#13
Quote:
Originally Posted by Eliminationn View Post
uhhhhhhhhhh
In teleport.cs add
[CODE]
if (GC.MyChar.Name.Contains("GM"))
{
GC.MyChar.Protection = true
}
didn't work so i tried:

Quote:
if (GC.AuthInfo.Status == "[PM]" || GC.AuthInfo.Status == "[GM]")
{
GC.MyChar.Protection = true;
}
And it works !! Thanks to your help really!
06/19/2010 13:37 ~Yuki~#14
Unexpected to see ppl helpin eachother o.O WTF has happened to epvpers =O

My whole respect to you Elimination
06/19/2010 15:20 _DreadNought_#15
Thanks Yuki!

I help people with what I can.