Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    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. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. 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. Red Dead Redemption 2

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

    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
    1. Announcements

    2. Forum Support

    3. Suggestions

[BETA] GTAIV .Net ScriptHook


HazardX
 Share

Recommended Posts

Weird, my game doesn't load with "ScriptHookDotNet.asi" on the root folder. Other .asi files works nicely.

I've tried running it alone, but it's a no go too.

 

Both logfiles I found doesn't have any interesting information...

 

 

2011-11-25 19:04:47 - Initializing ScriptHookDotNet v1.7.1.7 BETA (on GTA IV version 1.0.7.0 with C++ Hook version 0.5.1)

 

 

Log start: Fri Nov 25 19:53:48 2011

-----------------------------------------------

[iNFO] GTA IV Script Hook 0.5.1 - © 2009, Aru - Initialized

[iNFO] Process base address: 0x2e0000

[iNFO] Auto detecting game version

[iNFO] Using game version 1.0.7

[iNFO] (ELS) Script started: V6-R1.13-091110

[iNFO] (ELS) File - CMID 0, ADMIRAL off.

[iNFO] (ELS) File - CMID 1, AIRTUG off.

[iNFO] (ELS) File - CMID 2, AMBULANCE active - els_cmid 1.

[iNFO] (ELS) File - CMID 3, BANSHEE off.

[iNFO] (ELS) File - CMID 4, BENSON off.

[iNFO] (ELS) File - CMID 5, BIFF off.

[iNFO] (ELS) File - CMID 6, BLISTA off.

[iNFO] (ELS) File - CMID 7, BOBCAT off.

[iNFO] (ELS) File - CMID 8, BOXVILLE off.

[iNFO] (ELS) File - CMID 9, BUCCANEER off.

[iNFO] (ELS) File - CMID 10, BURRITO off.

[iNFO] (ELS) File - CMID 11, BURRITO2 off.

[iNFO] (ELS) File - CMID 12, BUS off.

[iNFO] (ELS) File - CMID 13, CABBY off.

[iNFO] (ELS) File - CMID 14, CAVALCADE off.

[iNFO] (ELS) File - CMID 15, CHAVOS off.

[iNFO] (ELS) File - CMID 16, COGNOSCENTI off.

[iNFO] (ELS) File - CMID 17, COMET off.

[iNFO] (ELS) File - CMID 18, COQUETTE off.

[iNFO] (ELS) File - CMID 19, DF8 off.

[iNFO] (ELS) File - CMID 20, DILETTANTE off.

[iNFO] (ELS) File - CMID 21, DUKES off.

[iNFO] (ELS) File - CMID 22, E109 off.

[iNFO] (ELS) File - CMID 23, EMPEROR off.

[iNFO] (ELS) File - CMID 24, EMPEROR2 off.

[iNFO] (ELS) File - CMID 25, ESPERANTO off.

[iNFO] (ELS) File - CMID 26, FACTION off.

[iNFO] (ELS) File - CMID 27, FBI active - els_cmid 2.

[iNFO] (ELS) File - CMID 28, FELTZER off.

[iNFO] (ELS) File - CMID 29, FEROCI off.

[iNFO] (ELS) File - CMID 30, FEROCI2 off.

[iNFO] (ELS) File - CMID 31, FIRETRUCK active - els_cmid 3.

[iNFO] (ELS) File - CMID 32, FLATBED off.

[iNFO] (ELS) File - CMID 33, FORTUNE off.

[iNFO] (ELS) File - CMID 34, FORKLIFT off.

[iNFO] (ELS) File - CMID 35, FUTO off.

[iNFO] (ELS) File - CMID 36, FXT off.

[iNFO] (ELS) File - CMID 37, HABANERO off.

[iNFO] (ELS) File - CMID 38, HAKUMAI off.

[iNFO] (ELS) File - CMID 39, HUNTLEY off.

[iNFO] (ELS) File - CMID 40, INFERNUS off.

[iNFO] (ELS) File - CMID 41, INGOT off.

