unknown modder Posted June 18, 2015 Share Posted June 18, 2015 Anyone know why this does not return an entity when i aim at anything? Dim ent As Entity = World.Raycast(Game.Player.Character.Position, Game.Player.GetTargetedEntity.Position, IntersectOptions.Everything).HitEntity What are you trying to achieve with that? It's a ray-tracer, it should draw an invisible line and detect which entity it hits on the second vector and get the details of that HitEntity It would be useful in figuring out where you're aiming or what entity you're aiming at because i don't see a function to "get aimed entity" nothing works..... What we need is a "get aimed weapon raytrace".... that so that we can get all the details of anything when we point at something with our guns. Rock* did it at the beginning of the game with those bank vault guards detecting if the player is aiming at them... I know what ray tracers are, I put that class in the scripthook. I was more saying why are you creating a ray from your player to the entity your player is targetting, GetTargetedEntity will return that for you, or with natives you can use _GET_AIMED_ENTITY (Slightly different to targetted entity OutputArgument AimedEntity = new OutputArgument();Entity entity;if (Native.Function.Call<bool>(Native.Hash._GET_AIMED_ENTITY, Game.Player, AimedEntity)){ int Handle = AimedEntity.GetResult<int>(); switch Native.Function.Call<int>(Native.Hash.GET_ENTITY_TYPE, Handle) { case 1: entity = new Ped(Handle); break; case 2: entity = new Vehicle(Handle); break; case 3: entity = new Prop(Handle); break; } //Do stuff with entity} To use ray tracers its best to use the gameplay camera direction Link to comment Share on other sites More sharing options...
Enumerator Posted June 18, 2015 Share Posted June 18, 2015 (edited) To use ray tracers its best to use the gameplay camera direction ''Get Aimed Entity Dim entity As Entity Dim AimedEntity As OutputArgument = New OutputArgument() If Native.Function.Call(Of Boolean)(Native.Hash._GET_AIMED_ENTITY, Game.Player, AimedEntity) Then Dim Handle As Integer = AimedEntity.GetResult(Of Integer)() Select Case Native.Function.Call(Of Integer)(Native.Hash.GET_ENTITY_TYPE, Handle) Case 1 : entity = New Ped(Handle) : Aimed_Entity_Ped(entity) Case 2 : entity = New Vehicle(Handle) : Aimed_Entity_Vehicle(entity) Case 3 : entity = New Prop(Handle) : Aimed_Entity_Prop(entity) Case Else End Select End If Nice one thanks (Converted to VB) I'm passing the entity to their own private subs just for clarification of the above code Edited June 18, 2015 by Enumerator Link to comment Share on other sites More sharing options...
Enumerator Posted June 18, 2015 Share Posted June 18, 2015 (edited) It seems like most of the functions dont even work Native.Function.Call(Of Boolean)(Native.Hash.HAS_ENTITY_BEEN_DAMAGED_BY_ENTITY, Game.Player, aimed_entity, True) Does not return anything.. Edited June 19, 2015 by Enumerator Link to comment Share on other sites More sharing options...
whorse Posted June 20, 2015 Share Posted June 20, 2015 Why is it that updating Script Hook V .NET breaks compatibility with so many of the mods made for the previous versions?. I wanted to try out the Just Cause grappling hook mod and it said I needed to download the new version of scripthookV.net. Now that mod works and Noclip still works, but like 6 other scripts stopped working. The log says things like the scripts were using bad references and bad constructors, but didn't those references used to work? I'm guessing you guys wanted to clean up the code and removed some depreciated stuff that came from older versions? Why can't you just leave the depreciated code in there somewhere, to be used ONLY in the case that an older script requests it? I mean just for the sake of backwards compatibility (which is IMO something that's extremely important for any form of software). I know I'm just talking out of my ass, since I don't really know how to code at all, but isn't there some way you can implement backwards compatibility to .net scripthook? A ton of good scripts are just added once and the author vanishes forever, and you can only use them with one version of scripthook.net Link to comment Share on other sites More sharing options...
unknown modder Posted June 20, 2015 Share Posted June 20, 2015 Why is it that updating Script Hook V .NET breaks compatibility with so many of the mods made for the previous versions?. I wanted to try out the Just Cause grappling hook mod and it said I needed to download the new version of scripthookV.net. Now that mod works and Noclip still works, but like 6 other scripts stopped working. The log says things like the scripts were using bad references and bad constructors, but didn't those references used to work? I'm guessing you guys wanted to clean up the code and removed some depreciated stuff that came from older versions? Why can't you just leave the depreciated code in there somewhere, to be used ONLY in the case that an older script requests it? I mean just for the sake of backwards compatibility (which is IMO something that's extremely important for any form of software). I know I'm just talking out of my ass, since I don't really know how to code at all, but isn't there some way you can implement backwards compatibility to .net scripthook? A ton of good scripts are just added once and the author vanishes forever, and you can only use them with one version of scripthook.netwhy do you think there was a month between that last 2 releases of the hook, some methods had to be changed and the whole project needed cleaning up. Ask the person who made the mod to remake it with the latest version Link to comment Share on other sites More sharing options...
crosire Posted June 20, 2015 Author Share Posted June 20, 2015 (edited) Why is it that updating Script Hook V .NET breaks compatibility with so many of the mods made for the previous versions?. I wanted to try out the Just Cause grappling hook mod and it said I needed to download the new version of scripthookV.net. Now that mod works and Noclip still works, but like 6 other scripts stopped working. The log says things like the scripts were using bad references and bad constructors, but didn't those references used to work? I'm guessing you guys wanted to clean up the code and removed some depreciated stuff that came from older versions? Why can't you just leave the depreciated code in there somewhere, to be used ONLY in the case that an older script requests it? I mean just for the sake of backwards compatibility (which is IMO something that's extremely important for any form of software). I know I'm just talking out of my ass, since I don't really know how to code at all, but isn't there some way you can implement backwards compatibility to .net scripthook? A ton of good scripts are just added once and the author vanishes forever, and you can only use them with one version of scripthook.net It is still undergoing heavy development by lots of people and the amount of changes between 0.9 and 1.0 were immense, which made keeping it backward compatible pretty much impossible (sometimes the behaviour of an existing function was changed, etc.). This of course is not desired and not supposed to happen on every update. We try to keep it backwards compatible as long as possible actually using deprecation messages on code that should no longer be used etc. But once in a while that needs to be cleaned up. So: All updates to the minor version number are backwards compatible, updates to the major version number "may" break existing scripts. EDIT: Guess I was too slow =P. Edited June 20, 2015 by Crosire Link to comment Share on other sites More sharing options...
Nujabes5 Posted June 20, 2015 Share Posted June 20, 2015 Hi guys i had this problem too and the release fixed it, but nativeTrailer.asi is failing to load is there a build to help me ? Please For some reason , last week i noticed that some of my .net installed mods are not working anymore Accountinbank , vigilante and ambulance missions. I installed the latest scripthook .net release ( 0.9 on gitub ) , re-installed the "Microsoft .NET Framework 4.5" (actually it said it was already installed) and the "Packages redistribuables Visual C++ pour Visual Studio 2013" and the mods are still not working. I also tested using one mod at the time , upgrade the not working mods to their lastest release and downgrade my game and my scripthook to 352.2 ... nothing work . Somebody can help me ? Thanks in advance Try this release: https://ci.appveyor.com/project/crosire/scripthookvdotnet/build/Build%20No.%20248/artifacts Link to comment Share on other sites More sharing options...
unknown modder Posted June 20, 2015 Share Posted June 20, 2015 Hi guys i had this problem too and the release fixed it, but nativeTrailer.asi is failing to load is there a build to help me ? Please For some reason , last week i noticed that some of my .net installed mods are not working anymore Accountinbank , vigilante and ambulance missions. I installed the latest scripthook .net release ( 0.9 on gitub ) , re-installed the "Microsoft .NET Framework 4.5" (actually it said it was already installed) and the "Packages redistribuables Visual C++ pour Visual Studio 2013" and the mods are still not working. I also tested using one mod at the time , upgrade the not working mods to their lastest release and downgrade my game and my scripthook to 352.2 ... nothing work . Somebody can help me ? Thanks in advance Try this release: https://ci.appveyor.com/project/crosire/scripthookvdotnet/build/Build%20No.%20248/artifacts Issues with nativeTrainer dont belong in this thread, post in the native trainer thread Link to comment Share on other sites More sharing options...
whorse Posted June 21, 2015 Share Posted June 21, 2015 Why is it that updating Script Hook V .NET breaks compatibility with so many of the mods made for the previous versions?. I wanted to try out the Just Cause grappling hook mod and it said I needed to download the new version of scripthookV.net. Now that mod works and Noclip still works, but like 6 other scripts stopped working. The log says things like the scripts were using bad references and bad constructors, but didn't those references used to work? I'm guessing you guys wanted to clean up the code and removed some depreciated stuff that came from older versions? Why can't you just leave the depreciated code in there somewhere, to be used ONLY in the case that an older script requests it? I mean just for the sake of backwards compatibility (which is IMO something that's extremely important for any form of software). I know I'm just talking out of my ass, since I don't really know how to code at all, but isn't there some way you can implement backwards compatibility to .net scripthook? A ton of good scripts are just added once and the author vanishes forever, and you can only use them with one version of scripthook.net It is still undergoing heavy development by lots of people and the amount of changes between 0.9 and 1.0 were immense, which made keeping it backward compatible pretty much impossible (sometimes the behaviour of an existing function was changed, etc.). This of course is not desired and not supposed to happen on every update. We try to keep it backwards compatible as long as possible actually using deprecation messages on code that should no longer be used etc. But once in a while that needs to be cleaned up. So: All updates to the minor version number are backwards compatible, updates to the major version number "may" break existing scripts. EDIT: Guess I was too slow =P. Ah, I see. It just seems that right now, people have to choose between which version of the hook they want to use depending on which mods it supports. It seems like the majority of the scripts that I download only work with the build last modified June 09 (I cant find the version number). Would there be any way to run both the old version and the new version at the same time? I'm guessing no, since I can't run LUA.asi with GTALua.asi (so I just run LUA.asi). But if it worked it would be a nice quick fix for these problems. If it were possible, maybe you could re-release an older version of the scripthook that does not use the scripthookdotnet.asi/dll/dll.metagen filenames. I can't thank you enough for making scripthook.net, by the way, I use mods from it constantly, and it's made GTA5 modding all the more accessible. Link to comment Share on other sites More sharing options...
unknown modder Posted June 21, 2015 Share Posted June 21, 2015 Why is it that updating Script Hook V .NET breaks compatibility with so many of the mods made for the previous versions?. I wanted to try out the Just Cause grappling hook mod and it said I needed to download the new version of scripthookV.net. Now that mod works and Noclip still works, but like 6 other scripts stopped working. The log says things like the scripts were using bad references and bad constructors, but didn't those references used to work? I'm guessing you guys wanted to clean up the code and removed some depreciated stuff that came from older versions? Why can't you just leave the depreciated code in there somewhere, to be used ONLY in the case that an older script requests it? I mean just for the sake of backwards compatibility (which is IMO something that's extremely important for any form of software). I know I'm just talking out of my ass, since I don't really know how to code at all, but isn't there some way you can implement backwards compatibility to .net scripthook? A ton of good scripts are just added once and the author vanishes forever, and you can only use them with one version of scripthook.net It is still undergoing heavy development by lots of people and the amount of changes between 0.9 and 1.0 were immense, which made keeping it backward compatible pretty much impossible (sometimes the behaviour of an existing function was changed, etc.). This of course is not desired and not supposed to happen on every update. We try to keep it backwards compatible as long as possible actually using deprecation messages on code that should no longer be used etc. But once in a while that needs to be cleaned up. So: All updates to the minor version number are backwards compatible, updates to the major version number "may" break existing scripts. EDIT: Guess I was too slow =P. Ah, I see. It just seems that right now, people have to choose between which version of the hook they want to use depending on which mods it supports. It seems like the majority of the scripts that I download only work with the build last modified June 09 (I cant find the version number). Would there be any way to run both the old version and the new version at the same time? I'm guessing no, since I can't run LUA.asi with GTALua.asi (so I just run LUA.asi). But if it worked it would be a nice quick fix for these problems. If it were possible, maybe you could re-release an older version of the scripthook that does not use the scripthookdotnet.asi/dll/dll.metagen filenames.I can't thank you enough for making scripthook.net, by the way, I use mods from it constantly, and it's made GTA5 modding all the more accessible.there wasn't a release on June 9th,so that isn't an official or supported build Link to comment Share on other sites More sharing options...
nordi Posted June 22, 2015 Share Posted June 22, 2015 (edited) How can I play audio files (the one from the game, that can be found on openIV) Edited June 22, 2015 by nordi Link to comment Share on other sites More sharing options...
CamxxCore Posted June 22, 2015 Share Posted June 22, 2015 (edited) How can I play audio files (the one from the game, that can be found on openIV)There is Game.PlaySound(soundFile, soundSet);or Game.PlayMusic(musicFile); Edited June 22, 2015 by CamxxCore nordi 1 Link to comment Share on other sites More sharing options...
nordi Posted June 23, 2015 Share Posted June 23, 2015 How can I play audio files (the one from the game, that can be found on openIV) There is Game.PlaySound(soundFile, soundSet);or Game.PlayMusic(musicFile); Thanks. We have the possibilty to place a car on the ground using: PlaceOnGround(); but I can't find the same for a ped ! is it something else ? Link to comment Share on other sites More sharing options...
CamxxCore Posted June 23, 2015 Share Posted June 23, 2015 (edited) How can I play audio files (the one from the game, that can be found on openIV) There is Game.PlaySound(soundFile, soundSet);or Game.PlayMusic(musicFile); Thanks. We have the possibilty to place a car on the ground using: PlaceOnGround(); but I can't find the same for a ped ! is it something else ? Not sure if there is a native but this will work.. Vector3 groundPos;GetGroundZfor3DCoord(ped.Position, out groundPos);ped.Position = groundPos;void GetGroundZfor3DCoord(Vector3 coord, out Vector3 result) { OutputArgument zcoord = new OutputArgument(); Function.Call<bool>(Hash.GET_GROUND_Z_FOR_3D_COORD, coord.X, coord.Y, coord.Z, zcoord); result = new Vector3(coord.X, coord.Y, zcoord.GetResult<float>()); } Edited June 23, 2015 by CamxxCore nordi 1 Link to comment Share on other sites More sharing options...
piper5by5 Posted June 24, 2015 Share Posted June 24, 2015 For some reason, this tool is making my game crash whenever I press my Function (Fn) key and the up or down arrows at the same time. That button combination is my computer's default combo for increasing/decreasing brightness, so it's kind of important. Is there a way to fix this? I've already tried reinstalling Scripthookv.net but to no avail. Link to comment Share on other sites More sharing options...
Enumerator Posted June 25, 2015 Share Posted June 25, 2015 For some reason, this tool is making my game crash whenever I press my Function (Fn) key and the up or down arrows at the same time. That button combination is my computer's default combo for increasing/decreasing brightness, so it's kind of important. Is there a way to fix this? I've already tried reinstalling Scripthookv.net but to no avail. Why dont you recompile the native trainer.asi with your own hotkey? it's realy simple. Link to comment Share on other sites More sharing options...
piper5by5 Posted June 25, 2015 Share Posted June 25, 2015 Why dont you recompile the native trainer.asi with your own hotkey? it's realy simple. For one, I'm not using Native Trainer; I'm using sjaak327's Simple Trainer. I've already looked in the config settings, but there doesn't seem to be a keycode value for the Function key, nor an ability to insert my own hotkey combination anyway. Link to comment Share on other sites More sharing options...
Rushlink Posted June 25, 2015 Share Posted June 25, 2015 Is there any way for me to return the object that the player is currently targeting?EG: Player points weapon at vehicle - returns vehicle. OR player points weapon at ped, returns ped? Thx. Matt Link to comment Share on other sites More sharing options...
crosire Posted June 26, 2015 Author Share Posted June 26, 2015 Is there any way for me to return the object that the player is currently targeting? EG: Player points weapon at vehicle - returns vehicle. OR player points weapon at ped, returns ped? Thx. Matt Yes, you can use the C# "is" (or VB.Net's "Is") operator: using GTA;Entity e = ...;if (e is Vehicle){ ...}else if (e is Ped){ ...} Link to comment Share on other sites More sharing options...
Rushlink Posted June 26, 2015 Share Posted June 26, 2015 (edited) I am also having issues with Task.SwapWeapon(); I want the player to switch to the pistol, for example. Game.Player.character.Task.SwapWeapon(WeaponHash.Pistol); ((like gta IV)) but, swapweapon takes no arguments, and when called it only puts away and takes out the current weapon. figured it out. You have to basically, save the current ammo state, remove and re equip the item. pistolAmmo = pistol.Ammo;Game.Player.Character.Weapons.Remove(pistol);pistol = Game.Player.Character.Weapons.Give(GTA.Native.WeaponHash.Pistol, pistolAmmo, true, true);Game.Player.Character.Task.SwapWeapon(); //for looks Thanks, Matt Edited June 27, 2015 by Rushlink Link to comment Share on other sites More sharing options...
unknown modder Posted June 27, 2015 Share Posted June 27, 2015 I am also having issues with Task.SwapWeapon(); I want the player to switch to the pistol, for example. Game.Player.character.Task.SwapWeapon(WeaponHash.Pistol); ((like gta IV)) but, swapweapon takes no arguments, and when called it only puts away and takes out the current weapon. figured it out. You have to basically, save the current ammo state, remove and re equip the item. pistolAmmo = pistol.Ammo;Game.Player.Character.Weapons.Remove(pistol);pistol = Game.Player.Character.Weapons.Give(GTA.Native.WeaponHash.Pistol, pistolAmmo, true, true);Game.Player.Character.Task.SwapWeapon(); //for looksThanks,Matt can't you just use Weapons.Select method Link to comment Share on other sites More sharing options...
nordi Posted June 27, 2015 Share Posted June 27, 2015 Hey everyone 2 questions: 1) I tried to spawn an object, but it's not working ! Here is my code: Prop equipment; Model m2 = new Model("prop_roadcone01a"); m2.Request(2000); equipment = World.CreateProp(m2.Hash, GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), false, false); equipment.AttachTo(GTA.Game.Player.Character, GTA.Game.Player.Character.GetBoneIndex(Bone.SKEL_L_Hand), GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), new Vector3(0, 0, 0)); 2) I tried to create a camera, but in game it's not working ! Also, what's the int handle for the camera in GTA.Camera MyCam = new Camera(HANDLE ?); Here is my code: GTA.Camera MyCam = new Camera(1);Game.Player.Character.Position = new Vector3(CamX, CamY, CamZ); Game.Player.Character.Heading = heading; Game.Player.Character.IsVisible = false; Game.Player.CanControlCharacter = false; MyCam.Position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, -3f, -20f)); MyCam.Rotation = Game.Player.Character.Rotation; MyCam.IsActive = true; Thanks ! Link to comment Share on other sites More sharing options...
CamxxCore Posted June 27, 2015 Share Posted June 27, 2015 (edited) Hey everyone 2 questions: 1) I tried to spawn an object, but it's not working ! Here is my code: Prop equipment; Model m2 = new Model("prop_roadcone01a"); m2.Request(2000); equipment = World.CreateProp(m2.Hash, GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), false, false); equipment.AttachTo(GTA.Game.Player.Character, GTA.Game.Player.Character.GetBoneIndex(Bone.SKEL_L_Hand), GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), new Vector3(0, 0, 0));2) I tried to create a camera, but in game it's not working ! Also, what's the int handle for the camera in GTA.Camera MyCam = new Camera(HANDLE ?); Here is my code: GTA.Camera MyCam = new Camera(1);Game.Player.Character.Position = new Vector3(CamX, CamY, CamZ); Game.Player.Character.Heading = heading; Game.Player.Character.IsVisible = false; Game.Player.CanControlCharacter = false; MyCam.Position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, -3f, -20f)); MyCam.Rotation = Game.Player.Character.Rotation; MyCam.IsActive = true;Thanks !You probably don't need to be creating a new instance of GTA.Camera. You can use "GameplayCamera" to change most things with the main camera. Otherwise use a native like CREATE_CAM to pass it a new handle. I don't know which native is the right one. Edited June 27, 2015 by CamxxCore Link to comment Share on other sites More sharing options...
nordi Posted June 27, 2015 Share Posted June 27, 2015 Hey everyone 2 questions: 1) I tried to spawn an object, but it's not working ! Here is my code: Prop equipment; Model m2 = new Model("prop_roadcone01a"); m2.Request(2000); equipment = World.CreateProp(m2.Hash, GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), false, false); equipment.AttachTo(GTA.Game.Player.Character, GTA.Game.Player.Character.GetBoneIndex(Bone.SKEL_L_Hand), GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), new Vector3(0, 0, 0));2) I tried to create a camera, but in game it's not working ! Also, what's the int handle for the camera in GTA.Camera MyCam = new Camera(HANDLE ?); Here is my code: GTA.Camera MyCam = new Camera(1);Game.Player.Character.Position = new Vector3(CamX, CamY, CamZ); Game.Player.Character.Heading = heading; Game.Player.Character.IsVisible = false; Game.Player.CanControlCharacter = false; MyCam.Position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, -3f, -20f)); MyCam.Rotation = Game.Player.Character.Rotation; MyCam.IsActive = true;Thanks ! You probably don't need to be creating a new instance of GTA.Camera. You can use "GameplayCamera" to change most things with the main camera. Otherwise use a native like CREATE_CAM to pass it a new handle. I don't know which native is the right one. GameplayCamera.Position is read only, so I can't use that ... I guess, i'll have to go with the natives ... weird that creating a new camera and setting its position doesn't work ! Any idea about the object not spawning ? thanks for your help ! Link to comment Share on other sites More sharing options...
Inco Posted June 27, 2015 Share Posted June 27, 2015 Hey everyone 2 questions: 1) I tried to spawn an object, but it's not working ! Here is my code: Prop equipment; Model m2 = new Model("prop_roadcone01a"); m2.Request(2000); equipment = World.CreateProp(m2.Hash, GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), false, false); equipment.AttachTo(GTA.Game.Player.Character, GTA.Game.Player.Character.GetBoneIndex(Bone.SKEL_L_Hand), GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), new Vector3(0, 0, 0)); 2) I tried to create a camera, but in game it's not working ! Also, what's the int handle for the camera in GTA.Camera MyCam = new Camera(HANDLE ?); Here is my code: GTA.Camera MyCam = new Camera(1);Game.Player.Character.Position = new Vector3(CamX, CamY, CamZ); Game.Player.Character.Heading = heading; Game.Player.Character.IsVisible = false; Game.Player.CanControlCharacter = false; MyCam.Position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, -3f, -20f)); MyCam.Rotation = Game.Player.Character.Rotation; MyCam.IsActive = true; Thanks ! 1. Did you see this article? 2. Do you want this: var camera = World.CreateCamera( ... );World.RenderingCamera = camera; ? nordi 1 Link to comment Share on other sites More sharing options...
Rushlink Posted June 27, 2015 Share Posted June 27, 2015 I am also having issues with Task.SwapWeapon(); I want the player to switch to the pistol, for example. Game.Player.character.Task.SwapWeapon(WeaponHash.Pistol); ((like gta IV)) but, swapweapon takes no arguments, and when called it only puts away and takes out the current weapon. figured it out. You have to basically, save the current ammo state, remove and re equip the item. pistolAmmo = pistol.Ammo;Game.Player.Character.Weapons.Remove(pistol);pistol = Game.Player.Character.Weapons.Give(GTA.Native.WeaponHash.Pistol, pistolAmmo, true, true);Game.Player.Character.Task.SwapWeapon(); //for looksThanks,Matt can't you just use Weapons.Select method Weapons.Select doesn't work - it does nothing (well, it re-spawns the current weapon only). I've found a few things that don't always work or don't work as expected. EG: Spawning vehicles into the game doesn't actually spawn the vehicle in the game properly. For example - in fiveM, when I write my own code in C++ or use natives, the vehicle appears for everyone. When I use the world.createvehicle function it only appears for the spawning player. A lot of things may appear to work in singleplayer, but they're not being done properly, so they don't actually appear - or they prevent the script from interacting with them correctly after they're created (eg: problems with fiveM). Matt Link to comment Share on other sites More sharing options...
nordi Posted June 27, 2015 Share Posted June 27, 2015 Hey everyone 2 questions: 1) I tried to spawn an object, but it's not working ! Here is my code: Prop equipment; Model m2 = new Model("prop_roadcone01a"); m2.Request(2000); equipment = World.CreateProp(m2.Hash, GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), false, false); equipment.AttachTo(GTA.Game.Player.Character, GTA.Game.Player.Character.GetBoneIndex(Bone.SKEL_L_Hand), GTA.Game.Player.Character.GetBoneCoord(Bone.SKEL_L_Hand), new Vector3(0, 0, 0)); 2) I tried to create a camera, but in game it's not working ! Also, what's the int handle for the camera in GTA.Camera MyCam = new Camera(HANDLE ?); Here is my code: GTA.Camera MyCam = new Camera(1);Game.Player.Character.Position = new Vector3(CamX, CamY, CamZ); Game.Player.Character.Heading = heading; Game.Player.Character.IsVisible = false; Game.Player.CanControlCharacter = false; MyCam.Position = Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0f, -3f, -20f)); MyCam.Rotation = Game.Player.Character.Rotation; MyCam.IsActive = true; Thanks ! 1. Did you see this article? 2. Do you want this: var camera = World.CreateCamera( ... );World.RenderingCamera = camera; ? Thank you ! Now it's working, but I have one last problem I can't remove the camera once I'm done with it, I tried: MyCam.Destroy(); MyCam.IsActive = false; World.RenderingCamera.Destroy(); Function.Call(Hash.DESTROY_ALL_CAMS, true); Link to comment Share on other sites More sharing options...
Inco Posted June 27, 2015 Share Posted June 27, 2015 World.RenderingCamera = null; Sets the default camera. nordi 1 Link to comment Share on other sites More sharing options...
metiri Posted June 28, 2015 Share Posted June 28, 2015 Trying to figure out how to display dynamic text (i.e. a speedometer). Having trouble understanding UIText. // Initial drawing of UIUIContainer cont = new UIContainer( new Point( 10,10 ), new Size( 200,300 ), Color.FromArbg( 100,0,0,0 ) );cont.Items.Add( new UIText( "Speed: ", new Point(10,10), 0.5, Color.White ));cont.Draw();..........// After a car is in a specified location to have its speed readcont.Items.Clear();cont.Items.Add( new UIText("Speed: " + targetVeh.Speed.ToString(), new Point( 10,10 ), 0.5, Color.White ) );cont.Draw(); Am I missing something?? I get a a black box in the location I want (the UIContainer) but never any text. Link to comment Share on other sites More sharing options...
metiri Posted June 28, 2015 Share Posted June 28, 2015 Trying to figure out how to display dynamic text (i.e. a speedometer). Having trouble understanding UIText. // Initial drawing of UIUIContainer cont = new UIContainer( new Point( 10,10 ), new Size( 200,300 ), Color.FromArbg( 100,0,0,0 ) );cont.Items.Add( new UIText( "Speed: ", new Point(10,10), 0.5, Color.White ));cont.Draw();..........// After a car is in a specified location to have its speed readcont.Items.Clear();cont.Items.Add( new UIText("Speed: " + targetVeh.Speed.ToString(), new Point( 10,10 ), 0.5, Color.White ) );cont.Draw(); Am I missing something?? I get a a black box in the location I want (the UIContainer) but never any text. ahhh i figured it out. i feel like a derp.... No need for container... This works for drawing text: UIElement text = new UIText("Hello, World!", new Point(100,100), 0.5f, Color.White);text.Draw(); 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