Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

HazardX

[BETA] GTAIV .Net ScriptHook

Recommended Posts

wrecker99
It is possible, all weapon data is stored ingame and can be edited easily with memory access.

Can you give me some sources?please. are they same as editing the weaponinfo.dat files? cause i didn't find anything on scripthook.xml about weapon range, etc...

Share this post


Link to post
Share on other sites
Kucikuc24
It is possible, all weapon data is stored ingame and can be edited easily with memory access.

hey LMS, pls can you find and post here HEXs for weapon demage, force and others here pls ?

Share this post


Link to post
Share on other sites
LMS

I remember I have almost all offsets for weapons for patch #6, however I'm currently not at home. I also made an ingame weapon editor and have the source around here, just need to find it (new hdd). Could take some time smile.gif

Share this post


Link to post
Share on other sites
Threepwood

Hey LMS, could you do same for two things: read if lights are on /off, and catch the BRAKE button? .NET Hook catches the BACKWARD, but not the brake, since you can map them independent (backward on foot on key S, brake/backward in vehicle on KeyDown for example). Is it possible to get both per memory at least?

Share this post


Link to post
Share on other sites
LMS

I've commited the lights on/off stuff to svn a long time ago I think, so it will be in the next update. I don't know exactly what you mean with brake button, get when you're braking in car or get if the key is down, either on foot or in car but you don't want to check for different keys but for like Keys.Brake?

Share this post


Link to post
Share on other sites
lilmcnessy

does this work with 64 bit windows? I can't get it running

Share this post


Link to post
Share on other sites
Kucikuc24

yeah its working...I have Windows 7 Ultimate x64

Share this post


Link to post
Share on other sites
lilmcnessy
yeah its working...I have Windows 7 Ultimate x64

is there anything you had to do toget it running though

I downloaded .net 4

that c++ update

and even updated directx

Share this post


Link to post
Share on other sites
Kucikuc24

do you have some error or what ?

Share this post


Link to post
Share on other sites
Gigahertz2010

I can't get it working either. I had it working on Windows 7 32 bit, but as soon as I installed on Windows 7 64 bit, it doesn't. All of my other asi files load but scripthookdotnet. I need it for the Traffic Control System! Someone please help.

Share this post


Link to post
Share on other sites
lilmcnessy
do you have some error or what ?

nope, all other mods except the .net script hook load

 

  I can't get it working either. I had it working on Windows 7 32 bit, but as soon as I installed on Windows 7 64 bit, it doesn't. All of my other asi files load but scripthookdotnet. I need it for the Traffic Control System! Someone please help.

Same here, it worked fine in 32 bit

Share this post


Link to post
Share on other sites
sjaak327

Make sure you have both the .net framework 4 and the C++ redistributable installed, install the X86 version of the c++ redist, even if running a 64 bit Os.

 

 

Share this post


Link to post
Share on other sites
Gigahertz2010
Make sure you have both the .net framework 4 and the C++ redistributable installed, install the X86 version of the c++ redist, even if running a 64 bit Os.

I noticed the other thread on this page afterwards which had the same solution. I installed the 2010 redistributable and it works now.

Share this post


Link to post
Share on other sites
Gokaic

So I come back asking another question... On a few of my mods, I have icons put on certain peds so the player can see them on the map/radar. However, the more mods I do this with, the more cluttered my radar gets. Is there a way to only have the icon appear if you are nearby(like the original weapons dealers)? If so, how would I go about setting this, as I can't seem to figure it out. Thanks in advance!

Share this post


Link to post
Share on other sites
Threepwood
I've commited the lights on/off stuff to svn a long time ago I think, so it will be in the next update. I don't know exactly what you mean with brake button, get when you're braking in car or get if the key is down, either on foot or in car but you don't want to check for different keys but for like Keys.Brake?

Atm I use this:

 

                   if (Game.isGameKeyPressed(GameKey.MoveBackward))                   {                       itBreaks = true;                       brakePressed = true;                       if (vehInfo[9] == "1")                       {                           Game.DisplayText("Bremse: " + brakePressed + "");                       }                   }

 

 

