Esempio n. 1
0
 public void SavePlayerRPName(Client player, string RPName)
 {
     using (var db = new DBContext())
     {
         if (player.HasData("character.Id"))
         {
             int CharacterId = player.GetData("character.Id");
             Database.Models.Character Character = db.Character.First(X => X.Id == CharacterId);
             Character.Name = RPName;
             db.SaveChanges();
         }
         else
         {
             API.ConsoleOutput(player.SocialClubName + " versucht SavePlayerRPName zu nutzen, hat aber keine Variable 'character.Id'");
         }
     }
 }
Esempio n. 2
0
 //Character erstellen
 public static void CreatePlayerCharacter(Client player, int pskin)
 {
     if (player.HasData("account.Id"))
     {
         int AccountID     = player.GetData("account.Id");
         var CharacterData = new Database.Models.Character()
         {
             AccountId          = AccountID,
             Name               = player.Name,
             HealthLevel        = 100,
             FoodLevel          = 100,
             DrinkLevel         = 100,
             DrunkLevel         = 0,
             CashMoney          = 100,
             BankMoney          = 0,
             Level              = 1,
             MinutesToNextLevel = 60,
             MinutesInThisLevel = 0,
             Jailed             = false,
             JailTime           = 0,
             LocationX          = -1040.907f,
             LocationY          = -2743.189f,
             LocationZ          = 13.94503f,
             Skin               = pskin,
         };
         using (var db = new DBContext())
         {
             db.Character.Add(CharacterData);
             player.SetData("character.Id", CharacterData.Id);
             db.SaveChanges();
         }
     }
     else
     {
         API.Shared.ConsoleOutput(player.SocialClubName + " versucht CreatePlayerCharacter zu nutzen, hat aber keine Variable 'account.Id'");
     }
 }