Quantcast

Jump to content

» «
Photo

[BETA] GTAIV .Net ScriptHook

2,938 replies to this topic
Southern_Smoke
  • Southern_Smoke

    Player Hater

  • Members
  • Joined: 18 Jun 2011

#2851

Posted 24 May 2012 - 10:49 AM

Hey Guys,

i need your help. I need a simple script, which creates cars.
For example:

1) Admiral, xxx, xx, yyy, yy, zz, zzz, Doorlock=true, Alarm=off
2) Banshee, xxx, xx, yyy, yy, zz, zzz, Doorlock=true, Alarm=off

Only a VB script....can you help me?

Threepwood
  • Threepwood

    Calm like a bomb.

  • Members
  • Joined: 13 Jul 2008

#2852

Posted 29 May 2012 - 08:34 AM

Hey guys.. what opportunities do I have to manipulate car characteristics also known as handling? Grip and height position..

Any hint would be helpful, thanks smile.gif

Driftking120
  • Driftking120

    Madman

  • Members
  • Joined: 16 Jun 2010

#2853

Posted 29 May 2012 - 10:07 PM

Hi there,
I think the file you are looking for is called "handling.dat".
It helps manipulate grip and ride height, Rob.Zombie makes a lot of handling lines for Smokey's cars,
so maybe he could help you with getting started.

Threepwood
  • Threepwood

    Calm like a bomb.

  • Members
  • Joined: 13 Jul 2008

#2854

Posted 30 May 2012 - 05:55 AM

Thanks Driftking, thats common knowledge for a modder like I am wink.gif You meant it good I guess.
But take a look were we are here, in the .NET Scripthook topic.. so its kinda obvious I ask for a way to do it with .NET.. wink.gif

wilus0503
  • wilus0503

    Player Hater

  • Members
  • Joined: 02 Jun 2012

#2855

Posted 03 June 2012 - 03:01 PM

i'm sorry for my weak english.

My problem relies on it, that scripthookdotnet.asi it is not started.

In GTAIV main folder, file of notebook scripthookdotnet does not appear.

I had versions earlier 1.0.4.0, and scripthookdotnet.asi Version 0.893 BETA worked correctly , but doesn't work some mods.
I have decided modernize GTAIV to 1.0.7.0 and use "GTAIV .Net Script Hook v1.7.1.7 BETA" .

but.. now only work mods .asi , and don't work mods .net sad.gif

screen on my GTAIV main folder:

user posted image

it's good install all file ?

Mods .net put in scripts folder.

please for help

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

Jest tutaj jakiś polak? nie umiem angielskiego tounge.gif

Rushlink
  • Rushlink

    Player Hater

  • Members
  • Joined: 25 Aug 2011

#2856

Posted 23 June 2012 - 06:45 AM

I'm having problems with some code i've written.

This was working, but no longer works at all!!!
I am completely stumped as to why this isn't working! It doesn't make sense to me at all.

When the script loads, the lights are on. As soon as it goes into the tick and attempts to update any of the lights positions, etc... the lights all go away...
I understand that everything looks stupid - this isn't my entire code, but this section should run on its own... It doesn't...

CODE
using System;
using System.Collections.Generic;
using System.Text;
using GTA;
using System.Drawing;
using System.Windows.Forms;

namespace PLM
{
   public class plm : Script
   {


       public System.Drawing.Color blue;
       public System.Drawing.Color red;
       public System.Drawing.Color white;
       public System.Drawing.Color yellow;
       private bool firstrun = true;
       private bool firstveh = true;


