Hey you guys, I need help. =\
[Only registered and activated users can see links. Click Here To Register...]
I know that sounds lame but it's really hard for me and I've been trying for days.
My goal is to save a variable M and D to a character file in a folder called "example" (Like the Flower System's save system).
[Only registered and activated users can see links. Click Here To Register...]
This is what I have for the System's cs (located in Features called Example.cs):
CanGetX is referring to being able to obtain an item.
Then, I have this is the database:
Then I have it so that the player can go up to an NPC and set D and M.
When the character types something in as D or M, it sets it temporarily as:
GC.MyChar.Example.D = (number);
The problem is, I don't know how it will save it. :(
Please help =\
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
I know that sounds lame but it's really hard for me and I've been trying for days.
My goal is to save a variable M and D to a character file in a folder called "example" (Like the Flower System's save system).
[Only registered and activated users can see links. Click Here To Register...]
This is what I have for the System's cs (located in Features called Example.cs):
Code:
[COLOR="Blue"]using[/COLOR] System;
[COLOR="Blue"]using[/COLOR] System.Collections.Generic;
[COLOR="Blue"]using[/COLOR] System.Text;
[COLOR="Blue"]namespace[/COLOR] NewestCOServer
{
[COLOR="Blue"]public partial class[/COLOR] [COLOR="Teal"]Struct[/COLOR]
{
[COLOR="Blue"]public class[/COLOR] [COLOR="Teal"]Example[/COLOR]
{
[COLOR="Blue"]public int[/COLOR] D;
[COLOR="Blue"]public int[/COLOR] M;
[COLOR="Blue"]public int[/COLOR] CanGetX;
}
}
}
Then, I have this is the database:
Code:
[COLOR="Blue"]public static void[/COLOR] LoadExample([COLOR="Blue"]string[/COLOR] name)
{
[COLOR="Blue"]if [/COLOR]([COLOR="Teal"]File[/COLOR].Exists([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR]))
{
[COLOR="Teal"]FileStream[/COLOR] fs = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]FileStream[/COLOR]([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR], [COLOR="Teal"]FileMode[/COLOR].Open);
[COLOR="Teal"]BinaryReader[/COLOR] br = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]BinaryReader[/COLOR](fs);
[COLOR="Blue"]try[/COLOR]
{
Game.[COLOR="Teal"]Character[/COLOR] CC = [COLOR="Teal"]World[/COLOR].CharacterFromName(name);
CC.Example.M = br.ReadInt32();
CC.Example.D = br.ReadInt32();
CC.Example.CanGetX = br.ReadInt32();
fs.Flush();
br.Close();
fs.Close();
}
[COLOR="Blue"]catch[/COLOR] ([COLOR="Teal"]Exception[/COLOR] e) { [COLOR="Teal"]Console[/COLOR].WriteLine(e); }
}
}
[COLOR="Blue"]public static void[/COLOR] SaveExample([COLOR="Blue"]string[/COLOR] name)
{
[COLOR="Blue"]if [/COLOR]([COLOR="Teal"]File[/COLOR].Exists([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR]))
{
[COLOR="Teal"]FileStream[/COLOR] fs = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]FileStream[/COLOR]([COLOR="DarkRed"]@"C:\OldCODB\Example\"[/COLOR] + name + [COLOR="DarkRed"]".chr"[/COLOR], [COLOR="Teal"]FileMode[/COLOR].Open);
[COLOR="Teal"]BinaryReader[/COLOR] br = [COLOR="Blue"]new[/COLOR] [COLOR="Teal"]BinaryReader[/COLOR](fs);
[COLOR="Blue"]try[/COLOR]
{
Game.[COLOR="Teal"]Character[/COLOR] CC = [COLOR="Teal"]World[/COLOR].CharacterFromName(name);
bw.Write(CC.Example.M);
bw.Write(CC.Example.D);
bw.Write(CC.Example.CanGetX);
bw.Flush();
fs.Flush();
bw.Close();
fs.Close();
}
[COLOR="Blue"]catch[/COLOR] ([COLOR="Teal"]Exception[/COLOR] e) { [COLOR="Teal"]Console[/COLOR].WriteLine(e); }
}
}
When the character types something in as D or M, it sets it temporarily as:
GC.MyChar.Example.D = (number);
The problem is, I don't know how it will save it. :(
Please help =\
[Only registered and activated users can see links. Click Here To Register...]