adiq888 Posted November 26, 2019 Share Posted November 26, 2019 (edited) Hi everyone I'd like to know how I can assign to a variable vehicles created by the NAPI.Vehicle.CreateVehicle function in c # public int[] Vehicle = new int[4]; [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("Twoj projekt Rage zostal pomyslnie zaladowany!"); Vehicle[0] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-418.4451, 1211.138, 325.4577), 235.3172f, 1, 1); Vehicle[1] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-419.3018, 1207.183, 325.4566), 235.3172f, 1, 1); Vehicle[2] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-420.7397, 1202.853, 325.4572), 235.3172f, 1, 1); Vehicle[3] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-421.3993, 1198.118, 325.4573), 235.3172f, 1, 1); } how to do it ? Edited November 26, 2019 by adiq888 Link to comment Share on other sites More sharing options...
Smileey Posted November 27, 2019 Share Posted November 27, 2019 public Vehicle[] veh = new Vehicle[4]; [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("Twoj projekt Rage zostal pomyslnie zaladowany!"); veh[0] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-418.4451, 1211.138, 325.4577), 235.3172f, 1, 1); veh[1] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-419.3018, 1207.183, 325.4566), 235.3172f, 1, 1); veh[2] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-420.7397, 1202.853, 325.4572), 235.3172f, 1, 1); veh[3] = NAPI.Vehicle.CreateVehicle(-1346687836, new Vector3(-421.3993, 1198.118, 325.4573), 235.3172f, 1, 1); } Link to comment Share on other sites More sharing options...
adiq888 Posted November 28, 2019 Author Share Posted November 28, 2019 [ServerEvent(Event.PlayerEnterVehicle)] void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seatID) { if (vehicle == veh[0]) { NAPI.Chat.SendChatMessageToPlayer(player, "To jest pojazd kuriera!"); } } after executing this code the server will crash Link to comment Share on other sites More sharing options...
Xabi Posted November 28, 2019 Share Posted November 28, 2019 3 hours ago, adiq888 said: [ServerEvent(Event.PlayerEnterVehicle)] void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seatID) { if (vehicle == veh[0]) { NAPI.Chat.SendChatMessageToPlayer(player, "To jest pojazd kuriera!"); } } after executing this code the server will crash And what's the exception? Link to comment Share on other sites More sharing options...
adiq888 Posted November 29, 2019 Author Share Posted November 29, 2019 22 hours ago, Xabi said: And what's the exception? I'm sorry but I don't understand you 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