Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,225 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

HazardX

[BETA] GTAIV .Net ScriptHook

Recommended Posts

empirestate

I have a difficulty installing this bus driver mod. I have win 7, x64 and GTA IV version 1.0.7.0. I have put latest .net Scripthook Version 1.7.1.6 into GTA IV main directory, and I also put bus driver mod in scripts folder. I followed the requirements to have - Microsoft .Net Framework 4 and Microsoft Visual C++ 2010 Redistributable Package (x86) installed on my pc. Also I put Yassil asi loader (dsound.dll) in the main GTA IV directory. But when pressing PageUp button the mod doesnt start. I have also tried to to laund the game as administrator, set compatability to windows Xp, service pack 3. Still mod wont load. Maybe someone has an idea, what might be the problem? smile.gif

Share this post


Link to post
Share on other sites
pedro2555
Hi there,

I'm currently writing a mod in C#.

Everything works fine but now that I like to add something that is triggered by a specific phone number I'm stuck.

I have read in your initial post that the PhoneNumberDialed event don't work on Windows 7 machines (any clue why not?).

So I tried the BindPhoneNumber method but that won't work either.

Two questions about it:

1. What convention do I have to use for the phone number string? Is it like "XYZ 555 0100"?

Do I have to use whitespaces in-between? Is the 555 sequence in the middle a must?

I guess I can use letters or numbers for the first sequence, right?

Can I use any 3-digit number from 000 to 999 for the first sequence?

Can I use any 4-digit number from 0000 to 9999 for the last sequence?

 

2. What else do I have to do besides using this method?

Currently all I have done for the phone handling is this piece of code (the ImmediateShutDown method is fully functional):

 

BindPhoneNumber("LSX5550100", ImmediateShutDown);

 

BTW a new PhoneDialDelegate instance is redundant so I skipped it.

 

Oh and I like to add: the phone numbers of the fuel mod don't work either in my game. Maybe that helps.

 

EDIT: I peeked into the .Net scripthook via ILSpy and found the Helper.CleanPhoneNumber method. So that clarifies my questions about the whitespaces and the letters but the other questions remain.

Anyway I wonder why nothing happens when I dial that number in the game.

Phone dial events still do not work on Windows 7! - quoting hazardx.

 

Have you noticed .NET Scripthook is open source ?! You don't need ILSpy, just Visual Studio.

 

Nothing happens because the allocation zone for the dialed number isn't the same as the one scripthook watches for.

Share this post


Link to post
Share on other sites
Jeansowaty

12363w8.jpg

Why do I have this damn error when starting GTA4? And this doesn't work.

Share this post


Link to post
Share on other sites
65536

12363w8.jpg

Why do I have this damn error when starting GTA4? And this doesn't work.

I also have a ScriptHook and it have an annoying bug - it makes my GTA IV 1.0.7.0 to crash sometimes while loading... I checked all versions I've found compatible with last patch and I found all have and uses a same buggy ScriptHook.dll file:

 

Size: 328 KB (336 384 bytes)

Modified: 28 ‎May ‎2010, ‏‎17:52:44

 

There is even an another version of ScriptHook compatible with GTA IV 1.0.7.0 uses a ScriptHook.dll DIFFERENT than the one noted above?!? Because I'm tired from those crashes while my GTA IV loads... I'm only using Simple Native Trainer 6.3 and playing Criminal Russia RAGE map total conversion... If I remove that buggy ScriptHook.dll, the trainer won't work at all... What to do??? Can someone tell me for a version that does NOT have that bug...

Edited by 65536

Share this post


Link to post
Share on other sites
Jeansowaty

I managed to fix these crashes by installing the More Safehouses mod by SkorPro :) Now my IV works fine with no glitches at all!

Share this post


Link to post
Share on other sites
cp1dell

Has anyone figured out a way to fix the indoor rain bug with the Scripthook's .asi? I really want to do another playthrough of GTA IV+EFLC with some script to really change the gameplay, but the indoor rain bug is just so screwy.

Share this post


Link to post
Share on other sites
LordOfTheBongs

Has anyone figured out a way to fix the indoor rain bug with the Scripthook's .asi? I really want to do another playthrough of GTA IV+EFLC with some script to really change the gameplay, but the indoor rain bug is just so screwy.

i havent noticed the indoor rainbug since i updated to 1.0.7... are u on 1.0.4?

Share this post


Link to post
Share on other sites
cp1dell

Nope, 1.0.7.0. Maybe I have a weird version. It is in fact this one, right?

Share this post


Link to post
Share on other sites
123iamking

Is there anyway make the alpha factor work on the pictures that modders add to game? I mean make those picture fade slowly and disappear.
like this

e.Graphics.DrawSprite(Picture, CENterX, CENterY, 158.0f, 158.0f, 0.0f, Color.FromArgb(AlpHal, Color.Transparent));if (AlpHal<0) AlpHal = 255;AlpHal--;

Share this post


Link to post
Share on other sites
LordOfTheBongs

 

