Register for your free account! | Forgot your password?

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

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

Advertisement



Conquer Online Daily CP NPC

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

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2011
Posts: 24
Received Thanks: 0
Conquer Online Daily CP NPC

Ok so I want to make an NPC that gves 1000 CP's once a day. Right now you have to relog and you can keep getting more.. Any idea's?
Sythen is offline  
Old 06/27/2011, 01:05   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,383
Create a character variable for when it was last claimed and save/load it from database. Now when using the npc check if last claim > 24 hours before now.
pro4never is offline  
Thanks
1 User
Old 06/28/2011, 03:59   #3
 
elite*gold: 0
Join Date: May 2011
Posts: 168
Received Thanks: 33
This may be a stupid question, or I may be correct, but doesn't a bool = true/false reset after 24 hours?

If you got your free CP's, you can put GotCPS = true;, then after 24 hours it will go back to being false?

This will work right? Probably isn't the right way to do it though:
Code:
 public void iDay()
        {
            if (CPSToday == true)
            {
                for (int i = 1; i <= 86400; i++)
                {
                    Thread.Sleep(1000);
                }
                CPSToday = false;
            }
        }
zTek is offline  
Old 06/28/2011, 11:47   #4
 
{ Angelius }'s Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
a bool goes back to its default value every time you restart the server/create a new instance of the client class
IE.

public class client
{
public bool CPSToday = true;
}

every time you create a new instance of the client class the CPSToday well be true;

public bool CPSToday;// default well be false
or like this
public bool CPSToday = false;// default well be false

so in your case you need to save that bool some how depending on what you are using to save the client info flat files/mysql/etc and forget about the thread.sleep thing..

if you think about it 100 ppl claimed the free cps today = a new 100 working thread working for the next 24 hours, and thats gonna kill your server slowly Plus if the client loaged out and came back he'll be able to claim it again ,

so the best thing is to save that bool and reload it when the player goes online again .
Quote:
goes to your client/Character class
Quote:
privet bool _CPSToday;
Code:
 public bool CPSToday()
{
get { return  _CPSToday; }
set { _CPSToday = value;// DataBase.UpdateClient("Raw", value, this); }
}
now get is gonna return weather the privet bool is = false/true;
set is gonna set the privet bool to false/true

to save it lets say you are using mysql all you need is a small sql update command and a 1 more raw added to your database table . take a look at any of the save/load voids that you have in your source and you'll find out how to save it /load it .

for me thats how the updateClient void works .
Quote:
public static void UpdateClient(string Column, bool Value, Character Client)
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
cmd.Update("Entity");
cmd.Set(Column, Value);
cmd.Where("UID", Client.UID);
HookUp.QueueCommand(cmd);
}
the cmd.Set(Column, Value); sets the value true to 1 and the value false to 0 and up on login it reads the 1 as true and the 0 as false

Good Luck .
{ Angelius } is offline  
Thanks
1 User
Reply

Tags
conquer, conquer online, cps, daily, npc


Similar Threads Similar Threads
Conquer Online Daily NPC
06/26/2011 - General Gaming Discussion - 1 Replies
Ok so I want to make an NPC that gves 1000 CP's once a day. Right now you have to relog and you can keep getting more.. Any idea's?



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


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

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