Register for your free account! | Forgot your password?

You last visited: Today at 13:55

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


[Help]With a code

Discussion on [Help]With a code within the CO2 PServer - Discussions / Questions forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2009
Posts: 143
Received Thanks: 155
[Help]With a code

Trying to get this NPC to check if your a trojan. If your not its supposed to say "Only trojans can buy this blah blah" But it doesn't. It wont sell you anything if your not trojan but it doesnt say what i want it to. Whats wrong with my code? To me it looks right but I SUCK AT THIS **** -.-
Code:
if (Control == 1)
                                    {
                                        if (GC.MyChar.Job == 15)
                                        {
                                            if (GC.MyChar.CPs >= 2000000)
                                            {
                                                GC.MyChar.CPs -= 2000000;

                                                GC.MyChar.StatEff.Add(StatusEffectEn.TopTrojan);
                                                GC.Message(2005, GC.MyChar.Name + " has bought the Top Trojan Halo");
                                            }
                                            else
                                            {
                                                GC.AddSend(Packets.NPCSay("Only Trojans can buy the Top Trojan Halo"));
                                                GC.AddSend(Packets.NPCLink("Oops", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                    }
P.S I already tried if (GC.MyChar.CPs >= 2000000 || GC.MyChar.Job == 15) Didn't work



Jay10291 is offline  
Old 06/18/2010, 03:13   #2
 
elite*gold: 0
Join Date: Jun 2010
Posts: 118
Received Thanks: 23
Code:
if (Control == 1)
  {
 if (GC.MyChar.Job == 15)
      {
                        if (GC.MyChar.CPs >= 2000000)
                        {
                        GC.MyChar.CPs -= 2000000;
		        GC.MyChar.StatEff.Remove(StatusEffectEn.Flashy);
                        GC.MyChar.StatEff.Add(StatusEffectEn.TopTrojan);
                        GC.Message(2005, GC.MyChar.Name + "has bought the Top Trojan Halo");
                        GC.MyChar.TopsDL = false;
	 	         }
                        else
                           {
                             GC.AddSend(Packets.NPCSay("You don't have enough cps"));
                             GC.AddSend(Packets.NPCLink("Oops", 255));
                             GC.AddSend(Packets.NPCSetFace(N.Avatar));
                             GC.AddSend(Packets.NPCFinish());
                             }
     }
  else
        {
         GC.AddSend(Packets.NPCSay("Only Trojans can buy the Top Trojan Halo"));
         GC.AddSend(Packets.NPCLink("Oops", 255));
         GC.AddSend(Packets.NPCSetFace(N.Avatar));
         GC.AddSend(Packets.NPCFinish());
          }
}
Try this one


~Master is offline  
Old 06/18/2010, 03:13   #3
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Code:
if (Control == 1)
            {
                if (GC.MyChar.Job == 15)
                {
                    if (GC.MyChar.CPs >= 2000000)
                    {
                        GC.MyChar.CPs -= 2000000;

                        GC.MyChar.StatEff.Add(StatusEffectEn.TopTrojan);
                        GC.Message(2005, GC.MyChar.Name + " has bought the Top Trojan Halo");
                    }
                }
                else
                {
                    GC.AddSend(Packets.NPCSay("Only Trojans can buy the Top Trojan Halo"));
                    GC.AddSend(Packets.NPCLink("Oops", 255));
                    GC.AddSend(Packets.NPCSetFace(N.Avatar));
                    GC.AddSend(Packets.NPCFinish());
                }
            }
]

there u go..
-Shunsui- is offline  
Thanks
1 User
Old 06/18/2010, 03:17   #4
 
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 50
Code:
                           
                                    if (Control == 1)
                                    {
                                        if (GC.MyChar.Job == 15)
                                        {
                                            if (GC.MyChar.CPs >= 2000000)
                                            {
                                                GC.MyChar.CPs -= 2000000;

                                                GC.MyChar.StatEff.Add(StatusEffectEn.TopTrojan);
                                                GC.Message(2005, GC.MyChar.Name + " has bought the Top Trojan Halo");
                                            }
                                            else
                                            {
                                                GC.AddSend(Packets.NPCSay("You can't buy glory with a purse like that."));
                                                GC.AddSend(Packets.NPCLink("Alright, guvna!", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                        else
                                        {
                                            GC.AddSend(Packets.NPCSay("Only Trojans can buy the Top Trojan Halo"));
                                            GC.AddSend(Packets.NPCLink("Oops", 255));
                                            GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            GC.AddSend(Packets.NPCFinish());
                                        }
                                    }
You had a bit of the CFC's (control-flow confusion). Hopefully in the future you'll be able to look for it yourself.

Edit: ****!


s.bat is offline  
Old 06/18/2010, 03:38   #5
 
elite*gold: 0
Join Date: Jun 2009
Posts: 143
Received Thanks: 155
Thanks guys, I'll never f*ck this kinda sh*t up ever again. I already have twice, now I get it lol
@s.bat
that's goin in my siggy rofll
Jay10291 is offline  
Old 06/18/2010, 06:43   #6
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,275
Just for future reference '||' means or and '&&' means and.
Arcо is offline  
Thanks
2 Users
Old 06/18/2010, 11:25   #7
 
elite*gold: 0
Join Date: May 2009
Posts: 162
Received Thanks: 26
maybe use

Code:
if (GC.MyChar.Job >= 10 && GC.MyChar.Job <= 15)
this is the check for all the trojan jobs


dodolinobobo is offline  
Reply



« Client update? | [Question] Source with Market Vending »

Similar Threads
B> DriftCity CBS Code | S> War Rock Code / Bounty Bay Code etc.
10/05/2010 - Trading - 1 Replies
Hi, wie schon im Titel beschrieben. In der CBS vom November gab es Bonusodes für mehrere Spiele. Ich benötige DriftCity Codes. Kann sonst für alle anderen Spiele die Codes biten, einige auch doppelt. Hier eine Liste der Spiele und Bonusaktionen: - (2x) War Rock - (2x) War of Titans - (2x) World of Warcraft - (1x) Warhammer Online - (1x) Bounty Bay online
Gebe Vip Hack Suche Storm Code oder 5k Dinar Code
07/25/2010 - WarRock Trading - 4 Replies
blubb
WTB: Japanischer/Chinesicher Guild Wars Trial-Code und EoTn Code
02/08/2010 - Guild Wars Trading - 5 Replies
Hallo, Wie schon oben in der beschreibung steht suche ich Japanischer/Chinesicher Trial-Code + EoTn oder die einzelnen Codes! Ich würde in Platin/Ektos/ZkeYs zahlen (allerdings nur mit Treuhandhändler), man weiss ja nie was einem Verkauft wird :P. Bitte so schnell wie möglich melden, wen einer es haben sollte.



All times are GMT +2. The time now is 13:55.


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

BTC: 3KeUpz52VCbhmLwuwydqxu6U1xsgbT8YT5
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

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