NPC Problem!

03/12/2011 17:27 F i n c h i#1
Well,I coded my own NPC for Hellmouth Source,that sells garments for 100k CPs.
But if someone try to buy garments,they can buy if there CPs is 0.
After they buy it,they get -100k CPs...
Whats wrong,why its going on - when they buy garments from NPC.
And yeah,they are getting the garment and the CPs decrease to -100k.
Help please!
Thanks!
03/12/2011 17:34 coreymills#2
but make sure u have a check to see that they have 100k cps or more
use something like if (Client.CP >= 100000)
03/12/2011 17:38 F i n c h i#3
I already tried to add:

Code:
if(Client.CP >= 100000);
But its not working
03/12/2011 17:40 coreymills#4
paste your code here
03/12/2011 17:44 F i n c h i#5
Here you go:

Code:
#region Garments Seller!
                    case 5577:
                        
                        if (Client.Permission < 1)
                            
                            return;
                        {
                            switch (LinkBack)
                            {
                                case 0:
                                    {
                                        Text("Hello " + Client.Name + " I Sell 10 Special Garments For Only 100.000 CPs!", Client);
                                        Link("I'll Buy Them!", 1, Client);
                                        Link("I Don't Care!", 255, Client);
                                        Finish(Client);

                                    }

                                    return;
                                case 1:
                                    
                                    
                                    {
                                        if (Client.Inventory.Count <= 40)
                                        {
                                            
                                            Client.CP -= 100000;

                                            Client.AddItem(183325, 0, 1, 10, 0, 0, 0); // DuskRomance
                                            Client.AddItem(183375, 0, 1, 10, 0, 0, 0); // CaribbeanPirate
                                            Client.AddItem(184305, 0, 1, 10, 0, 0, 0); // FatalAllure
                                            Client.AddItem(184315, 0, 1, 10, 0, 0, 0); // ChristmasCostume
                                            Client.AddItem(184325, 0, 1, 10, 0, 0, 0); // Evernight
                                            Client.AddItem(184375, 0, 1, 10, 0, 0, 0); // Spartan'sPride
                                            Client.AddItem(187305, 0, 1, 10, 0, 0, 0); // PekingGeneral
                                            Client.AddItem(191305, 0, 1, 10, 0, 0, 0); // GoodLuck
                                            Client.AddItem(191405, 0, 1, 10, 0, 0, 0); // DivineRobe
                                            Client.AddItem(181855, 0, 1, 10, 0, 0, 0); // DarkWizard
                                            

                                        }
                                        else
                                        {
                                            Text("Your Inventory Is Full Please Make More Room's!", Client);
                                        }

                                    
                                    }
                                    return;
                            }
                        }
                        return;
                    #endregion
03/12/2011 17:46 pro4never#6
Why does NO ONE use the external npc scripts?


Just do

if (Client.Inventory.Count < 40 && Client.CP > 10000)


you cannot have 41 items so you have that wrong also.
03/12/2011 17:53 F i n c h i#7
Quote:
Originally Posted by pro4never View Post
Why does NO ONE use the external npc scripts?


Just do

if (Client.Inventory.Count < 40 && Client.CP > 10000)


you cannot have 41 items so you have that wrong also.
Thanks,It worked now.

And I made like 4 NPCs with .npc , but this one I made it with C#.
03/12/2011 18:24 pro4never#8
No problem.

Also keep in mind you cannot do something like

Text("Your Inventory Is Full Please Make More Room's!", Client);


You need to finish that or else that text will show up with the next npc you click.
03/12/2011 18:36 F i n c h i#9
Quote:
Originally Posted by pro4never View Post
No problem.

Also keep in mind you cannot do something like

Text("Your Inventory Is Full Please Make More Room's!", Client);


You need to finish that or else that text will show up with the next npc you click.
Oh i got it,thanks again ^_^

Btw,the /addnpc command is so awesome,also the .npc scripting,cause you don't have to restart the server every time you are changing/adding something,or correct bugged NPCs xD
03/12/2011 23:55 .Kinshi#10
Quote:
Originally Posted by alexalx View Post
I already tried to add:

Code:
if(Client.CP >= 100000);
But its not working
I just want to point out why this wasn't working.
You ended your if statement with a ;
So the if statement would not affect what was below it.
03/13/2011 01:53 Yup Stigs#11
I love the python npcs..