Smile325 Posted November 8, 2019 Share Posted November 8, 2019 Hey, I created some Checkpoints but every time the PlayerEnterCheckpoint event gives me the first created checkpoint. Example: Player enters checkpoint B the Event will be triggered but the checkpoint object that is given by the event is checkpoint A instead of checkpoint B. public static CheckpointEntity[] checkpointsData = { new CheckpointEntity("clothing1", "clothing", 40, 76.65756, -1389.369, 29.37615, 78.41908, -1391.735, 29.37615, 0.4f, 0), new CheckpointEntity("clothing2", "clothing", 40, -818.6889, -1072.886, 11.3281, -820.0386, -1075.353, 11.32811, 0.4f, 0), new CheckpointEntity("clothing3", "clothing", 40, -1193.171, -768.0584, 17.31864, -1184.503, -766.592, 17.32613, 0.4f, 0), new CheckpointEntity("clothing4", "clothing", 40, -163.4926, -303.1845, 39.73333, -164.7071, -298.638, 39.73327, 0.4f, 0), new CheckpointEntity("clothing5", "clothing", 40, 125.725, -223.8284, 54.55782, 119.1583, -229.6256, 54.55782, 0.4f, 0), new CheckpointEntity("clothing6", "clothing", 40, 424.6331, -809.7939, 29.49222, 422.7147, -807.2881, 29.49116, 0.4f, 0), new CheckpointEntity("clothing7", "clothing", 40, -710.0434, -152.7643, 37.41512, -705.4532, -154.6313, 37.41513, 0.4f, 0) }; public static Checkpoint[] checkpoints = new Checkpoint[checkpointsData.Length]; public static void SetCheckpoints() { for (int i = 0; i < checkpointsData.Length; i++) { double x = checkpointsData[i].positionX; double y = checkpointsData[i].positionY; double z = checkpointsData[i].positionZ; int checkpointType = checkpointsData[i].checkpointType; Vector3 position = new Vector3(x, y, z); float scale = 0.4f; uint dimension = 0; checkpoints[i] = NAPI.Checkpoint.CreateCheckpoint(checkpointType, position, new Vector3(0, 1, 0), scale, new Color(255, 0, 0), dimension); } } Thats the event method: [ServerEvent(Event.PlayerEnterCheckpoint)] public void OnPlayerEnterCheckpoint(Checkpoint checkpoint, Client player) { PlayerInfo playerInfo = Database.GetData<PlayerInfo>("username", player.Name); Vector3 pos = checkpoint.Position; NAPI.Chat.SendChatMessageToAll($"Player just entered the checkpoint at X{pos.X} Y{pos.Y} Z{pos.Z}"); //Vector3 position = Checkpoints.GetCheckpointExitPosition(checkpoint); //string spawn = JsonConvert.SerializeObject(position); //playerInfo.SetTemporaryPlayerSpawn(spawn); //SkinCreationEvents.SendToSkinCreator(player); } checkpoint.Position is always the first element in checkpointsData. Can anyone help me? Smile325 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now