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

    1. GTAForums Annual Awards 2018

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

HazardX

[BETA] GTAIV .Net ScriptHook

Recommended Posts

chrisblake

hi and thx so much for answering! the only mod i got in scripts folder right now is epm 1.0 that works for patch 7! but even if i take it out i still cant open consol with '@' key! it was the @ key to open it before though i see many use the ~ key but i have tried that too and still nothing? i just checked my .net in windows folder and i have 1.0, 1.1, 2.0, 3.0, 3.5, 4.0! i seem to be missing 2.5 but i didnt think it was needed if i have 3.5? plus i dont think 2.5 will install anyway as im on windows 7 64bit. like i said it all seems to work but the .net? i get logs from asi and script hook but no log from .net? what else can i try? thanks

Share this post


Link to post
Share on other sites
chrisblake

^^^ any ideas? still not got this working! ^^^

Share this post


Link to post
Share on other sites
HazardX
^^^ any ideas? still not got this working! ^^^

Judging from your asilog, it doesn't even try to load the ScriptHook.Net. Otherwise "[iNFO] [scriptHookDotnet] Thread started" should appear. Re-download the current version of the hook and make sure the ScriptHookDotNet.asi file is in the correct folder.

Share this post


Link to post
Share on other sites
chrisblake

hi harardx. love the work so far! been a fan for long time! thx for the reply. yh ill re download the hook! but my log now says .net at address 0x000000! so god knows whats going on there? been swappin files back and forth for days with no luck? anyway ill give that a try and edit this post after! thanks for ur help biggrin.gif

 

EDIT: no that didnt work? sad.gif here is my logs as of just now!

 

// -- GTA IV ASI LOADER LOG -- //

//-- © Alexander Blade 2008 -- //

C:\Windows\system32\dsound.dll is loaded, address 0x71AD0000

Hooking dsound proc named "DirectSoundCreate"

"DirectSoundCreate" hooked, address 0x71AD7E3D

Hooking dsound proc named "DirectSoundEnumerateA"

"DirectSoundEnumerateA" hooked, address 0x71B1D993

Hooking dsound proc named "DirectSoundEnumerateW"

"DirectSoundEnumerateW" hooked, address 0x71B1D9B0

Hooking dsound proc named "DllCanUnloadNow"

"DllCanUnloadNow" hooked, address 0x71B041BB

Hooking dsound proc named "DllGetClassObject"

"DllGetClassObject" hooked, address 0x71AD7792

Hooking dsound proc named "DirectSoundCaptureCreate"

"DirectSoundCaptureCreate" hooked, address 0x71B1D2C5

Hooking dsound proc named "DirectSoundCaptureEnumerateA"

"DirectSoundCaptureEnumerateA" hooked, address 0x71B1D9CD

Hooking dsound proc named "DirectSoundCaptureEnumerateW"

"DirectSoundCaptureEnumerateW" hooked, address 0x71B1D9EA

Hooking dsound proc named "GetDeviceID"

"GetDeviceID" hooked, address 0x71B1D160

Hooking dsound proc named "DirectSoundFullDuplexCreate"

"DirectSoundFullDuplexCreate" hooked, address 0x71B1D429

Hooking dsound proc named "DirectSoundCreate8"

"DirectSoundCreate8" hooked, address 0x71B0DE69

Hooking dsound proc named "DirectSoundCaptureCreate8"

"DirectSoundCaptureCreate8" hooked, address 0x71B1D371

Loading ASI C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Nitro.asi

ASI loaded : C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Nitro.asi, Address 0x6D7C0000

Loading ASI C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\ScriptHookDotNet.asi

ASI loaded : C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\ScriptHookDotNet.asi, Address 0x00000000

Loading ASI C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\SpeedoIV.asi

ASI loaded : C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\SpeedoIV.asi, Address 0x6D710000

Loading ASI C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Trainer.asi

ASI loaded : C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Trainer.asi, Address 0x6CE70000

 

 

 

Log start: Sat Jul 17 11:20:46 2010

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

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

[iNFO] Process base address: 0x12e0000

[iNFO] Auto detecting game version

[iNFO] Using game version 1.0.7

[iNFO] [Nitro] Thread started

[iNFO] [DXHook] Thread started

[iNFO] [simpleTrainer] Thread started

[iNFO] [speedometerIV][DXSpeedo] -> Init Skin 'Default'...

[iNFO] [speedometerIV][DXSpeedo] -> Skin 'Default' Exist...