[iNFO] (ELS) File - CMID 42, INTRUDER off.

[iNFO] (ELS) File - CMID 43, LANDSTALKER off.

[iNFO] (ELS) File - CMID 44, LOKUS off.

[iNFO] (ELS) File - CMID 45, MANANA off.

[iNFO] (ELS) File - CMID 46, MARBELLA off.

[iNFO] (ELS) File - CMID 47, MERIT off.

[iNFO] (ELS) File - CMID 48, MINIVAN off.

[iNFO] (ELS) File - CMID 49, MOONBEAM off.

[iNFO] (ELS) File - CMID 50, MRTASTY off.

[iNFO] (ELS) File - CMID 51, MULE off.

[iNFO] (ELS) File - CMID 52, NOOSE active - els_cmid 4.

[iNFO] (ELS) File - CMID 53, NSTOCKADE active - els_cmid 5.

[iNFO] (ELS) File - CMID 54, ORACLE off.

[iNFO] (ELS) File - CMID 55, PACKER off.

[iNFO] (ELS) File - CMID 56, PATRIOT off.

[iNFO] (ELS) File - CMID 57, PERENNIAL off.

[iNFO] (ELS) File - CMID 58, PERENNIAL2 off.

[iNFO] (ELS) File - CMID 59, PEYOTE off.

[iNFO] (ELS) File - CMID 60, PHANTOM off.

[iNFO] (ELS) File - CMID 61, PINNACLE off.

[iNFO] (ELS) File - CMID 62, PMP600 off.

[iNFO] (ELS) File - CMID 63, POLICE active - els_cmid 6.

[iNFO] (ELS) File - CMID 64, POLICE2 active - els_cmid 7.

[iNFO] (ELS) File - CMID 65, POLPATRIOT active - els_cmid 8.

[iNFO] (ELS) File - CMID 66, PONY off.

[iNFO] (ELS) File - CMID 67, PREMIER off.

[iNFO] (ELS) File - CMID 68, PRESIDENTE off.

[iNFO] (ELS) File - CMID 69, PRIMO off.

[iNFO] (ELS) File - CMID 70, PSTOCKADE active - els_cmid 9.

[iNFO] (ELS) File - CMID 71, RANCHER off.

[iNFO] (ELS) File - CMID 72, REBLA off.

[iNFO] (ELS) File - CMID 73, RIPLEY off.

[iNFO] (ELS) File - CMID 74, ROMERO off.

[iNFO] (ELS) File - CMID 75, RUINER off.

[iNFO] (ELS) File - CMID 76, SABRE off.

[iNFO] (ELS) File - CMID 77, SABRE2 off.

[iNFO] (ELS) File - CMID 78, SABREGT off.

[iNFO] (ELS) File - CMID 79, SCHAFTER off.

[iNFO] (ELS) File - CMID 80, SENTINEL off.

[iNFO] (ELS) File - CMID 81, SOLAIR off.

[iNFO] (ELS) File - CMID 82, SPEEDO off.

[iNFO] (ELS) File - CMID 83, STALION off.

[iNFO] (ELS) File - CMID 84, STEED off.

[iNFO] (ELS) File - CMID 85, STOCKADE off.

[iNFO] (ELS) File - CMID 86, STRATUM off.

[iNFO] (ELS) File - CMID 87, STRETCH off.

[iNFO] (ELS) File - CMID 88, SULTAN off.

[iNFO] (ELS) File - CMID 89, SULTANRS off.

[iNFO] (ELS) File - CMID 90, SUPERGT off.

[iNFO] (ELS) File - CMID 91, TAXI off.

[iNFO] (ELS) File - CMID 92, TAXI2 off.

[iNFO] (ELS) File - CMID 93, TRASH off.

[iNFO] (ELS) File - CMID 94, TURISMO off.

[iNFO] (ELS) File - CMID 95, URANUS off.

[iNFO] (ELS) File - CMID 96, VIGERO off.

[iNFO] (ELS) File - CMID 97, VIGERO2 off.