Is there anyway make the alpha factor work on the pictures that modders add to game? I mean make those picture fade slowly and disappear.

like this

e.Graphics.DrawSprite(Picture, CENterX, CENterY, 158.0f, 158.0f, 0.0f, Color.FromArgb(AlpHal, Color.Transparent));if (AlpHal<0) AlpHal = 255;AlpHal--;

 

best to use multiple images with different levels of opacity and chosse the appropriate texture to draw, u need to load more textures is the trade

Share this post


Link to post
Share on other sites
123iamking

 

 

Is there anyway make the alpha factor work on the pictures that modders add to game? I mean make those picture fade slowly and disappear.

like this

e.Graphics.DrawSprite(Picture, CENterX, CENterY, 158.0f, 158.0f, 0.0f, Color.FromArgb(AlpHal, Color.Transparent));if (AlpHal<0) AlpHal = 255;AlpHal--;

 

best to use multiple images with different levels of opacity and chosse the appropriate texture to draw, u need to load more textures is the trade

 

I have already thought of that but I don't want the computer load too much. We need more space for other mods.

Share this post


Link to post
Share on other sites
InfamousSabre

 

 

 

Is there anyway make the alpha factor work on the pictures that modders add to game? I mean make those picture fade slowly and disappear.

like this

e.Graphics.DrawSprite(Picture, CENterX, CENterY, 158.0f, 158.0f, 0.0f, Color.FromArgb(AlpHal, Color.Transparent));if (AlpHal<0) AlpHal = 255;AlpHal--;

 

best to use multiple images with different levels of opacity and chosse the appropriate texture to draw, u need to load more textures is the trade

 

I have already thought of that but I don't want the computer load too much. We need more space for other mods.

 

As you have already found, it is not possible with the current Scripthook. Maybe a future version will support it, but for now you'll have to resort to fancy tricks or multiple textures.

Share this post


Link to post
Share on other sites
onlyTMJ

How can you spawn a vehicle facing a certain direction??

 

Vehicle bv3 = World.CreateVehicle("POLICE", bl3);
bv1.Rotation = west;
bv1.FreezePosition = true;
ive done this, with west being a vector 3 with the last variable being 270 degrees
But the cars dont change in any ordered manner

Share this post


Link to post
Share on other sites
LordOfTheBongs

 

How can you spawn a vehicle facing a certain direction??

 

Vehicle bv3 = World.CreateVehicle("POLICE", bl3);
bv1.Rotation = west;
bv1.FreezePosition = true;
ive done this, with west being a vector 3 with the last variable being 270 degrees
But the cars dont change in any ordered manner

 

it is easier to set the car's heading...

float west = 270f; bv1.Heading = west;

And what do u mean when u say "But the cars dont change in any ordered manner" ... what are u trying to say?

Edited by LordOfTheBongs

Share this post


Link to post
Share on other sites
gtagamer9

Hi everyone , im new here but i want to ask if someone can fix this . I have a crash with the watch dogs mod from wojtanis .

Here is my scripthookdotnet.log

2014-04-30 09:05:50 - Initializing ScriptHookDotNet v1.7.1.7 BETA (on GTA IV version 1.0.7.0 with C++ Hook version 0.5.1)
2014-04-30 09:06:51 - Direct3D device created!

2014-04-30 09:06:51 - SEARCHING FOR SCRIPTS...
2014-04-30 09:06:51 - Loading scripts in Assembly 'scripts\IceBaby.net.dll' ...
2014-04-30 09:06:51 - ...found script 'IceBaby.IceBaby_Rinepim'!
2014-04-30 09:06:51 - Loading scripts in Assembly 'scripts\VCopMusic.net.dll' ...
2014-04-30 09:06:51 - ...found script 'Ambiance'!
2014-04-30 09:06:51 - Loading scripts in Assembly 'scripts\Watch_Dogs.net.dll' ...
2014-04-30 09:06:51 - ...found script 'Watch_Dogs.Watch_Dogs_Rinepim'!
2014-04-30 09:06:51 - Loading dynamic scriptfile 'scripts\Aidenmove.cs' ...
2014-04-30 09:06:52 - ...found script 'AidenMove.CopGun'!
2014-04-30 09:06:52 - DONE! 4 valid scripts found!

2014-04-30 09:06:52 - STARTING SCRIPTS...
2014-04-30 09:06:52 - INFO: Phone number checks are not available!
2014-04-30 09:06:52 - ...successfully started script 'AidenMove.CopGun'!
2014-04-30 09:06:52 - ...successfully started script 'Ambiance'!
2014-04-30 09:06:52 - ...successfully started script 'IceBaby.IceBaby_Rinepim'!
2014-04-30 09:06:53 - ...successfully started script 'Watch_Dogs.Watch_Dogs_Rinepim'!
2014-04-30 09:07:29 - Error during NetHook.Tick:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Scripting.NativeContext2.Invoke(SByte* name, NativeContext2* cxt)
at GTA.Native.Function.BaseCall(String Name, Parameter[] Arguments)
at GTA.Native.Function.Call(String Name, Parameter[] Arguments)
at GTA.Native.Template.Invoke()
at GTA.ScriptDomain.RemoteEvent(RemoteEventArgs ev)
at GTA.ScriptDomain.ProcessRemoteEvents()
at GTA.ScriptDomain.Tick()
at GTA.NetHook.Tick()

 