[iNFO] [speedometerIV][DXSpeedo] -> Searching for '.\SpeedoIV\Default\Bck.png'...

[iNFO] [speedometerIV][DXSpeedo] -> '.\SpeedoIV\Default\Bck.png' found!

[iNFO] [speedometerIV][DXSpeedo] -> Searching for '.\SpeedoIV\Default\Pin.png'...

[iNFO] [speedometerIV][DXSpeedo] -> '.\SpeedoIV\Default\Pin.png' found!

[iNFO] [speedometerIV][DXSpeedo] -> Load Skin ini '.\SpeedoIV\Default\Config.ini'...

[iNFO] Car model available... spawning it!

[iNFO] Car model available... spawning it!

[iNFO] Car model available... spawning it!

[iNFO] [simpleTrainer] Thread killed

[iNFO] [DXHook] Thread killed

[iNFO] [Nitro] Thread killed

[iNFO] Script Hook - Shutdown

 

 

as u can see its still not even tryin to load it? i put the files in gta main folder like always, every thing else works just not the .net? just to be sure, the installed .net framework ive installed is in the windows folder where it shows i have 1.0 up to 4.0 and all inbetween but not 2.5 but if i remember right 2.5 would not even install as im 64bit so installer wont run! but didnt think it was needed is i got 3.5? anyway there is a microsoft.net folder in program files and in it is just 2 files, AssemblyList_4_client and AssemblyList_4_extended. not sure if that has anything to do with it? im just tryin to find answers? any other ideas as to why its still not running? thanks again hazardx smile.gif

Edited by chrisblake

Share this post


Link to post
Share on other sites
a-k-t-w

Hmm, is it possible to code with the latest scripthook in Visual Studio 2008 and without Dot Net Framework 4? I'm relying on Mobile Internet, and I can't afford to download anything over a few megabytes. user posted image

Share this post


Link to post
Share on other sites
Donny78

I'm having trouble getting weapon pickups to show up, the only success I have is when I don't set thier room, I can pick them up then but can't see them (I can always see the blips no matter what code):

 

 

Bat = Pickup.CreateWeaponPickup(...coord etc);Bat.AttachBlip();string rm_str = "R_8B6663A5_00002A06";Bat.CurrentRoom = Room.FromString(rm_str);//Bat.CurrentRoom = Room.FromString("R_8B6663A5_00002A06"); // << tried this also//Bat.CurrentRoom = Room.FromString(Player.Character.CurrentRoom.ToString()); // tried this also but I read a post which says this doesn't work

 

 

When I run debug prints in the tick I see it ignores the second bit of the string:

 

 

string str = "Room: " + Player.Character.CurrentRoom.ToString();if (Bat != null && Bat.Exists()) str += "\r\n" + Bat.CurrentRoom.ToString();Game.DisplayText(str, 5000);

 

 

This prints:

 

 

Room: R_8B6663A5_00002A06

R_8B6663A5_00000000

 

 

It's like it's dropping the last four characters or the last four bits from the value.

 

It's inside a building btw, Building128 in East Hook, first island and the complete line is:

 

 

Bat = Pickup.CreateWeaponPickup(new Vector3(758.7231f, -67.72846f, 6.829068f), Weapon.Melee_BaseballBat, 1);Bat.AttachBlip();string rm_str = "R_8B6663A5_00002A06";Bat.CurrentRoom = Room.FromString(rm_str);

 

 

Any guesses how I can sort this out ?

 

Edit:

 

I'm off the net in about three hours for about a week so if you answer me and I don't reply back then I'll make sure to say cheers, I apreciate your help.

Edited by Donny78

Share this post


Link to post
Share on other sites
Ferna_22
Hmm, is it possible to code with the latest scripthook in Visual Studio 2008 and without Dot Net Framework 4? I'm relying on Mobile Internet, and I can't afford to download anything over a few megabytes. user posted image

I tried but I couldn´t, that´s why I had to download VS2010 and .NET FW 4.0, anyway I suggest you to download them from other place (for example, friend´s Internet) and save it in a disk so you can carry it to your PC...

Share this post


Link to post
Share on other sites
chrisblake

still having problems! i tried putting .net 093 in and it loads at an address (not 0x00000...) and the .net gives a log saying patch 1070 detected, warning, not supported please update .net!

 

