Register for your free account! | Forgot your password?

You last visited: Today at 02:59

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

Advertisement



[Release]Another lotto script

Discussion on [Release]Another lotto script within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old 06/12/2009, 03:10   #16
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
i have problem witch if i added in nano.cs
Quote:
public static List<Struct.PrizeInfo> Lottery = new List<Struct.PrizeInfo>();
Quote:
Error 1 The type name 'PrizeInfo' does not exist in the type 'CoEmu_v2_GameServer.Structs.Struct' D:\Documents and Settings\Mejo\Pulpit\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Nano.cs 44 35 CoEmu v2 GameServer
mejo33 is offline  
Old 06/12/2009, 15:22   #17

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Well I just put PrizeInfo beneath ItemInfo and it worked.

Code:
public class ItemInfo
		{
			public int UID;
			public int ItemID;
			public int Plus;
            public int Progress;
			public int Bless;
			public int Enchant;
			public int Soc1;
			public int Soc2;
			public int Dura;
			public int MaxDura;
			public int Position;
			public int Color = 4;
		}
        public class PrizeInfo
        {
            public int ItemID;
            public int Plus;
            public int Soc1;
            public int Soc2;
            public int Chance;
            public string Description;
            public int Message;    
        }
Kiyono is offline  
Thanks
1 User
Old 06/12/2009, 22:08   #18
 
mejo33's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 370
Received Thanks: 117
thanks
mejo33 is offline  
Old 06/29/2009, 14:29   #19
 
elite*gold: 0
Join Date: May 2008
Posts: 103
Received Thanks: 3
I HAVE 2 ERRORS
1-
Error 1 The name 'InventoryContains' does not exist in the current context \Handlers\NpcTalk.cs 3185 33 CoEmu v2 GameServer
2-
Error 2 The name 'ReturnUID' does not exist in the current context Handlers\NpcTalk.cs 3232 43 CoEmu v2 GameServer
m7med is offline  
Old 07/01/2009, 12:13   #20
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by m7med View Post
I HAVE 2 ERRORS
1-
Error 1 The name 'InventoryContains' does not exist in the current context \Handlers\NpcTalk.cs 3185 33 CoEmu v2 GameServer
2-
Error 2 The name 'ReturnUID' does not exist in the current context Handlers\NpcTalk.cs 3232 43 CoEmu v2 GameServer
Srry to bump a semi old thread but your problem is the lotto ticket. Most servers don't have lotto tickets anyways so the simple fix for that is to just remove those sections of code.


Thus making the npctalk section...


