Register for your free account! | Forgot your password?

You last visited: Today at 23:08

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

Advertisement



Redux V2 Code Releases

Discussion on Redux V2 Code Releases within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
patcac-patcac's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 30
Received Thanks: 18
Post Redux V3 Code Releases

Thought id release a few codes i wrote for redux when i was playing around.

(Command) Make GM


(Command) Ban Player


(Command) Unban Player


(Command) Reborn



(Monster) CP's Drop


(Monster) Random CP's Drop


(Monster) Drop Items to inventory


More will come soon if you have a cool codes post it here ill include it in the post lets make a redux code thread
patcac-patcac is offline  
Thanks
4 Users
Old 08/21/2016, 11:10   #2
 
m e n a's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 137
Received Thanks: 58
You should've posted something like fixing some issues, or adding something that everyone would find it useful.

But at least you're trying, keep it up man just focus in adding/fixing.

And why you're using Redux V2?!
m e n a is offline  
Old 08/21/2016, 12:48   #3
 
patcac-patcac's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 30
Received Thanks: 18
#Would love it if a mod could fix the title please i made a mistake its V3 thanks in advance
patcac-patcac is offline  
Old 08/30/2016, 19:49   #4
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
For the random CPs from monsters.
Code:
       Random rnd = new Random();
                int Valcp = rnd.Next(1, 100);
                killer.CP += ConvVal;
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
                killer.Save()

You can just typecast ConvVal to to a uint.

killer.CP += (uint) ConvVal;

Instead of converting it to a uint. Just a friendly tip.

Keep on working on programming. Though this release may seem minimal to some, it's a start on the path to learning.
InsomniacPro is offline  
Old 08/31/2016, 08:34   #5
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Quote:
Originally Posted by InsomniacPro View Post
For the random CPs from monsters.
Code:
       Random rnd = new Random();
                int Valcp = rnd.Next(1, 100);
                killer.CP += ConvVal;
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
                killer.Save()

You can just typecast ConvVal to to a uint.

killer.CP += (uint) ConvVal;

Instead of converting it to a uint. Just a friendly tip.

Keep on working on programming. Though this release may seem minimal to some, it's a start on the path to learning.
And here are some more tips.
Code:
                Random rnd = new Random();
This is a very bad idea. The random generator in C# is horrible and using it like this will most likely produce invalid values and in worst cases the same value over and over.

Instead provide a static thread local random generator.

Code:
                int Valcp = rnd.Next(1, 100);
You can use var.

Code:
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
Interpolated strings anyone?

Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
Super Aids is offline  
Old 08/31/2016, 09:17   #6
 
elite*gold: 0
Join Date: Jul 2016
Posts: 79
Received Thanks: 22
Quote:
Originally Posted by Super Aids View Post
Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
"Why the **** is setting this integer crashing my ******* server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my **** because I changed the table structure. Wow do C# properties suck ***." Just another horrible Microsoftism.
SuperDaft is offline  
Old 08/31/2016, 10:36   #7


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Quote:
Originally Posted by SuperDaft View Post
"Why the **** is setting this integer crashing my ******* server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my **** because I changed the table structure. Wow do C# properties suck ***." Just another horrible Microsoftism.
What? Are you for real? I cannot decide if you're a bot or a troll.
KraHen is offline  
Old 08/31/2016, 11:01   #8
 
patcac-patcac's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 30
Received Thanks: 18
Quote:
Originally Posted by Super Aids View Post
And here are some more tips.
Code:
                Random rnd = new Random();
This is a very bad idea. The random generator in C# is horrible and using it like this will most likely produce invalid values and in worst cases the same value over and over.

Instead provide a static thread local random generator.

Code:
                int Valcp = rnd.Next(1, 100);
You can use var.

Code:
                killer.SendSysMessage("You have gotten " + ConvVal + " cps from monster kill");
Interpolated strings anyone?

Code:
                killer.Save()
