Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 08:22

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

Advertisement



[Help] Could Somone Fix This code?..

Discussion on [Help] Could Somone Fix This code?.. within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2008
Posts: 20
Received Thanks: 2
[Help] Could Somone Fix This code?..

hmm Don't Flame im kinda learning.. yes i know its a simple npc.. just as i just stated im learning..


Quote:
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("If you pay me one dragonball, I can have your size changed. . "));
GC.AddSend(Packets.NPCLink("Here is a dragonball.", 2));
GC.AddSend(Packets.NPCLink("I have no dragonball.", 255));
GC.AddSend(Packets.NPCSetFace(30));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 1)
{
if (GC.MyChar.InventoryContains(1088000, 1))
{
for (byte i = 0; i < 1; i++)
GC.MyChar.RemoveItem(GC.MyChar.NextItem(1088000));
}
{

if (GC.MyChar.Body == 1004)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 1003)
GC.MyChar.Body += 1;
if (GC.MyChar.Body == 2002)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 2001)
GC.MyChar.Body += 1;



Missing somthing here?..=/


}
}


GC.AddSend(Packets.NPCSay("Sorry, you do not have a DragonBall."));
GC.AddSend(Packets.NPCLink("OK, I Know.", 255));
GC.AddSend(Packets.NPCSetFace(30));
GC.AddSend(Packets.NPCFinish());
{
break;

}


}
#endregion
rocka7x is offline  
Old 12/08/2009, 05:20   #2
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Quote:
GC.AddSend(Packets.NPCLink("Here is a dragonball.", 2));
Change the 2 to a 1
hunterman01 is offline  
Old 12/08/2009, 20:29   #3
 
~*NewDuuDe*~'s Avatar
 