If the car brake is mapped to the same button as running backwards, I can catch it. But there simply is no GameKey.Brake, it does not exist in any way in the .NET hook. But it is a different key action abled to be mapped on a seperate key. Sure I could hardcode any key, but that would be the same stupid option like using GameKey.MoveBackward, since I can not see this as standard everyone uses. Actually, some users, which have mapped the in car brake to a different key for better control (for example the arrow keys, or even a gamepad, or a joystick), can not use the brake function I offer in EPM.

In german (easier to explain):

Auf gut deutsch: der User kann die Bremse mappen wohin er will, das Game unterstützt das ja, aber .NET fängt es nicht ab und bietet es nicht an, MoveBackward ist ein schlechter Ersatz da die Bremse eben anders gemappt werden kann als rückwärtslaufen. Das funktioniert nur dann, wenn Bremse+Rückwärts laufen auf dem selben Key liegen, Standard wäre "S". Manch einer mappt sich das aber im normalen Spielmenü um, sodass er zB mit den Pfeiltasten das Auto bewegt, und mit ASDW die Spielfigur laufen lässt. Nebenbei lässt sich das gut mit Gamepads sehen, MoveBackward wird ausgelöst vom CameraDown Befehl, daher funktioniert die Airbrake von EPM zB wenn man die Cam nach unten schwenkt.

Share this post


Link to post
Share on other sites
sjaak327

You can use a normal native to see if someone brakes:

 

if (IsControlPressed(1,41))

 

41=brakekey.

 

 

Share this post


Link to post
Share on other sites
Flava0ne

Thanks man for the update man!

Share this post


Link to post
Share on other sites
MulleDK19

Can you please make a way to change which key opens the console?

 

I'm using a danish keyboard and I don't have Tilde as a single key.

 

