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 @_@

#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?

#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.

#94
In OnPlayerDamaged:
Code:
try { Points[Attacker.XUID] = (((int)Points[Attacker.XUID]) + 100); StreamWriter writer = new StreamWriter("C:\\Mw3\\shop\\" + Attacker.XUID + ".txt"); int points = (int)Points[Attacker.XUID]; writer.WriteLine(Attacker.XUID + "=" + points.ToString()); writer.Dispose(); writer.Close(); }
In OnPlayerConnect
Code:
try { StreamReader reader = new StreamReader("C:\\Mw3\\shop\\" + Client.XUID + ".txt"); string read = reader.ReadLine(); string read2 = read; string[] readArray = read2.Split('='); Points[Client.XUID] = int.Parse(readArray[1]); }

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.

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

#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]

#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

#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]

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

(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]



Possibly Related Threads…
Thread Author Replies Views Last Post
Tongue [Release] MW3 Shop plugin Dude 56 51,537 03-25-2018, 05:18
Last Post: [email protected]
Rainbow [Release] Moonlight Shop Nekochan 71 64,651 03-23-2018, 14:15
Last Post: Karesz12345678
  Add a point shop to my server h1dexyz 1 4,382 03-04-2018, 22:36
Last Post: h1dexyz
Lightbulb Preview Weapon Classe For Infected Clasic Server groochu1982 0 3,499 02-19-2017, 08:35
Last Post: groochu1982
  [Release] Custom Shop SgtLegend 1 5,010 06-16-2016, 18:57
Last Post: abidullah
Rainbow NEW SHOP BY QwerTTy DiGGiTPro 17 14,883 01-08-2015, 12:04
Last Post: zhorakrnev
Thumbs Up [Release] AllInOne! for infected robinvm 4 6,651 10-19-2013, 20:00
Last Post: Casper
  [Release] AntiRage for Infected Game Mode yokai134 17 20,029 08-04-2013, 22:22
Last Post: yokai134
Its My Birthday! [Release] Juggernaut plugin for infected koro35 30 22,185 03-01-2013, 13:01
Last Post: hillbilly

Forum Jump:


Users browsing this thread:
1 Guest(s)

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