Sorry for bad english

Share this post


Link to post
Share on other sites
pedro2555

You have 4 scripts loading, are you sure it happens because of watch dogs? Have you tried to isolate watch dogs?

Edited by pedro2555

Share this post


Link to post
Share on other sites
LordOfTheBongs

u should pm the author, he is on here randomly and currently active... it looks like some native he is using is being used in a way that it wasnt meant for. He could be using the wrong parameters or maybe he is using something he didnt check for existence. Only he could help or u put his dll in a reflector and paste the code on pastebin

Share this post


Link to post
Share on other sites
gtagamer9

Can u please explain how to do , i dont know much about scripts .

 

I downloaded .net reflector and i dont understand.

 

sorry for bad english :/

Share this post


Link to post
Share on other sites
LordOfTheBongs

Can u please explain how to do , i dont know much about scripts .

 

I downloaded .net reflector and i dont understand.

 

sorry for bad english :/

i use ILSpy since it is free... but .net reflector works too, i just have never used

 

so this program can take dll files that have compiled .net code and it recreates the code in c# or vb, so u need to add 2 dlls to this program...

 

1. scripthookdotnet.asi

2. gta .net script

 

Then u should be able to look at the code in the gta script in c#, that code needs to be edited possibly. You really should just PM the author, he will respond, i see him posting here all the time. But just do what I said. If you are lost just ask.

Share this post


Link to post
Share on other sites
Jeansowaty

Okay. Scripthook is the least stable mod on the black market. I removed it, GTA4 works - no script mods.

Added back - crash.

Edited by Jeansowaty

Share this post


Link to post
Share on other sites
Trigger_85

Hi there

I have problem. I've been useing Traffic Load mod which work with asi. I think it is the best traffic mod, but it keep on crashing my game after a while of play, so it is unplayable. So I switched to Traffic Flow which works with .NET Scripthook. It works much better. It keep on crashing when I spawn too many cars for my own but it is stable enough when the mod keep spawning random cars normally. It is good enough for me. Problem is, even I have latest patch installed I'm having rain bug all the time. So far I tried reinstalling the game and installing patch manually (not from Games for Windows self update) but the bug still occur. Anyone can help me with rain bug?

Share this post


Link to post
Share on other sites
NTAuthority

Okay. Scripthook is the least stable mod on the black market. I removed it, GTA4 works - no script mods.

Added back - crash.

what do you expect from /clr code

Share this post


Link to post
Share on other sites
Jeansowaty

Nevermind, I repaired the game. Turns out the Trainer.ini garbled itself somehow o_O

Share this post


Link to post
Share on other sites
Rugz007

Man can I get the source in c# ?

Share this post


Link to post
Share on other sites
Jitnaught

Man can I get the source in c# ?

 

The source is in C++, there isn't any changing that.

Share this post


Link to post
Share on other sites
GTAHitman47

i installed every thing on my gta iv v1.0.7.0 but the script mods not working but asi mods are working perfect

any help please

Share this post


Link to post
Share on other sites
Jitnaught

i installed every thing on my gta iv v1.0.7.0 but the script mods not working but asi mods are working perfect

any help please

Did you copy the .NET mods to the scripts folder?

Share this post


Link to post
Share on other sites
GTAHitman47

ok thanks for ur help script mods worked after re-installing my windows

Share this post


Link to post
Share on other sites
Cyron43

It's great to see this forum is still active. :)
So here is another problem: I try to let my Player.Character walk to a waypoint but Task.Goto seems to not work.

Player.Character.BlockPermanentEvents = true;Player.Character.Task.ClearAll();Game.LoadAllPathNodes = true;Player.Character.Task.GoTo(Game.GetWaypoint().Position);

This code does nothing, unfortunately. Luis just stands there while

Player.Character.Task.WanderAround();

works as expected (I use that when there is no waypoint given).
I have also tried a native function call

      private void MyGoto(Vector3 waypoint, byte moveType)      {         Function.Call("TASK_GO_STRAIGHT_TO_COORD", new Parameter[]                                                                {                                                                   Player.Character,                                                                   waypoint.X,                                                                   waypoint.Y,                                                                   waypoint.Z,                                                                   moveType,                                                                   -1                                                                });      }

but that doesn't help it.
I'd appreciate help with this.

EDIT for update
I found a native function which makes Luis walk at least. Alas he just walks in a straight line. No path routing or stop at a red traffic light. :cry:

         Function.Call("TASK_CHAR_SLIDE_TO_COORD", new Parameter[]                                                   {                                                      ped,                                                      waypoint.X,                                                      waypoint.Y,                                                      waypoint.Z,                                                      0,                                                      1                                                   });
Edited by Cyron43

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

×

Important Information

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