Code:
case 923:// Lady Luck enter
                    {
                        if (LinkBack == 0)
                        {
                          
                                Text("And I charge you only 27 CPs for each admission. Come on, Try your luck right now!", CSocket);
                                Link("Wow, good deal!", 1, CSocket);
                                Link("No Thanks!", 255, CSocket);
                                Face(30, CSocket);
                                End(CSocket);
                            
                        }
                        else if (LinkBack == 1)
                        {
                            if (CSocket.Client.Level >= 70)
                            {
                                if (CSocket.Client.CPs >= 27)
                                {
                                    CSocket.Client.LotteryBox = true;
                                    Teleport(700, 50, 50, 0, CSocket);
                                    CPs(-27, CSocket);
                                }
                                else
                                {
                                    Text("I'm sorry you do not have the required CPs.", CSocket);
                                    Link("Okay, I will be back when I have 27 CPs.", 255, CSocket);
                                    Face(30, CSocket);
                                    End(CSocket);
                                }
                            }
                            else
                            {
                                Text("I'm sorry you do not have the required Level 70.", CSocket);
                                Link("Okay, I will be back when I have level 70.", 255, CSocket);
                                Face(30, CSocket);
                                End(CSocket);
                            }
                        }

                        else
                        {
                            Text("I'm sorry you do not have the required Level 70.", CSocket);
                            Link("Okay, I will be back when I have level 70.", 255, CSocket);
                            Face(30, CSocket);
                            End(CSocket);
                        }
                        break;
                    }
                    case 924:
                    {
                        if (LinkBack == 0)
                        {
                            if (CSocket.Client.LotteryBox == true)
                            {
                                Text("Don't you want to pick a box?", CSocket);
                                Link("Well duh ofcourse I want.", 255, CSocket);
                                Face(20, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Want to leave?", CSocket);
                                Link("Yes", 1, CSocket);
                                Link("No", 255, CSocket);
                                Face(20, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 1)
                        {
                            Teleport(1036, 211, 196, 0, CSocket);
                        }
                        break;
                    }
                    case 925:
                    case 926:
                    case 927:
                    case 928:
                    case 929:
                    case 930:
                    case 931:
                    case 932:
                    case 933:
                    case 934:
                    case 935:
                    case 936:
                    case 937:
                    case 938:
                    case 939:
                    case 940:
                    case 942:
                    case 943:
                    case 944:
                    case 945:
                    {
                        int PriceIndex = Nano.Rand.Next(0, Nano.Lottery.Count - 1);

                        Structs.Struct.PrizeInfo Price = Nano.Lottery[PriceIndex];
                        if (CSocket.Client.LotteryBox == true)
                        {
                            CSocket.Client.LotteryBox = false;
                            if (Price.ItemID == 1)
                            {
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Too bad, you haven't won anything.", Struct.ChatType.Top));
                            }
                            else
                            {
                                List<Struct.ItemData> ItemData = new List<Struct.ItemData>();
                                foreach (KeyValuePair<int, Struct.ItemData> Items in Nano.Items)
                                    ItemData.Add(Items.Value);
                                string ItemName = Nano.Items[Price.ItemID].Name;
                                Struct.ItemInfo Item = new Struct.ItemInfo();
                                Item.Progress = Item.Bless = Item.Enchant = Item.Position = Item.Color = 0;
                                Item.Dura = 1;
                                Item.UID = Nano.Rand.Next(1, 9999999);
                                Item.ItemID = Price.ItemID;
                                Item.Plus = Price.Plus;
                                Item.Soc1 = Price.Soc1;
                                Item.Soc2 = Price.Soc2;
                                CSocket.Client.Inventory.Add(Item.UID, Item);
                                CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
                                Database.Database.NewItem(Item, CSocket);

                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have won a " + ItemName + ".", Struct.ChatType.Top));

                                if (Price.Message == 1)
                                {
                                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", CSocket.Client.Name + " is so lucky to win a(n) " + Price.Description + ItemName + ".", Struct.ChatType.Talk));
                                }
                            }
                        }
                        break;
                    }
Script is working for me now. Rates are REALLY high but I assume I can change that by adding stuff into database. I'll work on that latter.
pro4never is offline  
Old 07/13/2009, 20:51   #21
 
elite*gold: 0
Join Date: Jan 2008
Posts: 24
Received Thanks: 2
I can't find the NpcTalk.cs file =.=
Osiris123 is offline  
Old 07/14/2009, 06:36   #22
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 99
I got 4 errors at the end lol
Jay1029 is offline  
Old 07/27/2009, 01:27   #23
 
gawdin's Avatar
 
elite*gold: 0
Join Date: Mar 2007
Posts: 16
Received Thanks: 0
This is causing my server to close on me, how would i go about fixing it?
Code:
public static void GetPrizes()
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `lotteryitems`", DatabaseConnection.NewConnection());
            MySqlDataReader DR = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
            while (DR.Read())
            {
                Struct.PrizeInfo Item = new Struct.PrizeInfo();
                Item.ItemID = Convert.ToInt32(DR["ItemID"]);
                Item.Plus = Convert.ToInt32(DR["Plus"]);
                Item.Chance = Convert.ToInt32(DR["Chance"]);
                Item.Soc1 = Convert.ToInt32(DR["Soc1"]);
                Item.Soc2 = Convert.ToInt32(DR["Soc2"]);
                Item.Description = Convert.ToString(DR["Description"]);
                Item.Message = Convert.ToInt32(DR["Message"]);

                for (int i = 0; i < Item.Chance; i++)
                {
                    Nano.Lottery.Add(Item);
                }
            }
            Console.WriteLine("[GameServer] Loaded " + Nano.Lottery.Count + " lottery prizes from the DB.");
            DR.Close();
            Cmd.Dispose();
        }
Actually this is placed this in the wrong area, I currently had it under the [(public static void StartServer()] directly under [Struct.LoadTNpcs();] where should this be placed?
Code:
		Database.Database.GetPrizes();
gawdin is offline  
Old 12/17/2009, 15:38   #24
 
.Ryu's Avatar
 
elite*gold: 0
Join Date: Dec 2009
Posts: 583
Received Thanks: 119
@Elerlompoms #Reported thats not even on topic
That is so not cool dude...
.Ryu is offline  
Old 12/18/2009, 03:52   #25
 
Mjnorman's Avatar
 
elite*gold: 0
Join Date: Oct 2007
Posts: 83
Received Thanks: 13
Quote:
Originally Posted by Kiyono View Post
NPCTalk.cs:
Code:
case 923:// Lady Luck enter
                    {
                        if (LinkBack == 0)
                        {
                            if (InventoryContains(710212, 1, CSocket))
                            {
                                Text("I see that you have a lottery ticket, do you want to do the lottery in exchange for the ticket?", CSocket);
                                Link("Yes", 2, CSocket);
                                Link("No", 255, CSocket);
                                Face(30, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("And I charge you only 27 CPs for each admission. Come on, Try your luck right now!", CSocket);
                                Link("Wow, good deal!", 1, CSocket);
                                Link("No Thanks!", 255, CSocket);
                                Face(30, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 1)
                        {
                            if (CSocket.Client.Level >= 70)
                            {
                                if (CSocket.Client.CPs >= 27)
                                {
                                    CSocket.Client.LotteryBox = true;
                                    Teleport(700, 50, 50, 0, CSocket);
                                    CPs(-27, CSocket);
                                }
                                else
                                {
                                    Text("I'm sorry you do not have the required CPs.", CSocket);
                                    Link("Okay, I will be back when I have 27 CPs.", 255, CSocket);
                                    Face(30, CSocket);
                                    End(CSocket);
                                }
                            }
                            else
                            {
                                Text("I'm sorry you do not have the required Level 70.", CSocket);
                                Link("Okay, I will be back when I have level 70.", 255, CSocket);
                                Face(30, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 2)
                        {
                            if (CSocket.Client.Level >= 70)
                            {
                                int uid = ReturnUID(710212, CSocket);
                                CSocket.Client.Inventory.Remove(uid);
                                CSocket.Send(ConquerPacket.ItemUsage(uid, 255, Struct.ItemUsage.RemoveItem));
                                Database.Database.DeleteItem(uid);
                                CSocket.Client.LotteryBox = true;
                                Teleport(700, 50, 50, 0, CSocket);
                            }
                        }
                        else
                        {
                            Text("I'm sorry you do not have the required Level 70.", CSocket);
                            Link("Okay, I will be back when I have level 70.", 255, CSocket);
                            Face(30, CSocket);
                            End(CSocket);
                        }
                        break;
                    }
                case 924:
                    {
                        if (LinkBack == 0)
                        {
                            if (CSocket.Client.LotteryBox == true)
                            {
                                Text("Don't you want to pick a box?", CSocket);
                                Link("Well duh ofcourse I want.", 255, CSocket);
                                Face(20, CSocket);
                                End(CSocket);
                            }
                            else
                            {
                                Text("Want to leave?", CSocket);
                                Link("Yes", 1, CSocket);
                                Link("No", 255, CSocket);
                                Face(20, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 1)
                        {
                            Teleport(1036, 211, 196, 0, CSocket);
                        }
                        break;
                    }
                case 925:
                case 926:
                case 927:
                case 928:
                case 929:
                case 930:
                case 931:
                case 932:
                case 933:
                case 934:
                case 935:
                case 936:
                case 937:
                case 938:
                case 939:
                case 940:
                case 942:
                case 943:
                case 944:
                case 945:
                    {
                        int PriceIndex = Nano.Rand.Next(0, Nano.Lottery.Count - 1);

                        Structs.Struct.PrizeInfo Price = Nano.Lottery[PriceIndex];
                        if (CSocket.Client.LotteryBox == true)
                        {
                            CSocket.Client.LotteryBox = false;
                            if (Price.ItemID == 1)
                            {
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "Too bad, you haven't won anything.", Struct.ChatType.Top));
                            }
                            else
                            {
                                List<Struct.ItemData> ItemData = new List<Struct.ItemData>();
                                foreach (KeyValuePair<int, Struct.ItemData> Items in Nano.Items)
                                    ItemData.Add(Items.Value);
                                string ItemName = Nano.Items[Price.ItemID].Name;
                                Struct.ItemInfo Item = new Struct.ItemInfo();
                                Item.Progress = Item.Bless = Item.Enchant = Item.Position = Item.Color = 0;
                                Item.Dura = 1;
                                Item.UID = Nano.Rand.Next(1, 9999999);
                                Item.ItemID = Price.ItemID;
                                Item.Plus = Price.Plus;
                                Item.Soc1 = Price.Soc1;
                                Item.Soc2 = Price.Soc2;
                                CSocket.Client.Inventory.Add(Item.UID, Item);
                                CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, Item.Progress, Item.Bless, Item.Enchant, Item.Soc1, Item.Soc2, Item.Dura, Item.MaxDura, Item.Position, Item.Color));
Database.Database.NewItem(Item, CSocket);

                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "You have won a " + ItemName + ".", Struct.ChatType.Top));

                                if (Price.Message == 1)
                                {
                                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", CSocket.Client.Name + " is so lucky to win a(n) " + Price.Description + ItemName + ".", Struct.ChatType.Talk));
                                }
                            }
                        }
                    break;
            }
Character.cs
Code:
public bool LotteryBox = false;
Item.cs
Code:
public class PrizeInfo
        {
            public int ItemID;
            public int Plus;
            public int Soc1;
            public int Soc2;
            public int Chance;
            public string Description;
            public int Message;    
        }
Nano.cs
Code:
public static List<Struct.PrizeInfo> Lottery = new List<Struct.PrizeInfo>();
Then search for:
Code:
public static void StartServer()
And add:
Code:
Database.Database.GetPrizes();
DataBase.cs
Code:
public static void GetPrizes()
        {
            MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `lotteryitems`", DatabaseConnection.NewConnection());
            MySqlDataReader DR = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
            while (DR.Read())
            {
                Struct.PrizeInfo Item = new Struct.PrizeInfo();
                Item.ItemID = Convert.ToInt32(DR["ItemID"]);
                Item.Plus = Convert.ToInt32(DR["Plus"]);
                Item.Chance = Convert.ToInt32(DR["Chance"]);
                Item.Soc1 = Convert.ToInt32(DR["Soc1"]);
                Item.Soc2 = Convert.ToInt32(DR["Soc2"]);
                Item.Description = Convert.ToString(DR["Description"]);
                Item.Message = Convert.ToInt32(DR["Message"]);

                for (int i = 0; i < Item.Chance; i++)
                {
                    Nano.Lottery.Add(Item);
                }
            }
            Console.WriteLine("[GameServer] Loaded " + Nano.Lottery.Count + " lottery prizes from the DB.");
            DR.Close();
            Cmd.Dispose();
        }
Then just execute the SQl file to add the lotteryitems table.

Credits:
CoFuture Reloaded source by Future (leavemealone)


#Updated
#Updated
#Updated
#Bug fixed, items save now.
#New table, garments can be won.
#Probably the last update.
#Updated


nice release
Mjnorman is offline  
Old 03/31/2010, 20:27   #26
 
PuN|SheR's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 239
Received Thanks: 47
How to use this script?
PuN|SheR is offline  
Old 06/01/2010, 01:56   #27
 
masternek's Avatar
 
elite*gold: 0
Join Date: Dec 2006
Posts: 94
Received Thanks: 29
do u guys have any idea, on how to make like a quest guy, only give reward of the quest one time? cause in ym server, when ppl finish the quests, they can claim their prizes unlimited times x_x pls help..
masternek is offline  
Old 06/01/2010, 16:44   #28

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Quote:
Originally Posted by masternek View Post
do u guys have any idea, on how to make like a quest guy, only give reward of the quest one time? cause in ym server, when ppl finish the quests, they can claim their prizes unlimited times x_x pls help..
Just use a bool so that when they finish the quest that the bool turns to true and after they claimed the prize it changes to false.
Kiyono is offline  
Old 09/14/2010, 14:49   #29
 
salem rey's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
ahh... its good but the old script is still nice thanks anyway i like the thread coz its usefull..
salem rey is offline  
Reply


Similar Threads Similar Threads
[Release] Lotto
05/31/2009 - CO2 PServer Guides & Releases - 16 Replies
Koio did most of this code credits to him not me, also place this into NpcTalk.cs in CoEmu source. case 926://Lucky Box Coded by koio and alil by Epic-Chaos case 925: case 927: case 928: case 929: case 930:



All times are GMT +1. The time now is 03:01.


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