so it loads! meaning my problem is with .net alone and nothing to do with scripthook.dll or asi loader! ive remapped my console key so it dose not conflict with native trainer and ive also tried .net for 1060 but nothing, no log, no load! so back to .net 1714 and still loads at 0x00000... (thats a problem i guess!) and not log in SH log and no .net log!

 

has any1 got this working on patch 7 yet? please help sort this out, im lost without .net!

thank for the help so far! biggrin.gif

Share this post


Link to post
Share on other sites
ViperBond

Got my issue sorted out. ScriptHook.dll was never being loaded.

 

Dropping msvcr100.dll in my GTA4 folder did the trick. dotNET addons are being loaded now! smile.gif

Share this post


Link to post
Share on other sites
chrisblake

thanks so much ViperBond! that did the trick and got .net working for me! biggrin.gif the read me said to drop the file in windows system folder, i did that first but it didnt work, then i put it in gta4 folder like u said and it works now! thanks alot and thx for all the other help! biggrin.gif

 

Share this post


Link to post
Share on other sites
pwd

Quick question how can I get Intellesense to work on objects in VB... for example I have a pedestrian named p. When I type "p." I would like all the properties and methods to be displayed...

Share this post


Link to post
Share on other sites
Ferna_22
Quick question how can I get Intellesense to work on objects in VB... for example I have a pedestrian named p. When I type "p." I would like all the properties and methods to be displayed...

It´s automatic as far as I know, if it doesn´t appear, maybe you are not using VB2010 or you don´t have Visual Studio 2010...

Share this post


Link to post
Share on other sites
Qtwo

"I've EFLC version 1.1.2 with C++ ScriptHook and ASI Loader (xlive). When I run the game, the .net scripts doesn't work. (It's all in the right place, the scripts in the script folder and the .asi file in the main folder of EFLC)"

 

I have same problem but im using vista 64 and that c++ doesnt work for me. So what i should do?

 

"Dropping msvcr100.dll in my GTA4 folder did the trick"

 

I also tried that but it just made my game crash on launch..

Share this post


Link to post
Share on other sites
Areppon

 

So to check for a press on the with the E key on its own you can use e.Key. Or e.keyWithModifiers to check for a key press using either ctrl, alt or shift...
//check for single E key pressif(Keys.E == e.Key)//check for e with any modifierif(Keys.E == e.KeyWithModifiers)//check for key press with alt, shift or controlif(Keys.E == e.Control)f(Keys.E == e.Alt)f(Keys.E == e.Shift)

 

 

Is this (quoted bit of) tutorial for an obsolete version of the scripthook? if I type

if(Keys.E == e.Key)

I get no errors.

 

However when I try to use

if(Keys.E == e.Shift)

I get an error saying

"Operator '==' cannot be applied to operands of the type 'System.Windows.Forms.Keys' and 'bool'.

 

So what's the new way to check for a specific modifier? I need to be able to detect which modifier key is being used, so even though using

if(Keys.E == e.KeyWithModifiers)

does work properly, it's useless to me for what i need to do.

Share this post


Link to post
Share on other sites
HazardX

The quoted examples are wrong.

 

If you just want to check for B key use this:

 

if ( e.Key == Keys.B )

 

 

If you want to check for B+Shift use this instead:

 

if ( e.KeyWithModifiers == (Keys.B | Keys.Shift) )

 

 

You could also use this:

 

if ( (e.Key == Keys.B) && e.Shift )

 

 

It might also be a good idea to consider binding the key to a function instead of handling the KeyDown event.

 

BindKey(Keys.B | Keys.Shift, new KeyPressDelegate(MyKeypressFunction));

 

Edited by HazardX

Share this post


Link to post
Share on other sites
Donny78

@HazardX:

 

Any chance we could get a GetValueColor for the SettingsFile ?

 

Right now I use:

 

 

// savef.SetValue("color", vehicle.Color.Index);// loadv.Color = (ColorIndex)f.GetValueInteger("color");

 

 

Which works fine but I'd rather be able to actually write the name like "Blue" in the file and then read it out directly as I have no clue what the number in the file is (it's color value).

 

 

f.SetValue("color", v.Color);v.Color = f.GetValueColor("color");

 

 

Just makes it a bit more simple and easier to figure out what the color is in the file when viewing it or modifying it manually, or is there a way I'm not seeing, IIRC I had a way to write the color as a string in the file but had no way to read it back when it was like that.

 

Edit:

 

Also the "SetValue" for the SettingsFile doesn't have a "Model" option.

