$kylar Posted January 17, 2020 Share Posted January 17, 2020 Okay. So since there is no server - side implementation for C# AttachEntityToEntity() I'm told to do it in the client-side. However when I pass the arguments to my client-side with the TextLabel and Vehicle objects. I'm not sure how to attach them. TextLabel being attached to the Vehicle. I've used the class's .handle attribute the .Id attribute. But nothing seems to work. I'll provide the code for the respective sides. Server - side // Server Side // private static string VehTxtLblKey = "VehicleTextLabel"; [RemoteEvent("VehicleSpawnFromClient")] public void NativeVehSpawn(Client player, bool locked, bool engine, string vName) { uint vHash = NAPI.Util.GetHashKey(vName); Vehicle veh; veh = NAPI.Vehicle.CreateVehicle(vHash, player.Position.Around(5), 0.0f, 0, 0, locked: locked, engine: engine); TextLabel tLabel; tLabel = NAPI.TextLabel.CreateTextLabel($"[{vName}]", veh.Position, 15.0f, 1.5f, 1, new Color(0, 0, 255, 255), true); veh.SetSharedData(VehTxtLblKey, tLabel); NAPI.ClientEvent.TriggerClientEventForAll("AttachVehTxtLblForAll", VehTxtLblKey, veh); player.SendNotification($"You have created {vName}"); } // End of Server Side // Client - side public VehicleTextdraw() { Events.Add("AttachVehTxtLblForAll", VehTxtLblAll); } public void VehTxtLblAll(object [] args) { string tlKey = (string)args[0]; Vehicle veh = (Vehicle)args[1]; TextLabel tlLabel = (TextLabel)veh.GetSharedData(tlKey); if (!RAGE.Game.Entity.IsEntityAttachedToEntity(tlLabel.Id, veh.Id)) { Chat.Output($"Entity is being attached!"); RAGE.Game.Entity.AttachEntityToEntity(tlLabel.Id, veh.Id, 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0, false); } } If anyone could help me out here, then that'll be a huge help. 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