Register for your free account! | Forgot your password?

You last visited: Today at 03:55

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

Advertisement



Vote NPC Problem.

Discussion on Vote NPC Problem. within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1

 
Novakhan's Avatar
 
elite*gold: 15
Join Date: Dec 2008
Posts: 332
Received Thanks: 137
Vote NPC Problem.

Well, I've been trying to make that npc works perfectly for hours but it doesn't.. If you click on Sure! it goes directly on Sorry but you already voted. Please wait 12 hours! without giving CPs neither opening the site. If someone can tell me what's wrong in the code, That'd help me^^

Thanks =)

Code:
                #region Vote npc
                case 4466:
                    {
                        switch (npcRequest.OptionID)
                        {
                            case 0:
                                {
                                    dialog.Text("Hi " + client.Entity.Name + "do you want to vote?");
                                    dialog.Option("Sure!", 1);
                                    dialog.Option("Maybe later", 255);
                                    dialog.Avatar(95);
                                    dialog.Send();
                                    break;
                                }
                            case 1:
                                {
                                    if (DateTime.Now.Hour == 12 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 24 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                    {
                                        client.Entity.ConquerPoints += 100000;
                                        client.Send(new Conquer_Online_Server.Network.GamePackets.Message("http://www.xtremetop100.com/in.php?site=1132310025", System.Drawing.Color.Yellow, 2105));
                                        Conquer_Online_Server.ServerBase.Kernel.SendWorldMessage(new Message("Congratulations! " + client.Entity.Name + " voted for BeastyCoV2 and got 100.000 CPs!", System.Drawing.Color.White, Message.Center), Conquer_Online_Server.ServerBase.Kernel.GamePool.Values);
                                        dialog.Text("Thanks for voting!");
                                        dialog.Option("You're welcome!", 255);
                                        dialog.Send();
                                        break;
                                    }
                                    else
                                    {
                                        dialog.Text("Sorry you already voted. Please wait 12 hours!");
                                        dialog.Option("My bad..", 255);

                                        dialog.Send();
                                    }
                                    break;
                                }
                        }
                        break;
                    }
                #endregion
Novakhan is offline  
Old 08/26/2012, 23:11   #2
 
U2_Caparzo's Avatar
 
elite*gold: 0
Join Date: Aug 2011
Posts: 314
Received Thanks: 90
u are checking if the time is exactly 12:00 with 0 seconds or 24:00 with 0 seconds, u got it? when u use the npc, and voted succesfully u save the DateTime in your database, so when u talk to the npc, the check must be
Code:
if(client.Entity.LastVote.AddHours(12) <= DateTime.Now)
{
      client.Send(new Conquer_Online_Server.Network.GamePackets.Message("http://www.xtremetop100.com/in.php?site=1132310025", System.Drawing.Color.Yellow, 2105));
      client.Entity.LastVote = DateTime.Now;
}
being LastVote a DateTime with the set and get properties
Code:
DateTime _LastVote
public DateTime LastVote
{
       get{return _LastVote;}
       set{Database.SaveVote(this);}
}
SaveVote voids to update the MySql database with "Entity" as param, and ofc reading the lastvote when loading the entity
that is the way i would do it at least
U2_Caparzo is offline  
Old 08/26/2012, 23:16   #3
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
Code:
DateTime.Now.Hour == 12 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 || DateTime.Now.Hour == 24 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00
Is totally wrong, this means you MUST vote/click npc at 12 pm/am
Just make a datetime variable like lastvote, not so hard.
diedwarrior is offline  
Reply


Similar Threads Similar Threads
Vote Script Problem!
07/05/2012 - Metin2 Private Server - 4 Replies
Hii Leute habe Problem mit Vote4Coins Script Bitte sagt mir wo der Fehler liegt. vote.php <font color="white"> <? if(isset($_SESSION) && checkInt($_SESSION) && $_SESSION>=0) { /*
vote 4 coins problem
04/13/2012 - Metin2 Private Server - 2 Replies
also ich hab das vote 4 coins system einbauen wollen. ich habe es shcon mal soweit geschaft des der vote button erscheint, aber beim klicken des button kommen dann zwei fehler ich weiß schon mal das diese meinen das in den zeilen 98 und 106 fehler sind, aber ich kenne mich mit dem vote 4 coins script nich aus also könnt ihr mir helfen? hier die 2 zeilen: 98:
Problem mit VOTE Button PLS HELP
04/22/2011 - Metin2 Private Server - 0 Replies
Hey Leute wollte den Vote Button auf meiner Baukasten hp machen. aber i-wie geht das nicht ich hab ein CSS design das Ultimate liegts vllt daran? wäre echt nett von euch wenn ihr mir helfen könnt.



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


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.