Edited by Donny78

Share this post


Link to post
Share on other sites
Symbiote

Here is a script that HazardX wrote, which is supposed to stop NPC drivers from trying to overtake you in traffic. In vanilla GTA4, if you stop at a red light, NPCs will try to drive around you.

 

This script used to work, but some people are saying it doesn't anymore. Can anyone see why it might not work?

 

 

Imports SystemImports System.Windows.FormsImports System.Collections.GenericImports Microsoft.VisualBasicImports GTAPublic Class HaltBehindScript Inherits Script Private list As New List(Of Vehicle) Private bStopped As Boolean = False Private offset As New Vector3(0.0F, -4.0F, 0.0F) Public Sub New()    'Interval = 250 End Sub Private Sub HaltBehindScript_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Tick    Dim v As Vehicle = Player.Character.CurrentVehicle    If v Is Nothing Then       If bStopped Then Disable()       Return    End If    If Not bStopped Then       If v.Speed >= 1.0F Then Return       bStopped = True    Else       If v.Speed >= 2.0F Then          Disable          Return       End If    End If    CheckForNewCar(v.GetOffsetPosition(offset))    ProcessCars() End Sub Private Sub Disable()    bStopped = False    list.Clear() End Sub Private Sub CheckForNewCar(ByVal Position As Vector3)    Dim v As Vehicle = World.GetClosestVehicle(Position, 3.0F)    If v Is Nothing OrElse list.Contains(v) Then Return    list.Add(v)    v.SetMetadata("maxspeed", False, v.Speed) End Sub Private Sub ProcessCars()    Dim CurrentSpeed As Single    Dim MaxSpeed As Single    For Each v As Vehicle In list       CurrentSpeed = v.Speed       MaxSpeed = v.GetMetadata(Of Single)("maxspeed", False)       If CurrentSpeed < MaxSpeed Then          v.SetMetadata("maxspeed", False, CurrentSpeed)       ElseIf CurrentSpeed > MaxSpeed Then          v.Speed = MaxSpeed       End If    Next End SubEnd Class 

 

Edited by AngryAmoeba

Share this post


Link to post
Share on other sites
HazardX
Here is a script that HazardX wrote, which is supposed to stop NPC drivers from trying to overtake you in traffic. In vanilla GTA4, if you stop at a red light, NPCs will try to drive around you.

 

This script used to work, but some people are saying it doesn't anymore. Can anyone see why it might not work?

Still works perfectly fine for me.

Share this post


Link to post
Share on other sites
Areppon

 

Here is a script that HazardX wrote, which is supposed to stop NPC drivers from trying to overtake you in traffic. In vanilla GTA4, if you stop at a red light, NPCs will try to drive around you.

 

This script used to work, but some people are saying it doesn't anymore. Can anyone see why it might not work?

Still works perfectly fine for me.

I notice a few things. If a car approaches me from behind when I'm stopped and stops, it will still try to overtake after a few seconds, but the script tries to prevent it from doing so. Looking back I see the car inch forward then stop every few seconds. eventually (if the light is long enough) the car will hit me, resulting in a busted tail light (my damage settings are set pretty sensitive). The other thing is that (about 40% of the time) the car will approach me from behind, realize I'm stopped (e.g. at a lights), and decide to overtake. When the car reaches my "blind spot" it will try to re-enter the lane, resulting in a collision. Another thing I notice is if I pull over and stop, the cars will continue to drive by like they're supposed to. However once in a while, if a car is close behind me when I slow down and pull over the car will get "stuck?" and fail at overtaking me once I've pulled over and come to a complete stop. Then the script will break and I have to "reloadscripts". The script will also periodically break if I pull over and sit there for a while. I've noticed this is more common on narrower (e.g. residential) roads where to avoid hitting me while I'm pulled over the approaching car will have to "move out" to the left a bit. Has anyone else noticed these things? Are there people where these things never happen? I'm still a newbie to coding and VB to me is like reading Russian, so I don't really understand how to re-write it in C#, which I understand better.

Share this post


Link to post
Share on other sites
sh86100

i used. 1.0.0.4 [patch 5]

 

this hook is not working !

 

RUN ! - LOADING ! - bye. bye. i see the desk screen

 

 

-_-;;; plz give me adv.

 

i want the 1.0.0.4 , net script hook.

i want Super Spawner Script

Super Spawner Script is need this hook

 

I had all can everything.

 

 