[iNFO] (ELS) File - CMID 98, VINCENT off.

[iNFO] (ELS) File - CMID 99, VIRGO off.

[iNFO] (ELS) File - CMID 100, VOODOO off.

[iNFO] (ELS) File - CMID 101, WASHINGTON off.

[iNFO] (ELS) File - CMID 102, WILLARD off.

[iNFO] (ELS) File - CMID 103, YANKEE off.

[iNFO] (ELS) File - CMID 104, FAGGIO off.

[iNFO] (ELS) File - CMID 105, HELLFURY off.

[iNFO] (ELS) File - CMID 106, NRG900 off.

[iNFO] (ELS) File - CMID 107, PCJ off.

[iNFO] (ELS) File - CMID 108, SANCHEZ off.

[iNFO] (ELS) File - CMID 109, ZOMBIE off.

[iNFO] (ELS) File - CMID 110, POLICE3 off.

[iNFO] (ELS) File - CMID 111, POLICE4 off.

[iNFO] (ELS) File - CMID 112, POLICEB off.

[iNFO] (ELS) File - vehicle properties retrieved.

[iNFO] (ELS) File - information retrieved.

 

 

GTA IV 1.0.7.0, Windows 7 Home Premium x64 - Barebone setup (Maybe this? Maybe a disabled service or something?)

 

I've installed all required files from the first page...

Link to comment
Share on other sites

 

I'm trying to trigger events at certain times, i.e. change ped.density, vehicle.density etc. I'm using game.gametime and having no luck:

 

If game.gametime = 18 Then           World.CarDensity = 0.0           World.PedDensity = 2.0           game.displaytext("Testing")       End If

 

 

I have it set on a tick of 400, i've tried up to a tick of 1000 and as low as 200. Every game Hour = 120 seconds (2 minutes tounge.gif) so i know if it were going to hit it would have. I have seen no text, and i've seen no changes in ped density or vehicle density at this time.

 

If i use:

 

If game.gametime > 18 Then

 

 

Then the effect stays on constantly, all game day long. < , <=, =, >= don't function properly either.

 

What i would like to see is:

 

 

If game.gametime >= 18 andalso game.gametime <= 19 Then           World.CarDensity = 0.0           World.PedDensity = 2.0           game.displaytext("Testing")       End If

 

 

I'm running current .net scripthook and scripthook v0.5.1

Any thoughts or help would be greatly appreciated smile.gif

Link to comment
Share on other sites

I think GameTime is in milliseconds, so I recommend using World.CurrentDate.Hour instead.

 

Also, I've found that setting the script Interval in VB.NET doesn't work as expected, at least for me. (Interval of 1000 still results in Tick() executing very fast.) It works fine in C#, though.

Link to comment
Share on other sites

@AngryAmoeba

Thanks, i'll give it a shot!

 

EDIT:

worked like a charm... thanks!

Edited by motorsport71
Link to comment
Share on other sites

  • 2 weeks later...
I got this error with script for Visible Armour.

 

When I start the game it says on screen:

Error in script 'ArmourMod'!

 