       //Lights
       //                   //F/B    |  AREA      |  L/R   | TYPE  | DONE?
       public Light light1; //FRONT  |  OUTSIDE   |  LEFT  | PRIM  | COMPLETED
       public Light light2; //FRONT  |  OUTSIDE   |  RIGHT | PRIM  | COMPLETED
       public Light light3; //REAR   |  OUTSIDE   |  LEFT  | PRIM  | COMPLETED
       public Light light4; //REAR   |  OUTSIDE   |  RIGHT | PRIM  | COMPLETED
       public Light light5; //FRONT  |  MIDDLE1   |  LEFT  | PRIM  | COMPLETED
       public Light light6; //FRONT  |  MIDDLE1   |  RIGHT | PRIM  | COMPLETED
       public Light light7; //REAR   |  MIDDLE1   |  LEFT  | PRIM  | COMPLETED
       public Light light8; //REAR   |  MIDDLE1   |  RIGHT | PRIM  | COMPLETED
       public Light light9; //FRONT  |  MIDDLE2   |  LEFT  | PRIM  | COMPLETED
       public Light light10;//FRONT  |  MIDDLE2   |  RIGHT | PRIM  | COMPLETED
       public Light light11;//REAR   |  MIDDLE2   |  LEFT  | PRIM  | COMPLETED
       public Light light12;//REAR   |  MIDDLE2   |  RIGHT | PRIM  | COMPLETED
       public Light light13;//FRONT  |  INSIDE    |  LEFT  | PRIM  | COMPLETED
       public Light light14;//FRONT  |  INSIDE    |  RIGHT | PRIM  | COMPLETED
       public Light light15;//REAR   |  INSIDE    |  LEFT  | PRIM  | COMPLETED
       public Light light16;//REAR   |  INSIDE    |  RIGHT | PRIM  | COMPLETED
       public Light light17;//FRONT  |  LEFT      |  LEFT  | PRIM  | COMPLETED
       public Light light18;//REAR   |  LEFT      |  LEFT  | PRIM  | COMPLETED
       public Light light19;//FRONT  |  RIGHT     |  RIGHT | PRIM  | COMPLETED
       public Light light20;//REAR   |  RIGHT     |  RIGHT | PRIM  | COMPLETED


       public plm()
       {
           Interval = 10;
           this.Tick += new EventHandler(this.plm_tick);




           //Initalize colors
           string hexValue = "#0000FF";
           System.Drawing.Color blue = System.Drawing.ColorTranslator.FromHtml(hexValue);
           hexValue = "#FF0000";
           System.Drawing.Color red = System.Drawing.ColorTranslator.FromHtml(hexValue);
           hexValue = "#FFFFFF";
           System.Drawing.Color white = System.Drawing.ColorTranslator.FromHtml(hexValue);
           hexValue = "#E69900";
           System.Drawing.Color yellow = System.Drawing.ColorTranslator.FromHtml(hexValue);

           //Initalize lights
           light1 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light2 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light3 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light4 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light5 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light6 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light7 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light8 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light9 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light10 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light11 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light12 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light13 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light14 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light15 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light16 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light17 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light18 = new GTA.Light(blue, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light19 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light20 = new GTA.Light(red, 1, 5000, Player.Character.GetOffsetPosition(new Vector3(0.5F, 0, 1)));
           light1.Enabled = true;
           light2.Enabled = true;
           light3.Enabled = true;
           light4.Enabled = true;
           light5.Enabled = true;
           light6.Enabled = true;
           light7.Enabled = true;
           light8.Enabled = true;
           light9.Enabled = true;
           light10.Enabled = true;
           light11.Enabled = true;
           light12.Enabled = true;
           light13.Enabled = true;
           light14.Enabled = true;
           light15.Enabled = true;
           light16.Enabled = true;
           light17.Enabled = true;
           light18.Enabled = true;
           light19.Enabled = true;
           light20.Enabled = true;
           light1.Range = 100.0F;
           light2.Range = 100.0F;
           light3.Range = 100.0F;
           light4.Range = 100.0F;
           light5.Range = 100.0F;
           light6.Range = 100.0F;
           light7.Range = 100.0F;
           light8.Range = 100.0F;
           light9.Range = 100.0F;
           light10.Range = 100.0F;
           light11.Range = 100.0F;
           light12.Range = 100.0F;
           light13.Range = 100.0F;
           light14.Range = 100.0F;
           light15.Range = 100.0F;
           light16.Range = 100.0F;
           light17.Range = 100.0F;
           light18.Range = 100.0F;
           light19.Range = 100.0F;
           light20.Range = 100.0F;

       }

       private void plm_tick(object sender, EventArgs e)
       {
           Interval = 30;
           if (Exists(Player.Character.CurrentVehicle))
           {
               //update the light position
               light1.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.43F, -0.09F, 0.847F)); //done
               light2.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.45F, -0.09F, 0.847F)); //done
               light3.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.43F, -0.45F, 0.847F)); //done
               light4.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.45F, -0.45F, 0.847F)); //done
               light5.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.31F, -0.09F, 0.847F)); //done
               light6.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.33F, -0.09F, 0.847F)); //done
               light7.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.31F, -0.45F, 0.847F)); //done
               light8.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.33F, -0.45F, 0.847F)); //done;
               light9.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-100.09F, -0.09F, 0.847F)); //done
               light10.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.21F, -0.09F, 0.847F)); //done
               light11.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-100.09F, -0.45F, 0.847F)); //done
               light12.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.21F, -0.45F, 0.847F)); //done
               light13.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.06F, -0.09F, 0.848F)); //done
               light14.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.08F, -0.09F, 0.848F)); //done                
               light15.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.06F, -0.45F, 0.848F)); //done
               light16.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.08F, -0.45F, 0.848F)); //done
               light17.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.54F, -100.06F, 0.850F)); //done
               light18.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(-0.54F, -0.39F, 0.850F)); //done
               light19.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.55F, -100.06F, 0.850F)); //done
               light20.Position = Player.Character.CurrentVehicle.GetOffsetPosition(new Vector3(0.55F, -0.39F, 0.850F)); //done

               light1.Color = yellow;
               light1.Color = yellow;
               light2.Color = yellow;
               light3.Color = yellow;
               light4.Color = yellow;
               light5.Color = yellow;
               light6.Color = yellow;
               light7.Color = yellow;
               light8.Color = yellow;
               light9.Color = yellow;
               light10.Color = yellow;
               light11.Color = yellow;
               light12.Color = yellow;
               light13.Color = yellow;
               light14.Color = yellow;
               light15.Color = yellow;
               light16.Color = yellow;
               light17.Color = yellow;
               light18.Color = yellow;
               light19.Color = yellow;
               light20.Color = yellow;

               light1.Enabled = true;
               light1.Enabled = true;
               light2.Enabled = true;
               light3.Enabled = true;
               light4.Enabled = true;
               light5.Enabled = true;
               light6.Enabled = true;
               light7.Enabled = true;
               light8.Enabled = true;
               light9.Enabled = true;
               light10.Enabled = true;
               light11.Enabled = true;
               light12.Enabled = true;
               light13.Enabled = true;
               light14.Enabled = true;
               light15.Enabled = true;
               light16.Enabled = true;
               light17.Enabled = true;
               light18.Enabled = true;
               light19.Enabled = true;
               light20.Enabled = true;
           }
       }

   }





}