plz, give me advice !

monocle.gif

Share this post


Link to post
Share on other sites
Kucikuc24

OMG you need Script Hook 0.4.0 by Aru and it working for 5. patch

Share this post


Link to post
Share on other sites
sh86100
OMG you need Script Hook 0.4.0 by Aru and it working for 5. patch

my hook.dll is 0.4.0.0

no .asi file .

 

if i use hook.asi - > boom. -_-

Share this post


Link to post
Share on other sites
Kucikuc24

try to disable UAC and DEP, this can fix this problem

Share this post


Link to post
Share on other sites
mastertitsoyo

Can anyone help me with this error.

 

I can play for like 2 mins max then my game crashes but when I take off both script hook and script hook net the game runs fine.

 

 

 

 

--- GTA IV ALICE SCRIPT ENGINE ---

--- Ver : 0.9, pub : 16 December 2009 ---

--- Works in SP, MP : Free, Party mode ---

--- http://Alexander.SannyBuilder.com ---

--- http://OpenIV.com ---

--- © Alexander Blade ---

 

02:45:27 | Initialization started

02:45:27 | - Addresses ...Ok

02:45:27 | - Natives loading ...Ok

02:45:27 | - Main hook creating ...Ok

02:45:27 | - Native caller ...Ok

02:45:27 | - Natives preinit ...Ok

02:45:27 | - Natives ...Ok

02:45:27 | Initialization successful

02:45:36 | Main hook installed

02:46:00 | Loading *.ext script plugins ...

02:46:00 | Loading *.lua scripts ...

02:46:00 | Loading lua script "SitDown.lua" ...loaded

02:46:00 | Loading finished, 1 scripts and plugins loaded

 

 

 

 

// -- GTA IV ASI LOADER LOG -- //

//-- © Alexander Blade 2008 -- //

C:\Windows\system32\dsound.dll is loaded, address 0x71750000

Hooking dsound proc named "DirectSoundCreate"

"DirectSoundCreate" hooked, address 0x71757E3D

Hooking dsound proc named "DirectSoundEnumerateA"

"DirectSoundEnumerateA" hooked, address 0x7179D993

Hooking dsound proc named "DirectSoundEnumerateW"

"DirectSoundEnumerateW" hooked, address 0x7179D9B0

Hooking dsound proc named "DllCanUnloadNow"

"DllCanUnloadNow" hooked, address 0x717841BB

Hooking dsound proc named "DllGetClassObject"

"DllGetClassObject" hooked, address 0x71757792

Hooking dsound proc named "DirectSoundCaptureCreate"

"DirectSoundCaptureCreate" hooked, address 0x7179D2C5

Hooking dsound proc named "DirectSoundCaptureEnumerateA"

"DirectSoundCaptureEnumerateA" hooked, address 0x7179D9CD

Hooking dsound proc named "DirectSoundCaptureEnumerateW"

"DirectSoundCaptureEnumerateW" hooked, address 0x7179D9EA

Hooking dsound proc named "GetDeviceID"

"GetDeviceID" hooked, address 0x7179D160

Hooking dsound proc named "DirectSoundFullDuplexCreate"

"DirectSoundFullDuplexCreate" hooked, address 0x7179D429

Hooking dsound proc named "DirectSoundCreate8"

"DirectSoundCreate8" hooked, address 0x7178DE69

Hooking dsound proc named "DirectSoundCaptureCreate8"

"DirectSoundCaptureCreate8" hooked, address 0x7179D371

Loading ASI D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Alice.asi

ASI loaded : D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\Alice.asi, Address 0x01AD0000

Loading ASI D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\RagDollMod.asi

ASI loaded : D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\RagDollMod.asi, Address 0x71730000

Loading ASI D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\RDbypain.asi

ASI loaded : D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\RDbypain.asi, Address 0x716B0000

Loading ASI D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\ScriptHookDotNet.asi

ASI loaded : D:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\ScriptHookDotNet.asi, Address 0x71600000

 

 

 

 

 

010-08-01 02:45:27 - Initializing ScriptHookDotNet v0.893 BETA (GTA IV version 1.0.4.0)

2010-08-01 02:46:00 - Direct3D device created!

 

2010-08-01 02:46:00 - SEARCHING FOR SCRIPTS...

2010-08-01 02:46:00 - Loading scripts in Assembly 'scripts\TrafficFix.net.dll' ...

