Register for your free account! | Forgot your password?

Go Back   elitepvpers > Conquer Online 2 > CO2 PServer - Discussions / Questions
You last visited: Today at 15:03

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

 

How to stop people from spamming marriage

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2013
Posts: 36
Received Thanks: 2
How to stop people from spamming marriage

This is the code i'm currently using. You can send out invites to several chars and press ''Marry'' on all chars and it will have marriage to all the chars. Where can i put another check to make it stop being able to marry more than 1 char?

PHP Code:
 public class Marriage
    
{
        public static 
void Handle(Main.GameClient GCbyte[] Data)
        {
            
uint AttackType BitConverter.ToUInt32(Data20);

            if (
AttackType == 8)
            {
                
uint TargetUID BitConverter.ToUInt32(Data12);
                
Game.Character TargetMarry null;

                if (
Game.World.H_Chars.ContainsKey(TargetUID))
                    
TargetMarry Game.World.H_Chars[TargetUID];
                if (
TargetMarry == null)
                    return;

                if (
GC.MyChar.Spouse != "None" && GC.MyChar.Spouse != " " && GC.MyChar.Spouse != "")
                {
                    
GC.LocalMessage(2005"You are married."); return;
                }
                if (
TargetMarry.Spouse != "None" && TargetMarry.Spouse != " " && TargetMarry.Spouse != "")
                {
                    
GC.LocalMessage(2005"The target is married."); return;
                }
                if ((
TargetMarry.Body == 1003 || TargetMarry.Body == 1004) && (GC.MyChar.Body == 1003 || GC.MyChar.Body == 1004))
                {
                    
GC.LocalMessage(2005"No male and male marriage is permited!"); return;
                }
                if ((
TargetMarry.Body == 2001 || TargetMarry.Body == 2002) && (GC.MyChar.Body == 2001 || GC.MyChar.Body == 2002))
                {
                    
GC.LocalMessage(2005"No female and female marriage is permited!"); return;
                }

                
TargetMarry.MyClient.AddSend(Packets.AttackPacket(GC.MyChar.EntityIDTargetMarry.EntityIDTargetMarry.Loc.XTargetMarry.Loc.Y08));
            }
            else if (
AttackType == 9)
            {
            
                
uint TargetUID BitConverter.ToUInt32(Data12);
                
Game.Character TargetMarry null;
               
                if (
Game.World.H_Chars.ContainsKey(TargetUID))
                    
TargetMarry Game.World.H_Chars[TargetUID];
              
                
TargetMarry.Spouse GC.MyChar.Name;
                    
GC.MyChar.Spouse TargetMarry.Name;
                
TargetMarry.MyClient.AddSend(Packets.String(TargetMarry.EntityID6TargetMarry.Spouse));
                
GC.AddSend(Packets.String(GC.MyChar.EntityID6GC.MyChar.Spouse));
               
                
Database.SaveCharacter(TargetMarryTargetMarry.MyClient.AuthInfo.Account);
                
Database.SaveCharacter(GC.MyCharGC.AuthInfo.Account);
                if (
GC.MyChar.Body == 1003 || GC.MyChar.Body == 1004)
                    
Game.World.SendMsgToAll("SYSTEM"GC.MyChar.Name " and " TargetMarry.Name " are married now."20050);
                else
                    
Game.World.SendMsgToAll("SYSTEM"TargetMarry.Name " and " GC.MyChar.Name " are married now."20050);
            }
        }
    }




~OwnageBoy is offline  
Old   #2
 
elite*gold: 0
Join Date: Apr 2017
Posts: 76
Received Thanks: 46
First of all, this code is really ******* terrible. I have no idea what source this is, but it seems to be a really ****** one from what I can see. I would advise deleting it from your computer, but that's just me.

Secondly, if you can't even figure out something as simple as this, I mean, the code (however ****** it may be) for checking if the people are married is already there. Then you shouldn't be attempting to run a private server.

I'll give you a hint, though: Add the "are these people already married?" check to the "accept marriage" part ...

That's as far as my spoon reaches.


boDil is offline  
Thanks
1 User
Old   #3
 
elite*gold: 12
Join Date: Jul 2011
Posts: 6,799
Received Thanks: 3,286
This was the first issue I ever debugged... with 2-3 hours of programming experience.
You should try fixing it yourself instead of requesting people spoon feed you answers.
Spirited is offline  
Old   #4
 
elite*gold: 0
Join Date: Jul 2013
Posts: 36
Received Thanks: 2
Just as I thought. Great answers, happy new year anyway