Why is this not a part of the Killer.CP property?
the killer.save(); method is needed cause it will note save the cps to the database i tested before i used it dont worry xD, without it it will only save when the player exits so if the server crashes players cps will roll back also the random value will never produce an invalid value ! it will only produce values between 1 and 100 . Thanks for the post
patcac-patcac is offline  
Old 08/31/2016, 15:24   #9
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Quote:
Originally Posted by SuperDaft View Post
"Why the fuck is setting this integer crashing my fucking server?! Oh, it's not. This is a property that the debugger skips over, and it's actually the database save method crashing my shit because I changed the table structure. Wow do C# properties suck ass." Just another horrible Microsoftism.
"Why the fuck is my database not updating with character information?! Oh, it's because I didn't make one billion manual calls to a database save that could have saved me tons of time debugging as well by having them in a property call."

Moron.

#Edit

On a side note. You're a shitty Go programmer anyway, so you don't know how to do anything remotely logical and smart anyway.

Quote:
Originally Posted by patcac-patcac View Post
the killer.save(); method is needed cause it will note save the cps to the database i tested before i used it dont worry xD, without it it will only save when the player exits so if the server crashes players cps will roll back also the random value will never produce an invalid value ! it will only produce values between 1 and 100 . Thanks for the post
What I'm saying is that you should put it in the property so you don't need to call it.
Super Aids is offline  
Old 08/31/2016, 17:41   #10
 
elite*gold: 0
Join Date: Jul 2014
Posts: 402
Received Thanks: 540
... why would you even want to save stuff to the database EVERY time some property of a player changes? That's pretty bad, at least if you actually care about, you know, like performance and stuff.
Best Coder 2014 is offline  
Thanks
1 User
Old 08/31/2016, 17:54   #11
 
elite*gold: 0
Join Date: Jul 2016
Posts: 79
Received Thanks: 22
Quote:
Originally Posted by KraHen View Post
What? Are you for real? I cannot decide if you're a bot or a troll.
I'm not into my programs doing things that even the debugger can't follow. Seems like a very bad practice or poor abstraction, almost like there's better design / software architecture out there than abstraction. Overloaded operators are in the same category.
SuperDaft is offline  
Old 08/31/2016, 18:24   #12
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Quote:
Originally Posted by SuperDaft View Post
I'm not into my programs doing things that even the debugger can't follow.
nTL3fTy is offline  
Old 08/31/2016, 18:34   #13
 
elite*gold: 0
Join Date: Jul 2016
Posts: 79
Received Thanks: 22
Quote:
Originally Posted by nTL3fTy View Post
Which is on by default, and still no. I'm not a fan of over abstraction, especially when there are better ways to design characters and saving.
SuperDaft is offline  
Old 08/31/2016, 23:53   #14
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Quote:
Originally Posted by Best Coder 2014 View Post
... why would you even want to save stuff to the database EVERY time some property of a player changes? That's pretty bad, at least if you actually care about, you know, like performance and stuff.
No you want to bulk the records to insert/update, then perform them all at once to save performance, as well database speed.

But really it depends on what you want to achieve and how critical it is for you to have data loss.

Sometimes it may be better to sacrifice a little performance, over having critical data loss or possible bugs.

Also databases should be able to handle such type of updates anyway, if it gives you a significant performance loss, then the problem may lie somewhere else.
Super Aids is offline  
Thanks
2 Users
Old 12/19/2017, 12:21   #15
 
elite*gold: 0
Join Date: Nov 2014
Posts: 13
Received Thanks: 2
I think that you need to remove the killer.Save() after every kill. True it saves you from the server doing a rollback, but just do a main daily. If 30 archers are hunting monsters, each of them will kill 20,000-50,000 monsters(at least) in an hour, that is 3,500,000 saves. Also I think on every big scatter, he is going to spike a bit. I have tried this on a Redux code a few months back, if you save that many times that fast, the killer will lag as hell.
puzzleop is offline  
Reply




All times are GMT +1. The time now is 23:08.


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.