Jump to content

  • Log In with Google      Sign In   
  • Create Account


mstriker

Member Since 26 Dec 2011
Offline Last Active Feb 17 2012 09:06 AM

Posts I've Made

In Topic: Inventory System

15 February 2012 - 04:17 PM

That is the problem, we are trying to script exchangable items. Include IDs, maybe car plates that you can craft into the cars or send them to a specialized place, basically if the player has another player's item, the other player won't have it back, if it's stolen the police will have to find out.

In Topic: Inventory System

15 February 2012 - 02:27 PM

How would we load the item if the player is offline though?

In Topic: Inventory System

15 February 2012 - 01:57 PM

Well i can help you with writing binary data in C#.

Let's say this is your item class that uses a string for the type of the item and a int for the player ID.

public class TheData
	{
		public string SomeName;
		public int SomeNumber;
	}

Here is a simple class i could serialize this data into xml and load it back in.

class Serializer
	{
		TheData data = new TheData();
		public Serializer(string theName, int theNumber)
		{
			data.SomeName = theName;
			data.SomeNumber = theNumber;
		}
		public void Save(string fileName)
		{
			Stream stream = File.Create(fileName);
			XmlSerializer serialize = new XmlSerializer(typeof(TheData));
			serialize.Serialize(stream, data);
			stream.Close();
		}
		public static TheData Load(string fileName)
		{
			Stream stream = File.OpenRead(fileName);
			XmlSerializer serialize = new XmlSerializer(typeof(TheData));
			return (TheData)serialize.Deserialize(stream);
		}
	}

Using these .net references in the serialization class.

using System.Xml;
using System.Xml.Serialization;


Thank you very much, I'll give that a try and see how I go.

In Topic: Inventory System

15 February 2012 - 12:53 PM

It's PAWN for San Andreas Multiplayer, it's kind of like C, but I am experienced on the language and If you guys talk to me in another language like C, C#, C++ I can script it into PAWN. I honestly just need the basics on what variables to use and what functions would be needed, specially in unique items like badges that can be changed (like, my name is deskoft, I can give deskoft's ID to another player, and he can fake being deskoft).

PARTNERS