Edit: Thanks for the hint boDil. Problem solved


~OwnageBoy is offline  
Old   #5
 
elite*gold: 12
Join Date: Jul 2011
Posts: 6,799
Received Thanks: 3,286
Quote:
Originally Posted by ~OwnageBoy View Post
Just as I thought. Great answers, happy new year anyway

Edit: Thanks for the hint boDil. Problem solved
Can you post how you solved this? Because there's already a check for it, it's just a broken check. I mean, it's completely up to you if you'd like to share, but it's good to check with other programmers. You shouldn't duplicate logic if you can help it.
Spirited is offline  
Old   #6
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,930
Received Thanks: 662
Homophobic code.
KraHen is offline  
Old   #7
 
elite*gold: 0
Join Date: Jul 2013
Posts: 36
Received Thanks: 2
Quote:
Originally Posted by Spirited View Post
Can you post how you solved this? Because there's already a check for it, it's just a broken check. I mean, it's completely up to you if you'd like to share, but it's good to check with other programmers. You shouldn't duplicate logic if you can help it.
I added the missing check just as he said. I'm suppose to post it again so you can come up with a nice way to joke again? elitepvpers ftw
~OwnageBoy is offline  
Old   #8
 
elite*gold: 12
Join Date: Jul 2011
Posts: 6,799
Received Thanks: 3,286
Quote:
Originally Posted by ~OwnageBoy View Post
I added the missing check just as he said. I'm suppose to post it again so you can come up with a nice way to joke again? elitepvpers ftw
If you can't recognize a good gesture when you see it, then fine.
Spirited is offline  
Old   #9
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,486
Received Thanks: 569
Quote:
Originally Posted by ~OwnageBoy View Post
I added the missing check just as he said. I'm suppose to post it again so you can come up with a nice way to joke again? elitepvpers ftw
We already know that you code for ****, Spririted actually wanted to give you feedback unlike many others.
turk55 is online now  
Old   #10
 
elite*gold: 0
Join Date: Jul 2013
Posts: 36
Received Thanks: 2
Quote:
Originally Posted by turk55 View Post
We already know that you code for ****, Spririted actually wanted to give you feedback unlike many others.
I code for ****? Well then I got full bags of ****. Anything else?
~OwnageBoy is offline  
Old   #11
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,486
Received Thanks: 569
Quote:
Originally Posted by ~OwnageBoy View Post
I code for ****? Well then I got full bags of ****. Anything else?
Are you proud of your achievements so far? And why?
turk55 is online now  
Old   #12
 
elite*gold: 0
Join Date: Jul 2013
Posts: 36
Received Thanks: 2
I am pretty proud... i just layed a 20 courig **** and wrote a 20 hour code and got a pheasant to spawn in twin city.
~OwnageBoy is offline  
Old   #13
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,486
Received Thanks: 569
Quote:
Originally Posted by ~OwnageBoy View Post
I am pretty proud... i just layed a 20 courig **** and wrote a 20 hour code and got a pheasant to spawn in twin city.
OMG! That is so amazing! You only did it in 20 hours!!!
turk55 is online now  
Old   #14
 
elite*gold: 12
Join Date: Jul 2011
Posts: 6,799
Received Thanks: 3,286
Quote:
Originally Posted by turk55 View Post
OMG! That is so amazing! You only did it in 20 hours!!!
Hey, if he's programming on his own, I'm for that. He just needs more practice before doing more with servers.
Spirited is offline  
Old   #15
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,486
Received Thanks: 569
Quote:
Originally Posted by Spirited View Post
Hey, if he's programming on his own, I'm for that. He just needs more practice before doing more with servers.
Sure, however he is already running a private server.


turk55 is online now  
Thanks
1 User
Reply



« Previous Thread | Next Thread »

Similar Threads
[Non Stop Non Stop 24/7] For Ever Free MM Service [Non Stop 24/7]
ch möchte hier meine Dienste als Middleman anbieten. Deutsch ✔] Telefon Verifizierung ✔] Seit 3 Monaten registriert ✔] Mehr als 300 Posts ✔]...
38 Replies - Middleman
STOP SPAMMING IDIOTS.
I KNOW I KNOW . JUST SAYING STOP SPAMMING. THREAD CLOSED
2 Replies - Grand Chase
Stop people from hitting multiple stakes in TG/Stop weapon skill
Let me start off by saying this is a pretty dirty trick! But if you really don't like someone you can stop them from getting their max exp in TG. ...
21 Replies - CO2 Exploits, Hacks & Tools



All times are GMT +2. The time now is 15:03.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.