Any Ideas??

Thanks

Rushlink
  • Rushlink

    Player Hater

  • Members
  • Joined: 25 Aug 2011

#2857

Posted 23 June 2012 - 06:48 AM

QUOTE (wilus0503 @ Sunday, Jun 3 2012, 15:01)
i'm sorry for my weak english.

My problem relies on it, that scripthookdotnet.asi it is not started.

In GTAIV main folder, file of notebook scripthookdotnet does not appear.

I had versions earlier 1.0.4.0, and scripthookdotnet.asi Version 0.893 BETA worked correctly , but doesn't work some mods.
I have decided modernize GTAIV to 1.0.7.0 and use "GTAIV .Net Script Hook v1.7.1.7 BETA" .

but.. now only work mods .asi , and don't work mods .net sad.gif

screen on my GTAIV main folder:

user posted image

it's good install all file ?

Mods .net put in scripts folder.

please for help

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

Jest tutaj jakiś polak? nie umiem angielskiego tounge.gif

ScripthookDotNet.asi needs to go into the ROOT gtaIV folder

Any .net SCRIPTS go into the 'scripts' folder

vdhAbraxas
  • vdhAbraxas

    Player Hater

  • Members
  • Joined: 25 Jun 2012

#2858

Posted 25 June 2012 - 08:36 AM Edited by vdhAbraxas, 25 June 2012 - 08:39 AM.

All hope is gone. I've been trying to figure it out for hours, but I'm just too stupid for it and need your help guys sad.gif

I'm trying to get native function to work

CODE

float x1 = 0.0f;
float x2 = 0.0f;
float x3 = 0.0f;
   
GTA.Native.Function.Call("GET_NTH_CLOSEST_CAR_NODE", Player.Character.Position.X, Player.Character.Position.Y, Player.Character.Position.Z, 3,  x1, x2, x3 );