I can open it if I switch to english layout in Windows, and press ½, but EFLC forces the keyboard to be danish!! >:(

 

If I switch to another application, I can change it to EN, but as soon as the game receives focus, it changes back to DA. If I switch to another program, it goes back to EN, so the game is forcing it to be my real layout.

 

 

ARGH!

 

 

 

 

Also, having to switch to EN everytime I want to open the console is also annoying as hell, so a way to choose a key would really be the most optimal solution. Thanks in advance.

 

 

 

 

EDIT: Nevermind, just found out that Æ works instead biggrin.gif

Edited by MulleDK19

Share this post


Link to post
Share on other sites
iriedreadlock23

HazardX, I need your help if it is possible. I am trying to make ped animations use collisions. Is this possible? I have tried various flags, and it seems that only non animated parts of body have collisions. I want to start left hook animation, and to knock down pedestrian. Offcourse, I have seen different approach in gta scripts,which is to track Bone positions, and trigger animations if certain bone reaches bone on other ped.

 

Also, Is there any chance that anytime soon you expand your Vehicle classes with more data? There is lot more

 

Also, tell me is there a limit on number of tasks in TaskSequence? I have tried to set 70 tasks to a ped, but he wouldnt do them all. Offcourse, I have solved this with another approach, but im curious.

Share this post


Link to post
Share on other sites
giova

Hi all.

 

First of all, please excuse my poor english.

 

I try to change allready spawned Peds controls. For example, i want to make them attacking cops. But this don't works. I give them guns, change their relation ship (hate cop).

Result is that cops fight them, but those peds flee instead of fighting agains cop.(the worst is that they immediatly place their weapon in holdster as soon as cops arrives)

 

I suspect their original behaviour to control their task and cancel mine.

 

By the way, i can't manage DecisionMaker :

 

DecisionMaker decision = DecisionMaker.CopyBehavior(DecisionMaker.CopyTemplate.Behavior_Cop);if(myped != null && myped.Exist())  decision.Applyto(myped);

 

 

It allways says that decision doesn't exist anymore. I try all DecisionMaker Factory methods, allways a exception on ApplyTo line.

Here a sample of code that doesn't works (peds still fleeing from cops).

 

 

void AttackCops(Ped obj){obj.LeaveGroup();Weapon weap = Weapon.Handgun_DesertEagle;obj.Weapons.FromType(weap).Ammo = 60;obj.Weapons.Select(weap);obj.RelationshipGroup = RelationshipGroup.Criminal;obj.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);obj.WillUseCarsInCombat = true;obj.WillDoDrivebys = true;obj.PriorityTargetForEnemies = true;//Old Try                               //obj.SenseRange = 70.0f;                               //obj.SetDefensiveArea(obj.Position, 70.0f);                               //obj.Task.GuardCurrentPosition();//end old try                               //Other Old Try   obj.Task.FightAgainsHated(100.0f,3000000);//End Other Old try   Ped cop = FindClosestCop(obj);                               obj.Task.AlwaysKeepTask = true;                               obj.Task.ClearAllImmediately();                               TaskSequence react = new TaskSequence();                               react.AddTask.SwapWeapon(Weapon.Handgun_DesertEagle);                               react.AddTask.FightAgainst(cop, 3000000);                               obj.Task.PerformSequence(react);}

 

 

Do i have to change their Behaviour/Combat to be tigh? how to please?

Simply how to reach my goal please? smile.gif

 

PS : Ped.RelationshipGroup allways return the same value: -5432435432 (i don't remember the exact value, sounds like a uint 0 converted to a int => - 2^32-1)

Edited by giova

Share this post


Link to post
Share on other sites
MulleDK19

Any updates soon? Still can't delete Blips using Blip.Delete().

 

I had to make this custom method to delete Blips:

 

public void DeleteBlip(Blip blp){if (Game.Exists(blp)){ try { blp.Delete(); } catch (Exception) { 	try { GTA.Native.Function.Call("REMOVE_BLIP", blp); } 	catch (Exception) { } }}}

 

 

Note: Blip.Delete() ALWAYS throws NonExistingObjectException. If I didn't know better, I would think that the following is the source of the Blip.Delete() method:

 

public void Delete(){throw new NonExistingObjectException();}

 

 

The native function removes it, and the same case works fine in previous versions of the .NET script hook.

 

 

 

 

Also, does anyone have the version before the NonExistingObjectException was introduced (Version 1.7.1.4 BETA)?

 

Because the ScriptHook is broken with that. I get a lot of NonExistingObjectExceptions for objects that DOES exist.

 

I even get it after checking with Exists() before using it.

 

Not only that. I occassionally get it for Player.Character.CurrentVehicle, when I use it in an Exists().

 

Eg.:

 

 

if (Exists(Player.Character.CurrentVehicle))   Player.Character.CurrentVehicle.PlaceOnNextStreetProperly();

 

 

Which occassionally causes:

'Player.Character.CurrentVehicle' threw an exception of type 'GTA.NonExistingObjectException'. Invalid call to an object that doesn't exist anymore!

Edited by MulleDK19

Share this post


Link to post
Share on other sites
X-bone

how to make a mission...... how to start in vb or cs

Share this post


Link to post
Share on other sites
iriedreadlock23

MulleDk19, you should check if player is in vehicle (or sitting in vehicle = Player.Character.IsInVehicle or Player.Character.isSittingInVehicle) before checking wheter the object exist. Note that ScriptHookDotNet throws exception only when we try to use the object before it exists.

 

On the other hand, about blips. I am using blips regulary, and I can suggest that you collect the blip handles, and store them in a collection or array. Then when you need to delete them, you must check wheter the Blip actually exists (Exists & IsNot Nothing), and then you use BlipArray(i).Delete. Offcourse, blips that are attached to a ped or a vehicle, can autodelete, if their parent is deleted aswell. So, generally you should actually take care only of blips added for coords, weapons, etc. Point: STORE THE HANDLE. Use native DOES_BLIP_EXIST.

 

There is also a shared function (called directly from Blip class, with no need to declare instance of it), Blip.GetAllBlipsOfType. It returns all blips of certain type, if you want to delete all of lets say BlipType.Contact (5).

Share this post


Link to post
Share on other sites
MulleDK19

 

MulleDk19, you should check if player is in vehicle (or sitting in vehicle = Player.Character.IsInVehicle or Player.Character.isSittingInVehicle) before checking wheter the object exist. Note that ScriptHookDotNet throws exception only when we try to use the object before it exists.

 

On the other hand, about blips. I am using blips regulary, and I can suggest that you collect the blip handles, and store them in a collection or array. Then when you need to delete them, you must check wheter the Blip actually exists (Exists & IsNot Nothing), and then you use BlipArray(i).Delete. Offcourse, blips that are attached to a ped or a vehicle, can autodelete, if their parent is deleted aswell. So, generally you should actually take care only of blips added for coords, weapons, etc. Point: STORE THE HANDLE. Use native DOES_BLIP_EXIST.

 

There is also a shared function (called directly from Blip class, with no need to declare instance of it), Blip.GetAllBlipsOfType. It returns all blips of certain type, if you want to delete all of lets say BlipType.Contact (5).

I've never had this problem in earlier versions. And Exists is supposed to check if the object exists, and there's no need to call isInVehicle() first.

 

Game.Exists checks if the passed variable is not null and then performs an object.Exists() on that one.

 

The problem seems to be, that objects (eg. CurrentVehicle) makes an errornous existence check, which then makes it impossible to reference because of the Exception.

 

Earlier versions of the ScriptHook allows the passing of non-existing objects to the Exists function. This is a serious bug, in my opinion.

 

Also. When I get the Exceptions on CurrentVehicle, CurrentVehicle DOES exist. I'm in it for Christ's sake.

 

 

 

And about the Blips. I don't think you're getting what I'm saying.

 

I can't remove Blips. No matter if they're attached or just spawned, no matter what handle I use, and no matter what function or what way I try to delete them.

 

The only way that works is going native.

 

 

The same code works fine in previous versions of the scripthook.

Edited by MulleDK19

Share this post


Link to post
Share on other sites
iriedreadlock23

In my opinion, it's always better to use Native functions if you know how to use them. If that works, create your own implementation class for blips using Natives. It's straightforward solution, its GTA4 native language, after all. There is a lots of function to use, even though many are still not documented well. We can't expect HazardX to do it all 100% by himself. But thanks to his migthty ScripHookDotNet, and Native class, everything is very easy.

Share this post


Link to post
Share on other sites
MulleDK19
In my opinion, it's always better to use Native functions if you know how to use them. If that works, create your own implementation class for blips using Natives. It's straightforward solution, its GTA4 native language, after all. There is a lots of function to use, even though many are still not documented well. We can't expect HazardX to do it all 100% by himself. But thanks to his migthty ScripHookDotNet, and Native class, everything is very easy.

It's all native. ScriptHook is just a wrapper.

 

It's simply a bug with the implementation of the new NonExistingObjectException in the new version.

 

 

If I wanted to use natives for everything, I would have just used the C++ hook.

Share this post


Link to post
Share on other sites
LMS

I'll investigate that.

Share this post


Link to post
Share on other sites
MulleDK19

 

In my opinion, it's always better to use Native functions if you know how to use them. If that works, create your own implementation class for blips using Natives. It's straightforward solution, its GTA4 native language, after all. There is a lots of function to use, even though many are still not documented well. We can't expect HazardX to do it all 100% by himself. But thanks to his migthty ScripHookDotNet, and Native class, everything is very easy.

It's all native. ScriptHook is just a wrapper.

 

It's simply a bug with the implementation of the new NonExistingObjectException in the new version.

 

 

If I wanted to use natives for everything, I would have just used the C++ hook.

Just made a small video.

 

I made excessive use of Exists() here, to prove that the object indeed does exist: http://www.treesoft.dk/gtaiv/GTAIV_ScriptH...ception_Bug.wmv

 

isInVehicle() also throws it sometimes.

Edited by MulleDK19

Share this post


Link to post
Share on other sites
FrozenFlame931

yo man when will this be updated for 1.0.0.4?

 

Share this post


Link to post
Share on other sites
Threepwood
You can use a normal native to see if someone brakes:

 

if (IsControlPressed(1,41))

 

41=brakekey.

Might sound dumb, but could you please do a short working example with it?

VC2010 Express refuses to let me use that in any way I could find.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.