elite*gold: 111
Join Date: Feb 2008
Posts: 2,161
Received Thanks: 646
Code:
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("If you pay me one dragonball, I can have your size changed."));
GC.AddSend(Packets.NPCLink("Here is a dragonball.", 1));
GC.AddSend(Packets.NPCLink("I do not have a dragonball.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 1)
{
if (GC.MyChar.InventoryContains(1088000, 1))
{
for (byte i = 0; i < 1; i++)
GC.MyChar.RemoveItem(GC.MyChar.NextItem(1088000));
{
if (GC.MyChar.Body == 1004)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 1003)
GC.MyChar.Body += 1;
if (GC.MyChar.Body == 2002)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 2001)
GC.MyChar.Body += 1;
}
else
{
GC.AddSend(Packets.NPCSay("Sorry, you do not have a DragonBall."));
GC.AddSend(Packets.NPCLink("OK, I Know.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
}
#endregion
This should work.
~*NewDuuDe*~ is offline  
Old 12/08/2009, 20:57   #4
 
elite*gold: 0
Join Date: Oct 2008
Posts: 20
Received Thanks: 2
Quote:
Originally Posted by BERGHUIS1 View Post
Code:
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("If you pay me one dragonball, I can have your size changed."));
GC.AddSend(Packets.NPCLink("Here is a dragonball.", 1));
GC.AddSend(Packets.NPCLink("I do not have a dragonball.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 1)
{
if (GC.MyChar.InventoryContains(1088000, 1))
{
for (byte i = 0; i < 1; i++)
GC.MyChar.RemoveItem(GC.MyChar.NextItem(1088000));
{
if (GC.MyChar.Body == 1004)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 1003)
GC.MyChar.Body += 1;
if (GC.MyChar.Body == 2002)
GC.MyChar.Body -= 1;
else if (GC.MyChar.Body == 2001)
GC.MyChar.Body += 1;
}
else
{
GC.AddSend(Packets.NPCSay("Sorry, you do not have a DragonBall."));
GC.AddSend(Packets.NPCLink("OK, I Know.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
}
#endregion
This should work.

still 1 error.. giveing invalic expression term 'else'

if i remove that it gives control cannot be followed through from one case label to another..
rocka7x is offline  
Old 12/08/2009, 21:14   #5
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by rocka7x View Post
still 1 error.. giveing invalic expression term 'else'

if i remove that it gives control cannot be followed through from one case label to another..
Check your barckets the eding ones seem messed up,
-Shunsui- is offline  
Old 12/09/2009, 10:50   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
As said it looks like your indentation is wrong (brackets)


So you know where you went wrong in the first one...


GC.AddSend(Packets.NPCLink("Here is a dragonball.", 2));

This line is saying that you are going to Control==2

In your code the actual code is 1...

You will want something structured like this

Code==0
{
initial npc text/options
}
Code==1
{
if inventory contains dragonball
{
remove db and do the actual code for changing sizes
{
else
{
no db option
}
}


That should be the indentation structure for it.


<edit>

At a second look you want to move the }'s up before the break.

Break indicated the END OF THE NPC You are not closing them in the order that they are opened. Think of each section of {} as a complete thought. Data is executed in the order they are opened so you need to close them in the same order. It will help if you look at them as saying "well this is starting this section of code... and here is where this section of code ends"" That will help you see them as unique symbols and see where you should be closing them.
pro4never is offline  
Old 12/09/2009, 14:55   #7
 
elite*gold: 0
Join Date: Oct 2008
Posts: 20
Received Thanks: 2
Quote:
Originally Posted by pro4never View Post
As said it looks like your indentation is wrong (brackets)


So you know where you went wrong in the first one...


GC.AddSend(Packets.NPCLink("Here is a dragonball.", 2));

This line is saying that you are going to Control==2

In your code the actual code is 1...

You will want something structured like this

Code==0
{
initial npc text/options
}
Code==1
{
if inventory contains dragonball
{
remove db and do the actual code for changing sizes
{
else
{
no db option
}
}


That should be the indentation structure for it.


<edit>

At a second look you want to move the }'s up before the break.

Break indicated the END OF THE NPC You are not closing them in the order that they are opened. Think of each section of {} as a complete thought. Data is executed in the order they are opened so you need to close them in the same order. It will help if you look at them as saying "well this is starting this section of code... and here is where this section of code ends"" That will help you see them as unique symbols and see where you should be closing them.
Thx ill try and sort it out
rocka7x is offline  
Old 12/09/2009, 15:47   #8
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
Quote:
if (Option == 0)
{
Text("Want to change size for a DB?");
Option("Sure",1);
Option("No thank you",255);
}
if (Option == 1)
{
if (InvContains(1088000))
{
if ((Body % 10) == 1 || (Body % 10) == 3)
Body++;
else
Body--;
Client.RemoveItem(1088000);
}
else
{
Text("You don't have a DB!");
Option("Okay",255);
}
}
Don't copy paste. Also remove your loop, what is it there for? Lol
_Emme_ is offline  
Reply


Similar Threads Similar Threads
Somone Can Help Me Please
03/12/2009 - Dekaron - 1 Replies
Hello I play 2Moons and I am not successful to understand how to operate any Hack someone please can bring me link to hack and detailed explanation how to operate Hack that can help me to kill monster more quickly Or which Hack that attracts\provoke the monsters to me Like in this short movie:click here Thank you in advance for all those who tries to help....
Somone Can Help Me Please
03/12/2009 - Dekaron - 3 Replies
Hello I play 2Moons and I am not successful to understand how to operate any Hack someone please can bring me link to hack and detailed explanation how to operate Hack that can help me to kill monster more quickly Or which Hack that attracts\provoke the monsters to me Like in this short movie:click here Thank you in advance for all those who tries to help....
Somone Can Help Me Please
03/12/2009 - Dekaron - 1 Replies
Hello I play 2Moons and I am not successful to understand how to operate any Hack someone please can bring me link to hack and detailed explanation how to operate Hack that can help me to kill monster more quickly Or which Hack that attracts\provoke the monsters to me Like in this short movie:click here Thank you in advance for all those who tries to help....
WILL SOMONE PLEASE HELP ME!
02/20/2009 - CO2 Private Server - 11 Replies
Well. I followed mutiple Guides. I follwoed the MSQL Guide. I try to log in it sas connection interrupted re login. I tried the Hamachi one. It said the same when it tried to log in. Please Help. I tried almost everything.I opened server and it said listeting. And said server stared sucessfully. Then i try to log in says connection interrupted please re-login HELP MEP LEASE I HAVE 18 PPL WAITING TO GO ON MY SERVER.



All times are GMT +2. The time now is 08:22.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.