Game.DisplayText("Test "+ x1 + " " + x2 + " " +x3 + " ", 15000);


And all I get is:
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()

I've tried with other car node native functions, but also without success. I'm new to modding and .NET and try to learn from examples etc., but this time I'm hopeless.

kmccmk9
  • kmccmk9

    Crackhead

  • Members
  • Joined: 12 May 2007

#2859

Posted 08 July 2012 - 03:47 PM

Hi! Great mod. I'm working on a script that loads a custom model I made, but not added to the game. Is there anyway to add it as a resource into the script and spawn it that way? I've been studying the texture drawing example however I can't seem to use it for models instead.

fengyeblade
  • fengyeblade

    Blade Feng Land

  • Members
  • Joined: 01 Feb 2009

#2860

Posted 16 July 2012 - 04:47 PM

HI hazardX. i am back. What are you get new mod ?

Timmoboy
  • Timmoboy

    Player Hater

  • Members
  • Joined: 21 Jul 2012

#2861

Posted 21 July 2012 - 04:33 AM

Hello. I'm in really deep water with this and I have no knowledge of coding what so ever!

The only reason I started was because I could not find one single mod/script that did what I wanted. Basically, all I want is when I fire my silenced gun in the game, it won't attract much attention, if none. Especially if you are alone and you kill a cop you shouldn't get chased by everyone because there was no witnesses etc.

I have no idea if that's even possible but I gave it a shot and this is what I came up with:

If Player.isShooting.DesertEagle = True Then (I have replaced the eagle with a silenced gun)

Player.IgnoredByEveryone = True

The first line is something I just came up with because I could not find anything better.

I would really like some big help with this and I will forever be in your debt if you get something like this working!

fengyeblade
  • fengyeblade

    Blade Feng Land

  • Members
  • Joined: 01 Feb 2009

#2862

Posted 01 August 2012 - 06:15 AM

I make a ped , add a task to enter vehicle.

CODE
GudList[z].Task.ClearAll();
GudList[z].Task.AlwaysKeepTask = true;
GudList[z].Task.EnterVehicle(GudCar[0], VehicleSeat.Driver);


and make he drive vehicle to a point.

CODE

if (GudList[z].isInVehicle(GudCar[0]))
GudList[z].Task.DriveTo(endpoint, sspeed, false);


but , in game, the ped get in car, get out ,get in ,get out , get in , get out ....
he can't stay in the vehicle.
how make he stay in the car , still i give he command?

_Charger_
  • _Charger_

    Germany

  • Members
  • Joined: 01 Apr 2010

#2863

Posted 05 August 2012 - 03:53 PM

hi i have a problem... i wanna remove buttons with
CODE
this.Controls.Remove()
but it doesn't work...

CODE
2012-08-05 17:37:46 - Error during Form.ShowDialog:
                     System.NullReferenceException: Object reference not set to an instance of an object.
                        at GTA.Forms.Control.get_Controls()
                        at GTA.Forms.Control.set_Parent(Control value)
                        at GTA.Forms.ControlCollection.Remove(Control item)
                        at IV_SA_Tuning_Garage.GarageUI.neonOffBtn_Click(Object sender, MouseEventArgs e)
                        at GTA.Forms.Control.raise_Click(Object value0, MouseEventArgs value1)
                        at GTA.Forms.Button.OnClick(MouseEventArgs e)
                        at GTA.Forms.FormHost.TriggerMouseUp(MouseEventArgs e)
                        at GTA.Script.ProcessEvents()
                        at GTA.Forms.Form.ShowDialog()

is the error message, but i don't understand why it says NullReferenceException. The buttons are visible and enabled, and they work... they are "global" so the function (btw it's the mouseclick event of one of these buttons) should be able to remove them.
Can anyone tell me if the remove function works, or isn't it possible to remove buttons?

_Charger_
  • _Charger_

    Germany

  • Members
  • Joined: 01 Apr 2010

#2864

Posted 05 August 2012 - 08:20 PM

QUOTE (Timmoboy @ Saturday, Jul 21 2012, 06:33)
Hello. I'm in really deep water with this and I have no knowledge of coding what so ever!

The only reason I started was because I could not find one single mod/script that did what I wanted. Basically, all I want is when I fire my silenced gun in the game, it won't attract much attention, if none. Especially if you are alone and you kill a cop you shouldn't get chased by everyone because there was no witnesses etc.