2010-08-01 02:46:00 - ...found script 'TrainerMenuScript.TrafficCorrect'!

2010-08-01 02:46:00 - DONE! 1 valid scripts found!

 

2010-08-01 02:46:00 - STARTING SCRIPTS...

2010-08-01 02:46:00 - Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.

at unmanaged.MemoryAccess.GetPhoneNumber()

at GTA.NetHook.CheckPhone()

at GTA.NetHook.Tick()

at StartupThreadC.RunTick(StartupThreadC* )

Share this post


Link to post
Share on other sites
Donny78

You have something like this in your script:

 

 

Ped p = World.CreatePed(pos........p.Health = ............

 

 

See how I haven't checked to see if it existed and I'm assuming it's created correctly, well doing that type of thing will cause your error (object reference, p is the object you refer to). What you need to do is this:

 

 

Ped p = World.CreatePed(pos........if (p != null && p.Exists()){   p.Health = ............}

 

 

This way the script will only try to manipulate it's attributes if the object exists. This can be any object Ped, Vehicle, GTA.Object, Blip, Checkpoint etc, anything you create which is an element in the game.

 

This is ofcourse assuming you have the source, obviously without the source you're stuck dude unless you can speak to the author of the script and have the fix it then recompile it for you.

Share this post


Link to post
Share on other sites
Intosia

 

Can anyone help me with this error.

 

I can play for like 2 mins max then my game crashes but when I take off both script hook and script hook net the game runs fine.

 

 

 

 

Phone events dont work in Windows 7. If im correct.

Share this post


Link to post
Share on other sites
Donny78

 

Can anyone help me with this error.

 

I can play for like 2 mins max then my game crashes but when I take off both script hook and script hook net the game runs fine.

 

 

 

 

Phone events dont work in Windows 7. If im correct.

I wasn't aware of this as I don't use them but I remember seeing a bunch of phone messages in my logs and thought it was wierd, thanks for pointing that out dude.

Share this post


Link to post
Share on other sites
mastertitsoyo
Can anyone help me with this error.

 

I can play for like 2 mins max then my game crashes but when I take off both script hook and script hook net the game runs fine.

 

 

 

 

Phone events dont work in Windows 7. If im correct.

I'm just trying to use Traffic Spawn 1.2 and for some odd reason it doesn't want to work I reinstalled the game several times and still get crashes I even redid my entire vehicle.img and still the game crashes but if I take script hook off and script hook net off the game doesn't I was wondering if there is any walk around this because I hate seeing the sames cars spawn repeatedly. Also, I used another mod called Traffic maker and get the same thing.

Share this post


Link to post
Share on other sites
Areppon

How do I write more than one line to a txt file? Using this

        TextWriter BashoHa = new StreamWriter("Location.txt");       public Location()       {BindKey(Keys.F12, new KeyPressDelegate(DokoNiOru)); }       void DokoNiOru()       { BashoHa.WriteLine(Player.Character.Position); BashoHa.Flush(); BashoHa.Close(); Game.DisplayText("Position recorded"); }

i can only do it once, then I have to exit the game, copy the info to a separate file, delete the original file, then go back into the game to record the next location. According to C# tut sites I've visited using 'FileNi.WriteLine("")' will write on a new line each time. But if I execute the command more than once without leaving the game the script will crash. Reloading the script via the console proves to be a hit or miss whether or not it works, crashes the game, or doesn't work.

Share this post


Link to post
Share on other sites
Donny78

 

public int WriteLineToFile(string path, string line){   if (line.Length < 1) return 0;   if (File.Exists(path))   {       StreamWriter tw = File.AppendText(path);       if (tw != null)       {           tw.WriteLine(line);           tw.Dispose();           return 1;       }   }   else   {       StreamWriter tw = File.CreateText(path);       if (tw != null)       {           tw.WriteLine(line);           tw.Dispose();           return 2;       }   }   return 0;}

 

 

Usage example:

 

 

switch (WriteLineToFile(Game.InstallPath + "\\scripts\\myfile.txt", "kaboom...")) {   case 0:        Game.DisplayText("Unable to write to file.", 5000); // file not found/created or string length was 0       break   case 1:        Game.DisplayText("Line appended to file!", 5000); // appended       break   case 2:        Game.DisplayText("Line written to file!", 5000); // created then written       break}

 

 

A bit long for an example but should work and I wrote all that code out in here so it could have typos.

Share this post


Link to post
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

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

×

Important Information

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