In console this are the related messages (searching and loading went fine so I ain't copying that one, only the one from starting lines).

 

...sucessfully starter script 'AmourMod'!

Error during tick in script 'ArmourMod':

System.MissingMethodExeption: Method not found: 'Int32

GTA.value.PedSkin.GetComponentModel (GTA.PedComponent)'.

   at ArmourMod.CheckArmour (Object sender, EventArgs e)

   at GTA.Script.TryTick()

   at GTA,Script.DoTick()

   at GTA.ScriptThread.OnTick()

 

Doesn anyone know what's it about?

i have same problem and im going crazy trying to fix...i wish someone would help us confused.gif

Link to comment
Share on other sites

If you both have the latest script hook already, it sounds like maybe the mod was made for an older version of the hook, using a function that has since been removed.

Link to comment
Share on other sites

lindsayslorach

Yeah, exactly what AngryAmoeba said. The error tells you what went wrong, in your case "MissingMethodException" says that it couldn't find the method (function).

 

Just saying for future reference smile.gif

Link to comment
Share on other sites

  • 3 weeks later...

Will the scripts folder work with it? I mean the latest version already has the other two files (scripthookdotnet.asi and the scripts folder) already in it while your mirror doesn't has it. Do I only have to replace the .dll?

 

And another thing is that I had a scripthook whose text file said it's 0.893 (or something similar) but when I tried to run gta iv, it showed 2 same messages saying scripthook has a problem and then ran fine. But when I tried to move my player a few steps, the game crashed. When I removed scripthook, the game worked fine. And I have the 1.0.4.0 version.

Link to comment
Share on other sites

Yes, just replace the ScriptHook.dll file.

 

And 0.893 is very outdated. Use the latest version, 1.7.1.7.

Link to comment
Share on other sites

What .Net language do i need to program here in to read/write gtaiv.exe to memory?

I found GTA.MemoryStream

Edited by fastman92
Link to comment
Share on other sites

  • 2 weeks later...

Stupid question, since I seem to be the only guy who doesn't know it. How do I open the console? Is it possible to recompile a script and reload it trough the console?

Link to comment
Share on other sites

Stupid question, since I seem to be the only guy who doesn't know it. How do I open the console? Is it possible to recompile a script and reload it trough the console?

If you have a US English Keyboard then it is the tilda/single quote button above the tab button

 

(`~)

Link to comment
Share on other sites

Stupid question, since I seem to be the only guy who doesn't know it. How do I open the console? Is it possible to recompile a script and reload it trough the console?

If you have a US English Keyboard then it is the tilda/single quote button above the tab button

 

(`~)

Thank you, I found out that it's the ä key on my swiss-german keyboard and that you can reload the scripts.

 

Other question: Anyway to prevent World.getClosestVehicle from selecting the car I'm driving in?

Link to comment
Share on other sites

???

 

 

Vehicle closestVehicle = World.GetClosestVehicle(Vector3 blahblah);if (Player.Character.CurrentVehicle == closestVehicle)   continue;//do sumthin with closestVehicle

 

 

i did not test btw, just trying to throw out ideas.

 

edit: i accidently indented where u should put instructions for the closest vehicle that is not yours. Oh thanks AA for the correction.

Edited by jitsuin
Link to comment
Share on other sites

That's what I don't want tounge.gif

 

When I'm driving a car, then the closest car, is my car. But I'd like to get the car which is the closest to my car. smile.gif

 

Edit: Haha, what a sentence

 

Edit2: How do I get an ped out of a vehicle?

 

Edit3: And another question: How do I create input fields or menus, so I can choose between things, like in a car spawner.

Edited by ahatius
Link to comment
Share on other sites

 

That's what I don't want tounge.gif

 

When I'm driving a car, then the closest car, is my car. But I'd like to get the car which is the closest to my car. smile.gif

 

Edit: Haha, what a sentence

 

Edit2: How do I get an ped out of a vehicle?

 

Edit3: And another question: How do I create input fields or menus, so I can choose between things, like in a car spawner.

yeah the code i wrote will tell the script to start over if the closest vehicle is the player's current vehicle. Meaning it won't do anything with the current vehicle of the player. So where i wrote "do stuff" that's the instructions for the closestvehicle that is not the player's vehicle wink.gif I knew what u wanted...lol

 

and ur other questions just asked a whole bunch. I wrote an open source script that displays the date and time. Basically i draw graphics on screen. Maybe it can help u with a user interface for your trainer. It's a bonus script i included in my hit detector and i left open source. Just covert it to draw whatever u want. smile.gif

 

 

ped.Task.ExitVehicle();// or...ped.Task.LeaveVehicle();// i forget but one of those

 

Link to comment
Share on other sites

Ahh, I see tounge.gif

 

Thanks alot, I'll have a look at your HitDetector. Guess I can find it trough your posts.

 

Edit: Sorry for so much questions, but I've got another think I'd like to know. Is there a limitation for World.GetPeds()? I've tried the following:

 

Ped[] peds = World.GetPeds(Player.Character.Position, 99999999999999999999999999999999999999.9f, 999999999);               Vector3 playerPos = Player.Character.Position;               playerPos.Z += 50;                              foreach (Ped singlePed in peds) {                   singlePed.Position = playerPos;               }

 

 

But I still see some npcs which aren't affected by this. As you can see, I even tried to put the limit values higher, but still some NPCs don't get ported.

Edited by ahatius
Link to comment
Share on other sites

Also tried GetAllPeds, but still the same problem. Maybe I should get them out of the vehicle first. For that I tried Task.LeaveVehicleImmediately as you said, but unlike Task.LeaveVehicle this function wants an object as parameter, and I don't know how to retrieve the car of an ped as an object :\

 

Is there any kind of Wiki for all those objects and what they exactly do and what they return? I've got the help file, but sometimes it's a bit complicated for me to understand, since there's not much more than parameters to be entered? Probably would also lower the amount of questions I'm asking here tounge.gif

 

Edit: Ok, just trying to get them out (with Task.LeaveVehicle), without changing their position doesn't work either for Peds who are further away.

Edited by ahatius
Link to comment
Share on other sites

Yeah i think there is a limit to the amount of peds added to the array.

 

Try pulling an array and adding the specific peds from the array you want to a List

 

A list is an array too but you choose what gets added to it smile.gif

 

The object parameter is closestVehicle i think

 

edit: Now that I think about it, Lists actually might now work since the problem is pulling from the array in the first place...sorry i was dumb there. Maybe you should narrow the type of ped u want to find or is it u want everyone no matter what type of ped?

Edited by jitsuin
Link to comment
Share on other sites

GetAllPeds() won't actually return all peds, because not all peds are really "peds". Some of them are just dummy peds, like LOD models. Thanks to MulleDK for this info. wink.gif

 

How to get the car of a ped as an object: Ped.CurrentVehicle

 

To get the nearest car that isn't your car, maybe something like this:

 

// Vector3.Around() gets a random coord around the given coord, within the given rangeVehicle theVehicle = World.GetClosestVehicle(Player.Character.Position.Around(10.0F), 5.0F);if (Player.Character.CurrentVehicle != theVehicle) {   // Do stuff}

 

 

Edit: Forgot the range argument for GetClosestVehicle()

Edited by AngryAmoeba
Link to comment
Share on other sites

thanks AA!

 

ah so GetClosestVehicle needs to be defined Vehicle and not as a Model...my bad blush.gif

 

edit: AHA! dummy peds, makes sense, thanks for the tip oh and to MulleDK19 too

Edited by jitsuin
Link to comment
Share on other sites

There's a function to get the targeted ped. Is there also one for vehicles? Or is there a workaround to get the targeted car?

Link to comment
Share on other sites

I have a problem.

I am on patch 4 i.e., 1.0.4 and the problem is, i can bring up the console and all, but when i type spawn Addedcarname it says "Script not found" And "Model Invalid"

i know i have added the cars correctly and double checked everything.

Is there an older version of dotnet for p4?

 

this is what my logfile says:

 

2012-01-14 04:58:58 - Initializing ScriptHookDotNet v1.7.1.4 BETA (GTA IV version 1.0.4.0)2012-01-14 05:00:35 - Direct3D device created!2012-01-14 05:00:37 - SEARCHING FOR SCRIPTS...2012-01-14 05:00:37 - DONE! No DotNet script found!2012-01-14 05:00:37 - Error during GetPhoneNumber (Phone checks will be disabled):                     System.Exception: Accessing Globals failed! Invalid Memory Address!                        at unmanaged.MemoryAccess.GetGlobalAddress(Int32 index)                        at unmanaged.MemoryAccess.GetPhoneNumber()                        at GTA.NetHook.CheckPhone()2012-01-14 05:11:50 - Direct3D device lost!

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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