I have no idea if that's even possible but I gave it a shot and this is what I came up with:

If Player.isShooting.DesertEagle = True Then (I have replaced the eagle with a silenced gun)

Player.IgnoredByEveryone = True

The first line is something I just came up with because I could not find anything better.

I would really like some big help with this and I will forever be in your debt if you get something like this working!

it would be possible, but u have to make a check for it (it must be a backgroudn thread or a function called by timer) and then checking if shooting, but people should only ignore the shot, not the player completly

The Great
  • The Great

    The Great Legendary of Centuries

  • Members
  • Joined: 26 Jul 2012

#2865

Posted 06 August 2012 - 12:17 PM

@HazardX

I have a problem when i start GTA IV there written msvcr100.dll is missing and i install msvcr100.dll at C:\Windows\System32 and i start GTA 4 but another problem came but i will give the photo here is ituser posted image

_Charger_
  • _Charger_

    Germany

  • Members
  • Joined: 01 Apr 2010

#2866

Posted 07 August 2012 - 11:29 AM

QUOTE (_Charger_ @ Sunday, Aug 5 2012, 17:53)
hi i have a problem... i wanna remove buttons with
CODE
this.Controls.Remove()
but it doesn't work...

CODE
2012-08-05 17:37:46 - Error during Form.ShowDialog:
                     System.NullReferenceException: Object reference not set to an instance of an object.
                        at GTA.Forms.Control.get_Controls()
                        at GTA.Forms.Control.set_Parent(Control value)
                        at GTA.Forms.ControlCollection.Remove(Control item)
                        at IV_SA_Tuning_Garage.GarageUI.neonOffBtn_Click(Object sender, MouseEventArgs e)
                        at GTA.Forms.Control.raise_Click(Object value0, MouseEventArgs value1)
                        at GTA.Forms.Button.OnClick(MouseEventArgs e)
                        at GTA.Forms.FormHost.TriggerMouseUp(MouseEventArgs e)
                        at GTA.Script.ProcessEvents()
                        at GTA.Forms.Form.ShowDialog()

is the error message, but i don't understand why it says NullReferenceException. The buttons are visible and enabled, and they work... they are "global" so the function (btw it's the mouseclick event of one of these buttons) should be able to remove them.
Can anyone tell me if the remove function works, or isn't it possible to remove buttons?

i found a solution myself. this function is definetly buggy, but with
CODE
try
{
this.Controls.Remove(*item*);
}
catch (Exception e) { }
it worked...

Darlyn
  • Darlyn

    Keyboard & mouse

  • Members
  • Joined: 22 Apr 2006

#2867

Posted 08 August 2012 - 10:32 PM

Any way to reload a single script?

kmccmk9
  • kmccmk9

    Crackhead

  • Members
  • Joined: 12 May 2007

#2868

Posted 08 August 2012 - 11:01 PM

QUOTE (Timmoboy @ Saturday, Jul 21 2012, 04:33)
Hello. I'm in really deep water with this and I have no knowledge of coding what so ever!

The only reason I started was because I could not find one single mod/script that did what I wanted. Basically, all I want is when I fire my silenced gun in the game, it won't attract much attention, if none. Especially if you are alone and you kill a cop you shouldn't get chased by everyone because there was no witnesses etc.

I have no idea if that's even possible but I gave it a shot and this is what I came up with:

If Player.isShooting.DesertEagle = True Then (I have replaced the eagle with a silenced gun)

Player.IgnoredByEveryone = True

The first line is something I just came up with because I could not find anything better.

I would really like some big help with this and I will forever be in your debt if you get something like this working!

I can look into it.

Darlyn
  • Darlyn

    Keyboard & mouse

  • Members
  • Joined: 22 Apr 2006

#2869

Posted 09 August 2012 - 01:15 PM

QUOTE (Darlyn @ Wednesday, Aug 8 2012, 17:32)
Any way to reload a single script?

Anyone? Even if it's just a line that I can add into a script that resets it.

CrazyRaisin
  • CrazyRaisin

    Consoles suck, yeah I be hatin, problem?

  • Members
  • Joined: 20 Aug 2012

#2870

Posted 20 August 2012 - 07:11 PM

