Thread Rating:
  • 8 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Shop system for Infected gametype
#91
Hash tables are stored in memory, once plugin is closed, it cleans up all memory used by that plugin. Therefore, restarting the server will close it, clean up memory used by it, then when restarted it will allocate new memory space for a new hash table.

As pointed above a SQL database is the way to go when it comes to tracking players, points, chat, kills, connections, etc. This way its never deleted upon server restarts, the only bad thing you have to worry about is if the database becomes corrupted, hence why you dump it every day or so, then upload it off site or to another drive.

Someone said about writing files and reading them which would work as well but a database offers a much more organized view of the data if done correctly. Although you have to be careful with SQL databases and make sure you escape " ' " (apostrophes) correctly or someone can SQL inject your database and cause some havoc @_@
Reply

#92
(12-24-2012, 23:47)yokai134 Wrote: Hash tables are stored in memory, once plugin is closed, it cleans up all memory used by that plugin. Therefore, restarting the server will close it, clean up memory used by it, then when restarted it will allocate new memory space for a new hash table.

As pointed above a SQL database is the way to go when it comes to tracking players, points, chat, kills, connections, etc. This way its never deleted upon server restarts, the only bad thing you have to worry about is if the database becomes corrupted, hence why you dump it every day or so, then upload it off site or to another drive.

Someone said about writing files and reading them which would work as well but a database offers a much more organized view of the data if done correctly. Although you have to be careful with SQL databases and make sure you escape " ' " (apostrophes) correctly or someone can SQL inject your database and cause some havoc @_@
How to find a SQL database to shop mod?
Reply

#93
Currently on these forums there aren't any zombie mod plugins that have a database backbone, the few on here are reliant on hash tables or files.
Reply

#94
In OnPlayerDamaged:
CSHARP Code
  1. try
  2. {
  3. Points[Attacker.XUID] = (((int)Points[Attacker.XUID]) + 100);
  4.  
  5. StreamWriter writer = new StreamWriter("C:\\Mw3\\shop\\" + Attacker.XUID + ".txt");
  6.  
  7. int points = (int)Points[Attacker.XUID];
  8.  
  9. writer.WriteLine(Attacker.XUID + "=" + points.ToString());
  10. writer.Dispose();
  11. writer.Close();
  12. }

In OnPlayerConnect
CSHARP Code
  1. try
  2. {
  3. StreamReader reader = new StreamReader("C:\\Mw3\\shop\\" + Client.XUID + ".txt");
  4.  
  5. string read = reader.ReadLine();
  6. string read2 = read;
  7.  
  8. string[] readArray = read2.Split('=');
  9. Points[Client.XUID] = int.Parse(readArray[1]);
  10. }


I think I release the code because many people want the point saving stuff. This will create a .txt file for every player who got points and it's updating it every kill. It will read the file OnPlayerConnect and add the points. It isn't as good as a SQL database but it's working pretty good.
Reply

#95
Depending on how popular your server becomes that will create thousands of files @_@
Reply

#96
That's why you normally use a SQL-DB

Again for a quick usage guide see my Source code from EpicZombie Mod
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#97
How I said it isn't as good as a SQL DB but it's working and 1 file is like 1kb so even if you get over a thousand file it isn't that big
Reply

#98
(12-27-2012, 21:55)yokai134 Wrote: Depending on how popular your server becomes that will create thousands of files @_@

I like it, offcourse it isn't the best, that's why I will try to make later with a SQL database.
I'm very happy about hes release Smile
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#99
Can Admins give Players Points with a command like add <Points> name?
Reply

(01-04-2013, 18:17)Hallla Wrote: Can Admins give Players Points with a command like add <Points> name?

Yes It's possible you need to code it :p
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up [Release] AllInOne! for infected robinvm 4 4,740 10-19-2013, 20:00
Last Post: Casper
  Infected Stuff is semi broken DidUknowiPwn 2 3,456 09-21-2013, 20:22
Last Post: surtek
  [Request] no ammo for infected gamemode ExoGamer* 8 5,547 08-15-2013, 18:59
Last Post: Dr3am95
  [Release] AntiRage for Infected Game Mode yokai134 17 14,243 08-04-2013, 22:22
Last Post: yokai134
Question Help Upgrade my point system from files to Database, help? EnVi Sweden Rocks 11 9,422 08-03-2013, 23:31
Last Post: EnVi Sweden Rocks
  Shop Database Hallla 5 4,798 07-23-2013, 07:33
Last Post: xfxtroll
  [Request] Login / Register System? South2AKA 5 5,036 07-17-2013, 13:50
Last Post: surtek
  [Tutorial] Custom gametype HUD iAegle 17 15,343 07-14-2013, 01:16
Last Post: Nekochan
  mw3 infected game restarts SniperViper 1 2,264 05-18-2013, 11:37
Last Post: hillbilly
  Help prefix doesnt work with shop koro35 2 2,882 05-18-2013, 10:51
Last Post: koro35

Forum Jump:


Users browsing this thread:
4 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.