waynieoaks Posted February 16, 2021 Share Posted February 16, 2021 (edited) [EDIT]: Seems to be only in my dev install and not other installs - so there must be a problem with my install. Will go back and try to work out what it is. Code seems to be good. For some reason, my code is no longer dropping the weapon (I am sure it use to work). I am using: Function.Call(Hash.SET_PED_DROPS_WEAPON, Game.Player.Character); What seems to happen at the moment is the weapon is put away rather than dropped. I cannot for the life of me workout why. Has anybody seen this before? Many thanks. Edited February 18, 2021 by waynieoaks Link to comment Share on other sites More sharing options...
leihebi Posted February 17, 2021 Share Posted February 17, 2021 9 hours ago, waynieoaks said: [EDIT]: Seems to be only in my dev install and not other installs - so there must be a problem with my install. Will go back and try to work out what it is. Code seems to be good. For some reason, my code is no longer dropping the weapon (I am sure it use to work). I am using: Function.Call(Hash.SET_PED_DROPS_WEAPON, Game.Player.Character); What seems to happen at the moment is the weapon is put away rather than dropped. I cannot for the life of me workout why. Has anybody seen this before? Many thanks. I don't fully understand what you mean, but I think it's that you want your generated ped to drop weapons when they die. You could try this. Function.Call(Hash.SET_PED_DROPS_WEAPONS_WHEN_DEAD, pedname, true); 9 hours ago, waynieoaks said: [EDIT]: Seems to be only in my dev install and not other installs - so there must be a problem with my install. Will go back and try to work out what it is. Code seems to be good. For some reason, my code is no longer dropping the weapon (I am sure it use to work). I am using: Function.Call(Hash.SET_PED_DROPS_WEAPON, Game.Player.Character); What seems to happen at the moment is the weapon is put away rather than dropped. I cannot for the life of me workout why. Has anybody seen this before? Many thanks. You can do the same pedname.DropsWeaponsOnDeath(get; set:); Link to comment Share on other sites More sharing options...
leihebi Posted February 17, 2021 Share Posted February 17, 2021 Why your generated ped did not drop weapons, you first have not given your generated ped weapons, if not then will not drop weapons, on the contrary, if given weapons, regardless of whether there is no code written about dropping weapons upon death, it will drop, this is the rule of the game. Link to comment Share on other sites More sharing options...
waynieoaks Posted February 17, 2021 Author Share Posted February 17, 2021 Thank you @leihebi That is not quite what I am trying to do unfortunately. I am trying to drop the weapon while alive. My code is to allow you to surrender to police if you have more than one star and does the following: 1. If in a vehicle, get out of the vehicle 2. If holding a weapon, drop the weapon to the ground 3. Put hands up until busted OR you change your mind and run It seems to work fine on one of my installs, but was not working on my Dev install. Dev is a clean install of GTA V with Rage Plugin Hook, Scripthookv and Scripthookv.net The other environment has several mods for gameplay including some combat / weapons ones. When I rename the mods folder to disable them, it stops working - So I think there is something in the mods folder of my other installs making it work. I am now going to try copying the mods folder to Dev to see if my code then works on dev. If it does I will then look at what mods there are to work out which one is making it work. I may reinstall Dev just to ensure I haven't corrupted a vanilla file somewhere along the way. I have a feeling the drop weapon function may not work properly but few people if any have tried using it? Maybe? Like everything I do, something simple seems to be complicated Link to comment Share on other sites More sharing options...
leihebi Posted February 17, 2021 Share Posted February 17, 2021 41 minutes ago, waynieoaks said: Thank you @leihebi That is not quite what I am trying to do unfortunately. I am trying to drop the weapon while alive. My code is to allow you to surrender to police if you have more than one star and does the following: 1. If in a vehicle, get out of the vehicle 2. If holding a weapon, drop the weapon to the ground 3. Put hands up until busted OR you change your mind and run It seems to work fine on one of my installs, but was not working on my Dev install. Dev is a clean install of GTA V with Rage Plugin Hook, Scripthookv and Scripthookv.net The other environment has several mods for gameplay including some combat / weapons ones. When I rename the mods folder to disable them, it stops working - So I think there is something in the mods folder of my other installs making it work. I am now going to try copying the mods folder to Dev to see if my code then works on dev. If it does I will then look at what mods there are to work out which one is making it work. I may reinstall Dev just to ensure I haven't corrupted a vanilla file somewhere along the way. I have a feeling the drop weapon function may not work properly but few people if any have tried using it? Maybe? Like everything I do, something simple seems to be complicated The following determines whether the player or ped is arrested, and if so can write a new event Checks whether the specified player has a Ped, the Ped is not dead, is not injured and is not arrested. Function.Call(Hash.IS_PLAYER_PLAYING, Player player); Return true while player is being arrested / busted. If atArresting is set to 1, this function will return 1 when player is being arrested (while player is putting his hand up, but still have control) If atArresting is set to 0, this function will return 1 only when the busted screen is shown. Function.Call(Hash.IS_PLAYER_BEING_ARRESTED, Player player, BOOL atArresting); Returns the time since the character was arrested in (ms) milliseconds. example var time = Function.call<int>(Hash.GET_TIME_SINCE_LAST_ARREST(); UI.DrawSubtitle(time.ToString()); if player has not been arrested, the int returned will be -1. I'm not sure if you want the player to perform these events, or if you want the specified ped to perform them? Link to comment Share on other sites More sharing options...
leihebi Posted February 17, 2021 Share Posted February 17, 2021 player: if (Game.Player.Character.IsSittingInVehicle()) { //Events } ped: if (ped.IsSittingInVehicle()) { //Events } Link to comment Share on other sites More sharing options...
waynieoaks Posted February 17, 2021 Author Share Posted February 17, 2021 Thank you - yes - I already have these working It is just the dropping weapon part that is not working (before) being arrested. Link to comment Share on other sites More sharing options...
waynieoaks Posted February 18, 2021 Author Share Posted February 18, 2021 Worked out what to do and wanted to share here in case anybody else looks for this in the future. To get your main character to drop the weapon they are holding use SET_PED_DROPS_INVENTORY_WEAPON instead of SET_PED_DROPS_WEAPON void SET_PED_DROPS_INVENTORY_WEAPON(Ped ped, Hash weaponHash, float xOffset, float yOffset, float zOffset, int ammoCount); Example: Function.Call(Hash.SET_PED_DROPS_INVENTORY_WEAPON, Game.Player.Character, Game.Player.Character.Weapons.Current.Hash, 0.4, 0.7, -0.1, -1); As an added bonus, to not select a different weapon automatically you can also follow up with: Function.Call(Hash.SET_CURRENT_PED_WEAPON, Game.Player.Character, 0xA2719263, true); Which will change current weapon to none. LeeC22 1 Link to comment Share on other sites More sharing options...
leihebi Posted February 18, 2021 Share Posted February 18, 2021 2 hours ago, waynieoaks said: Worked out what to do and wanted to share here in case anybody else looks for this in the future. To get your main character to drop the weapon they are holding use SET_PED_DROPS_INVENTORY_WEAPON instead of SET_PED_DROPS_WEAPON void SET_PED_DROPS_INVENTORY_WEAPON(Ped ped, Hash weaponHash, float xOffset, float yOffset, float zOffset, int ammoCount); Example: Function.Call(Hash.SET_PED_DROPS_INVENTORY_WEAPON, Game.Player.Character, Game.Player.Character.Weapons.Current.Hash, 0.4, 0.7, -0.1, -1); As an added bonus, to not select a different weapon automatically you can also follow up with: Function.Call(Hash.SET_CURRENT_PED_WEAPON, Game.Player.Character, 0xA2719263, true); Which will change current weapon to none. oh 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