Every time I try to connect to the download site it wont work, always get

QUOTE (Google Chrome)

Oops! Google Chrome could not connect to dl.hazardx.com

thaCURSEDpie
  • thaCURSEDpie

    GTA:IV scripter

  • Members
  • Joined: 01 Jul 2007

#2871

Posted 23 August 2012 - 02:25 PM Edited by thaCURSEDpie, 27 August 2012 - 07:42 PM.

EDIT:
Below post is probably irrelevant since I've already spoken with some competent people. None of whom can think of a fix at the moment. Too bad.



Since everyone in #gtaivnetscripthook seems afk I'll ask the question here.

I'm building a function-hooking module. It's got an unmanaged base which does all the actually dirty work (patching in jmp's and the like). Then there's the .Net part which can 'register' with the unmanaged part. This part is meant to act as an intermediate to allow end-developers (in .Net) to not have to deal with the unmanaged base. The intermediate exposes methods which allow .Net code to register detour methods.

So, say a hooked function is called (Let's take CPlayerChar::SetCharHealth as an example. If you don't agree with the naming, then too bad tounge.gif ):

Flow of execution would be:
Game -> C++ module -> .Net intermediate -> .Net registered detours

So in our case we luckily have the .Net scripthook, which we can use to host the registered detour methods. I made a test class:
CODE

// Delegates
public delegate void Del_CPlayerChar_AddCharHealth(IntPtr CharInstance, int Instance, float amount);
public delegate void Del_CPlayerChar_SetCharHealth(IntPtr CharInstance, float amount, int unkInt);

public class Example : GTA.Script
   {
       private Del_CPlayerChar_AddCharHealth AddCharHealthDetour_Del;
       private Del_CPlayerChar_SetCharHealth SetCharHealthDetour_Del;

       private HookIntermediate hi;
       
       // Constructor
       public Example()
       {
           this.AddCharHealthDetour_Del = new Del_CPlayerChar_AddCharHealth(this.CPlayerChar_AddCharHealthDetour);
           this.SetCharHealthDetour_Del = new Del_CPlayerChar_SetCharHealth(this.CPlayerChar_SetCharHealthDetour);

           // We get a reference to the HookIntermediate instance
           this.hi = HookIntermediate.Get();

           // We register our detour. This works out fine.
           int retVal = hi.RegisterDetour("CPlayerChar::AddCharHealth", this.AddCharHealthDetour_Del);
       }

       private void CPlayerChar_SetCharHealthDetour(IntPtr CharInstance, float amount, int unkInt)
       {
           // This function is then called when the hooked function is called. The values are all correct, but the game hangs when the next line is executed:
           Game.Console.Print("Player health set to: " + amount.ToString());
       }
   }


When the detour method is called, everything works out *until* the moment a .net scripthook method is called (for example: Game.Console.Print() ). It seems it's not possible to call these methods from a different thread than the script-thread. Is this true?

The HookIntermediate is initialized (if it not yet exists) in the Get() method, so we are also always in the same AppDomain as the .net scripthook (SHDN_ScriptDomain wink.gif , yes, I've checked).

So the question is: how should I deal with this? Is there really no way to call for example Game.Console.Print() from any other thread?

Sunnyak
  • Sunnyak

    Player Hater

  • Members
  • Joined: 01 Sep 2012

#2872

Posted 01 September 2012 - 09:32 PM

@HazardX
Plz Help me !! after installing Your Dot net Scripthook when i launch GTA 4, It says MSVCR 100.dll is missing or not design to run .......

Sunnyak
  • Sunnyak

    Player Hater

  • Members
  • Joined: 01 Sep 2012

#2873

Posted 01 September 2012 - 09:37 PM

@HazardX
i have a problem when i launch the Game it says MSVCR 100.dll is missing or not design to run ............. ??? plz HElp Me sad.gif

mj3150
  • mj3150

    Player Hater

  • Members
  • Joined: 16 Apr 2008

#2874

Posted 05 September 2012 - 02:27 PM



If you get a "MSVCR100.dll not found" error:
Try installing the Microsoft Visual C++ 2010 Redistributable Package! Make sure to install the linked x86 version, even on x64 systems!

or just go to google and download the file and put it into the gta main folder

motorsport71
  • motorsport71

    newbie modder

  • Members
  • Joined: 20 Oct 2009

#2875

Posted 11 September 2012 - 01:27 AM

hey all, i have a question. i've written a script that saves info to an ini when i exit the mod, and loads that info when restarted. the problem i'm having is it will only write to the ini once. if i reloadscripts it will overwrite it once. i'm using!
CODE
settings.load() and settings.getvalueinteger
and to write the
value
CODE
settings.setvalue

is there a command to allow it to overwrite it without needing to restart the script?

ch3y3zze
  • ch3y3zze

    ni**erKILLER

  • BUSTED!
  • Joined: 30 Aug 2012

#2876

Posted 12 September 2012 - 12:26 AM

@motorsport

Maybe don't use gta settings class and handle everything manually using stream classes from system.io, I haven't researched your issue but maybe that will give u more control wink.gif

gtaivEflc
  • gtaivEflc

    Player Hater

  • Members
  • Joined: 01 Nov 2011

#2877

Posted 25 September 2012 - 03:05 PM Edited by gtaivEflc, 25 September 2012 - 03:13 PM.

Hello everybody!

I've found a bug or something like this..
There is no information about GET_STATE_OF_CLOSEST_DOOR_OF_TYPE native function, so I opened some .sco scripts and saw something like this:
GET_STATE_OF_CLOSEST_DOOR_OF_TYPE( iVar5, vVar6[0], ref uVar3, ref uVar4 ); (ray6.sco)
So, iVar5 is model hash, vVar6 is door location (Vector3),
ref uVar3 is locked/unlocked, ref uVar4 is door rotation angle.
The problem is -- uVar3 and uVar4 are ref.
GTA.Native.Function.Call("GET_STATE_OF_CLOSEST_DOOR_OF_TYPE", model.Hash, location.X, location.Y, location.Z, ref locked, ref angle) is incorrect!
Parameter can't be 'ref'.
Please solve this problem!

s1nk0
  • s1nk0

    Player Hater

  • Members
  • Joined: 19 Jun 2011

#2878

Posted 28 September 2012 - 07:54 AM

Uploaded a working 1.0.4.0 version of Scripthook if anyone is having crashing issues with the latest release:
http://www.mediafire...0z9up3l5u63odvd

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#2879

Posted 28 September 2012 - 03:02 PM

QUOTE (Darlyn @ Thursday, Aug 9 2012, 13:15)
QUOTE (Darlyn @ Wednesday, Aug 8 2012, 17:32)
Any way to reload a single script?

Anyone? Even if it's just a line that I can add into a script that resets it.

You can always use

CODE

try
{
    // code
}
catch (Exception E)
{
   // maybe send the error to the console
}


to avoid script stoping on error.

Max4X
  • Max4X

    Player Hater

  • Members
  • Joined: 14 Jun 2008

#2880

Posted 30 September 2012 - 05:54 PM

Hi everyone!
Does anybody know what all these errors mean in my ScriptHookDotNet log file? I don't know why but net scripts don't work in my game (1.0.0.4). I have everything installed for it including .net framework 4.
Here is my log:
CODE
2012-09-30 22:44:14 - Initializing ScriptHookDotNet v1.7.1.7 BETA (on GTA IV version 1.0.0.4 with C++ Hook version 0.4.0)

2012-09-30 22:44:14 - WARNING: Your C++ ScriptHook version 0.4.0 and GTA IV version 1.0.0.4 are NOT known to be compatible! Use C++ ScriptHook version 0.5.1 or the newest version of the game AND the C++ ScriptHook instead!
2012-09-30 22:44:45 - Direct3D device created!
2012-09-30 22:44:45 - Error during ScriptDomain.Create:
                     System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
                        at GTA.RemoteScriptDomain..ctor()
                        --- End of inner exception stack trace ---
                        at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
                        at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
                        at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
                        at System.Activator.CreateInstance(Type type, Boolean nonPublic)
                        at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
                        at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
                        at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
                        at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)
                        at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)
                        at GTA.ScriptDomain.Create()
2012-09-30 22:44:45 -  -> InnerException:
                     System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
                        at GTA.RemoteScriptDomain..ctor()
2012-09-30 22:44:45 - INFO: Phone number checks are not available!
2012-09-30 22:47:41 - Direct3D device lost!


So is there any errors which could stop running the scripts?




4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users