DataStore

Mar 24, 2016
DataStore
  • Methods:
    Code (C#):
    ToIni(String InifileName = "DataStore"):bool
    Add(String TableName, object Key, object Value):void
    ContainsKey(String TableName, object Key):bool
    ContainsValue(String TableName, object Value):bool
    Count(String TableName):int
    Flush(String TableName):void
    Get(String TableName, object Key):object
    GetTable(String TableName):Hashtable
    Keys(String TableName):object[]
    Load():void
    Remove(String TableName, object Key):void
    Save():void
    Values(String TableName):object[]
     
    Example:
    Code (Python):
    def On_Command(self, Player, cmd, args):
            if cmd == "prokit":
                    if DataStore.ContainsKey("Kit", Player.SteamID):
                            Player.Message("You already used this kit!")
                            return
                    DataStore.Add("Kit", Player.SteamID, 1)
                    Player.Message("Used Kit!")
    Code (Javascript):
    function On_Command(Player, cmd, args) {
            if (cmd == "prokit") {
                    if (DataStore.ContainsKey("Kit", Player.SteamID)) {
                            Player.Message("You already used this kit!");
                            return;
                    }
                    DataStore.Add("Kit", Player.SteamID, 1);
                    Player.Message("Used Kit!");
            }
    }