Exemple #1
0
        public Player(Client player, DataRow db)
        {
            // Used for drawing hud items -->
            API.setEntitySyncedData(player, "ESS_LoggedIn", true);
            // Setup Class Data.
            API.setEntityData(player, "Instance", this);
            PlayerClient  = player;
            Id            = Convert.ToInt32(db["ID"]);
            Bank          = Convert.ToInt32(db["Bank"]);
            Money         = Convert.ToInt32(db["Money"]);
            player.health = Convert.ToInt32(db["Health"]);
            player.armor  = Convert.ToInt32(db["Armor"]);
            player.name   = $"{db["Name"]}";
            IsAdmin       = Convert.ToBoolean(db["IsAdmin"]);
            API.setEntitySyncedData(PlayerClient, "ESS_Money", Money);
            LastPosition = new Vector3(Convert.ToSingle(db["X"]), Convert.ToSingle(db["Y"]), Convert.ToSingle(db["Z"]));
            // Don't move on until the players dimension is ready.

            // Make our player controllable again.
            API.freezePlayer(player, false);
            API.setEntityPosition(player, LastPosition);

            // Setup Player Vehicles
            createPlayerVehicles();

            // Setup Player Skin
            PlayerSkin = new Skin(player, this);
            PlayerSkin.loadPlayerFace();

            // Setup Player Clothing
            PlayerClothing = new Clothing(player, this);
            PlayerClothing.loadPlayerClothes();
            PlayerClothing.updatePlayerClothes();

            // Setup Player Inventory
            PlayerInventory = new Inventory(player, this);
            PlayerInventory.LoadInventory();

            // Set our entity dimension.
            API.setEntityDimension(player, 0);

            // Setup our anticheat info.
            AnticheatInfo       = Anticheat.addPlayer(player);
            AnticheatInfo.Model = player.model;

            // Login Console
            // Pass the login to the console.
            API.triggerClientEvent(player, "FinishLogin");
            API.consoleOutput($"{player.name} has logged in.");
        }