Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (93,004 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

crosire

Community Script Hook V .NET

Recommended Posts

oliverrogerr

So much thanks! I've managed to compile a new ScriptHookDotNet.asi with your fork and steering angle/scale seem to be working again. vehicle.Acceleration included.

so plis make a download for us all \o/

Share this post


Link to post
Share on other sites
ikt

 

So much thanks! I've managed to compile a new ScriptHookDotNet.asi with your fork and steering angle/scale seem to be working again. vehicle.Acceleration included.

so plis make a download for us all \o/

 

Just wait until the shvdn guys solve this, as my fork is of a significantly older version (I did not have the energy to bother with why it didn't want to switch to another branch locally and didn't bother updating it from upstream), but changes to the Vehicle.cpp itself should be fine.

 

Kinda f*cked it up there but w/e

Share this post


Link to post
Share on other sites
_MK_

My game with the latest version is crashing with "ScriptHookVDotNet" ?

Share this post


Link to post
Share on other sites
ikt

If anybody wants the updated ScriptHookVDotNet for their vehicle scripts:

dev_v2 branch build

dev_v3 branch build

 

Click "artifacts" for the zip with the updated things. I don't think dev_v3 has been tested properly enough yet, but dev_v2 should be stable enough. I removed my old fork.

 

@anybody else

Is this how you're supposed to do pull requests?

 

Void since these are merged now!

https://github.com/crosire/scripthookvdotnet/releases/download/v2.9.3/ScriptHookVDotNet.zip

Edited by ikt

Share this post


Link to post
Share on other sites
machine4578

@crosire
are the 7 new Biker DLC weapons added to the WeaponHashes.hpp? if not can you add them please?

 

thanks alot!

Edited by machine4578

Share this post


Link to post
Share on other sites
Eddlm

Looks like the steering stuff is broken again.

Share this post


Link to post
Share on other sites
flynhigh09

Looks like UI.DrawTexure() isnt working neither. Ive tried many ways?

Share this post


Link to post
Share on other sites
flynhigh09

Bump.... @crosire Is shvd dead.. Didnt see it in the source its under UI but thete isnt one now im lost

Edited by flynhigh09

Share this post


Link to post
Share on other sites
flynhigh09

Guess so lmao

Share this post


Link to post
Share on other sites
Kiryu

Yeah... This isn't working. Installed correctly, but none of my two scripts (NIBMods and Quantum Break) are working. Pressing INS just leads to 'error saving log file', and nothing happens.

Share this post


Link to post
Share on other sites
_MK_

Why is it crashing ?

 

cLRhUbz.png

 

 

 

Log Name: Application
Source: Application Error
Date: 1/22/2017 8:46:53 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Description:
Faulting application name: GTA5.exe, version: 1.0.944.2, time stamp: 0x5847f2c1
Faulting module name: KERNELBASE.dll, version: 6.1.7601.23572, time stamp: 0x57fd0696
Exception code: 0xe0434352
Fault offset: 0x000000000001a06d
Faulting process id: 0xd84
Faulting application start time: 0x01d2752fd86c07db
Faulting application path: C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\GTA5.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: f5550fac-e126-11e6-9bae-086266c6c77b
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2017-01-23T04:46:53.000000000Z" />
<EventRecordID>2446</EventRecordID>
<Channel>Application</Channel>
<Computer>Aurora</Computer>
<Security />
</System>
<EventData>
<Data>GTA5.exe</Data>
<Data>1.0.944.2</Data>
<Data>5847f2c1</Data>
<Data>KERNELBASE.dll</Data>
<Data>6.1.7601.23572</Data>
<Data>57fd0696</Data>
<Data>e0434352</Data>
<Data>000000000001a06d</Data>
<Data>d84</Data>
<Data>01d2752fd86c07db</Data>
<Data>C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\GTA5.exe</Data>
<Data>C:\Windows\system32\KERNELBASE.dll</Data>
<Data>f5550fac-e126-11e6-9bae-086266c6c77b</Data>
</EventData>
</Event>

 

 

 

Log Name: Application
Source: .NET Runtime
Date: 1/22/2017 8:46:52 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: Aurora
Description:
Application: GTA5.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at GTA.NaturalMotion.?A0x918702bf.NmApply.Run()
at GTA.ScriptDomain.DoTick()
at GTA.ScriptDomain.DoTick()
at <Module>.ManagedTick()


Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2017-01-23T04:46:52.000000000Z" />
<EventRecordID>2445</EventRecordID>
<Channel>Application</Channel>
<Computer>Aurora</Computer>
<Security />
</System>
<EventData>
<Data>Application: GTA5.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at GTA.NaturalMotion.?A0x918702bf.NmApply.Run()
at GTA.ScriptDomain.DoTick()
at GTA.ScriptDomain.DoTick()
at <Module>.ManagedTick()

</Data>
</EventData>
</Event>

 

 

 

 

EDIT: it just crashed after going in airbrake under the map.

Edited by _MK_

Share this post


Link to post
Share on other sites
_MK_

Found the problem,this is causing the crash Grab Anything.

Removed it and the game no longer crashes.

Edited by _MK_

Share this post


Link to post
Share on other sites
Rbn 3d

Hi! I'm trying to determine how to check is a control is pressed, so I found this: Game.IsControlPressed(int index, GTA.Control control).
So, what index parameter should be?
The 2nd one is obvious, but no idea about first one

Share this post


Link to post
Share on other sites
SilverRST

Hi, I get the error "A new guard page for the stack cannot be created" Not sure what that means but it's too often.

Share this post


Link to post
Share on other sites
John Berden

Hello.
Sorry my English.
My script is not running.
In the script by pressing G, should an explosion occur. But nothing happens.
Help me please!
This script code:
using System;
using System.Windows.Forms;
using GTA;
using GTA.Math;

namespace ExplosionScript
{
public class Thread : Script
{
public Thread()
{
Vector3 MyVec;
MyVec = Game.Player.Character.Position;
while(true)
{
if (Game.IsKeyPressed(Keys.G))
{
Wait(5000);
World.AddExplosion(MyVec, ExplosionType.Grenade, 750.0F, 10.0F, true, false);
}
Wait(0);
}
}
}
}
Thank you in advance!

Share this post


Link to post
Share on other sites
_MK_

Ok and now Lasso script is crashing the game since the latest version of DOTNET is broken.

 

Is anyone working on it ?

 

 


:facedesk:

 

 

 

Edited by _MK_

Share this post


Link to post
Share on other sites
Rohurd

One quick question as a developer: Is it possible to capture mouse clicks with Script Hook Dot Net? I wanted to do some stuff specifically when the left mouse button was clicked...

Share this post


Link to post
Share on other sites
MoMadenU

One quick question as a developer: Is it possible to capture mouse clicks with Script Hook Dot Net? I wanted to do some stuff specifically when the left mouse button was clicked...

I get them like this

public static bool IsLeftMouseClicked(){    return Game.IsControlPressed(0, Control.Attack);        }public static bool IsRightMouseClicked(){    return Game.IsControlPressed(0, Control.CursorCancel);}

Share this post


Link to post
Share on other sites
MoMadenU

Ok and now Lasso script is crashing the game since the latest version of DOTNET is broken.

 

Is anyone working on it ?

 

 

 

:facedesk:

 

 

 

Rohurd, Are you referring to .net 4.7 as latest?

Share this post


Link to post
Share on other sites
Rohurd

No, still using .Net 4.5.2, but your suggestion is working, thanks a lot!

Also, I wasn't the one, whose lasso script was crashing...

Share this post


Link to post
Share on other sites
Mattheoneleft

I got a problem....

failed to instantiate script 'scriptcore.scriptthread' because no public default constructor was found.

Share this post


Link to post
Share on other sites
Reazer

How can I remove the Players current Vehicle if he presses a Key?

        while (!Game.Player.Character.IsInVehicle())        {            Wait(25);        }        Game.Player.Character.CurrentVehicle.Delete();

And how can I remove and add a Blip?

        while(!Game.Player.Character.IsInVehicle(bmx1))        {            Wait(25);        }        bmx1.CurrentBlip.Remove();        World.CreateBlip(house);

Share this post


Link to post
Share on other sites
raburs

Probably, the majority of .Net scripts will not work. We just have to wait.

Share this post


Link to post
Share on other sites
Reazer

Probably, the majority of .Net scripts will not work. We just have to wait.

Could you please tell me if ScriptHookV.Net got an Update?

Share this post


Link to post
Share on other sites
LeeC2202

It seems some memory based vehicle functionality is currently broken. Vehicle.CurrentRPM and Vehicle.GetCurrentGear definitely are, because I had to implement them myself. I think Vehicle.IsInBurnout() was also failing, can't remember to be exact. It's probably down to the offsets changing for the data.

 

The rest of my scripts seem to still work fine with the latest game version and latest ScriptHookV but I do use a lot of Native calls instead of SHVDN calls, which probably helps. :\

Share this post


Link to post
Share on other sites
Appi
[20:35:52] [ERROR] Failed to create script domain ':

System.InvalidCastException: Could not cast transparent proxy to type "GTA.ScriptDomain".

in GTA.ScriptDomain.Load (String path)


Whats problem?



public static ScriptDomain Load(string path)
{
if (!Path.IsPathRooted(path))
{
path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);
}

// Create AppDomain
var setup = new AppDomainSetup();
setup.ApplicationBase = path;
setup.ShadowCopyFiles = "true";
setup.ShadowCopyDirectories = path;

var appdomain = AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, setup, new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));
appdomain.InitializeLifetimeService();

Log("[DEBUG]", "Path ", path);

ScriptDomain scriptdomain = null;

try
{
scriptdomain = (ScriptDomain)(appdomain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName));
}
catch (Exception ex)
{
Log("[ERROR]", "Failed to create script domain':", Environment.NewLine, ex.ToString());

AppDomain.Unload(appdomain);

return null;
}

Log("[iNFO]", "Loading scripts from '", path, "' ...");

if (Directory.Exists(path))
{
var filenameScripts = new List<string>();
var filenameAssemblies = new List<string>();

try
{
filenameScripts.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories));
filenameScripts.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));
filenameAssemblies.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories));
}
catch (Exception ex)
{
Log("[ERROR]", "Failed to reload scripts:", Environment.NewLine, ex.ToString());

AppDomain.Unload(appdomain);

return null;
}

for (int i = 0; i < filenameAssemblies.Count; i++)
{
var filename = filenameAssemblies[i];
var assemblyName = AssemblyName.GetAssemblyName(filename);

try
{
if (AssemblyName.GetAssemblyName(filename).Name.StartsWith("ScriptHookVDotNet", StringComparison.OrdinalIgnoreCase))
{
Log("[WARNING]", "Removing assembly file '", Path.GetFileName(filename), "'.");

filenameAssemblies.RemoveAt(i--);

try
{
File.Delete(filename);
}
catch (Exception ex)
{
Log("[ERROR]", "Failed to delete assembly file:", Environment.NewLine, ex.ToString());
}
}
}
catch (Exception ex)
{
Log("[ERROR]", "Failed to load assembly file '", Path.GetFileName(filename), "':", Environment.NewLine, ex.ToString());
}
}

foreach (string filename in filenameScripts)
{
scriptdomain.LoadScript(filename);
}
foreach (string filename in filenameAssemblies)
{
scriptdomain.LoadAssembly(filename);
}
}
else
{
Log("[ERROR]", "Failed to reload scripts because the directory is missing.");
}

return scriptdomain;
}

Edited by Appi

Share this post


Link to post
Share on other sites
kagikn

[20:35:52] [ERROR] Failed to create script domain ':

System.InvalidCastException: Could not cast transparent proxy to type "GTA.ScriptDomain".

in GTA.ScriptDomain.Load (String path)

 

Whats problem?

 

 

public static ScriptDomain Load(string path){	if (!Path.IsPathRooted(path))	{		path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);	}	// Create AppDomain	var setup = new AppDomainSetup();	setup.ApplicationBase = path;	setup.ShadowCopyFiles = "true";	setup.ShadowCopyDirectories = path;	var appdomain = AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, setup, new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));	appdomain.InitializeLifetimeService();    Log("[DEBUG]", "Path ", path);    ScriptDomain scriptdomain = null;	try	{		scriptdomain = (ScriptDomain)(appdomain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName));	}	catch (Exception ex)	{		Log("[ERROR]", "Failed to create script domain':", Environment.NewLine, ex.ToString());		AppDomain.Unload(appdomain);		return null;	}	Log("[iNFO]", "Loading scripts from '", path, "' ...");	if (Directory.Exists(path))	{		var filenameScripts = new List<string>();		var filenameAssemblies = new List<string>();		try		{			filenameScripts.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories));			filenameScripts.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));			filenameAssemblies.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories));		}		catch (Exception ex)		{			Log("[ERROR]", "Failed to reload scripts:", Environment.NewLine, ex.ToString());			AppDomain.Unload(appdomain);			return null;		}		for (int i = 0; i < filenameAssemblies.Count; i++)		{			var filename = filenameAssemblies[i];			var assemblyName = AssemblyName.GetAssemblyName(filename);			try			{				if (AssemblyName.GetAssemblyName(filename).Name.StartsWith("ScriptHookVDotNet", StringComparison.OrdinalIgnoreCase))				{					Log("[WARNING]", "Removing assembly file '", Path.GetFileName(filename), "'.");					filenameAssemblies.RemoveAt(i--);					try					{						File.Delete(filename);					}					catch (Exception ex)					{						Log("[ERROR]", "Failed to delete assembly file:", Environment.NewLine, ex.ToString());					}				}			}			catch (Exception ex)			{				Log("[ERROR]", "Failed to load assembly file '", Path.GetFileName(filename), "':", Environment.NewLine, ex.ToString());			}		}		foreach (string filename in filenameScripts)		{			scriptdomain.LoadScript(filename);		}		foreach (string filename in filenameAssemblies)		{			scriptdomain.LoadAssembly(filename);		}	}	else	{		Log("[ERROR]", "Failed to reload scripts because the directory is missing.");	}	return scriptdomain;}
Make sure you use the latest v3 build. That works for me, and that would work for you, too. Some old builds don't work due to a wrong root namespace. Edited by kagikn

Share this post


Link to post
Share on other sites
Appi

 

[20:35:52] [ERROR] Failed to create script domain ':

System.InvalidCastException: Could not cast transparent proxy to type "GTA.ScriptDomain".

in GTA.ScriptDomain.Load (String path)

 

Whats problem?

 

public static ScriptDomain Load(string path){	if (!Path.IsPathRooted(path))	{		path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);	}	// Create AppDomain	var setup = new AppDomainSetup();	setup.ApplicationBase = path;	setup.ShadowCopyFiles = "true";	setup.ShadowCopyDirectories = path;	var appdomain = AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, setup, new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));	appdomain.InitializeLifetimeService();    Log("[DEBUG]", "Path ", path);    ScriptDomain scriptdomain = null;	try	{		scriptdomain = (ScriptDomain)(appdomain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName));	}	catch (Exception ex)	{		Log("[ERROR]", "Failed to create script domain':", Environment.NewLine, ex.ToString());		AppDomain.Unload(appdomain);		return null;	}	Log("[iNFO]", "Loading scripts from '", path, "' ...");	if (Directory.Exists(path))	{		var filenameScripts = new List<string>();		var filenameAssemblies = new List<string>();		try		{			filenameScripts.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories));			filenameScripts.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));			filenameAssemblies.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories));		}		catch (Exception ex)		{			Log("[ERROR]", "Failed to reload scripts:", Environment.NewLine, ex.ToString());			AppDomain.Unload(appdomain);			return null;		}		for (int i = 0; i < filenameAssemblies.Count; i++)		{			var filename = filenameAssemblies[i];			var assemblyName = AssemblyName.GetAssemblyName(filename);			try			{				if (AssemblyName.GetAssemblyName(filename).Name.StartsWith("ScriptHookVDotNet", StringComparison.OrdinalIgnoreCase))				{					Log("[WARNING]", "Removing assembly file '", Path.GetFileName(filename), "'.");					filenameAssemblies.RemoveAt(i--);					try					{						File.Delete(filename);					}					catch (Exception ex)					{						Log("[ERROR]", "Failed to delete assembly file:", Environment.NewLine, ex.ToString());					}				}			}			catch (Exception ex)			{				Log("[ERROR]", "Failed to load assembly file '", Path.GetFileName(filename), "':", Environment.NewLine, ex.ToString());			}		}		foreach (string filename in filenameScripts)		{			scriptdomain.LoadScript(filename);		}		foreach (string filename in filenameAssemblies)		{			scriptdomain.LoadAssembly(filename);		}	}	else	{		Log("[ERROR]", "Failed to reload scripts because the directory is missing.");	}	return scriptdomain;}
Make sure you use the latest v3 build. That works for me, and that would work for you, too. Some old builds don't work due to a wrong root namespace.

 

 

Its lasted version

Share this post


Link to post
Share on other sites
kagikn

 

 

[20:35:52] [ERROR] Failed to create script domain ':

System.InvalidCastException: Could not cast transparent proxy to type "GTA.ScriptDomain".

in GTA.ScriptDomain.Load (String path)

 

Whats problem?

 

 

public static ScriptDomain Load(string path){	if (!Path.IsPathRooted(path))	{		path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);	}	// Create AppDomain	var setup = new AppDomainSetup();	setup.ApplicationBase = path;	setup.ShadowCopyFiles = "true";	setup.ShadowCopyDirectories = path;	var appdomain = AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, setup, new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));	appdomain.InitializeLifetimeService();    Log("[DEBUG]", "Path ", path);    ScriptDomain scriptdomain = null;	try	{		scriptdomain = (ScriptDomain)(appdomain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName));	}	catch (Exception ex)	{		Log("[ERROR]", "Failed to create script domain':", Environment.NewLine, ex.ToString());		AppDomain.Unload(appdomain);		return null;	}	Log("[iNFO]", "Loading scripts from '", path, "' ...");	if (Directory.Exists(path))	{		var filenameScripts = new List<string>();		var filenameAssemblies = new List<string>();		try		{			filenameScripts.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories));			filenameScripts.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));			filenameAssemblies.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories));		}		catch (Exception ex)		{			Log("[ERROR]", "Failed to reload scripts:", Environment.NewLine, ex.ToString());			AppDomain.Unload(appdomain);			return null;		}		for (int i = 0; i < filenameAssemblies.Count; i++)		{			var filename = filenameAssemblies[i];			var assemblyName = AssemblyName.GetAssemblyName(filename);			try			{				if (AssemblyName.GetAssemblyName(filename).Name.StartsWith("ScriptHookVDotNet", StringComparison.OrdinalIgnoreCase))				{					Log("[WARNING]", "Removing assembly file '", Path.GetFileName(filename), "'.");					filenameAssemblies.RemoveAt(i--);					try					{						File.Delete(filename);					}					catch (Exception ex)					{						Log("[ERROR]", "Failed to delete assembly file:", Environment.NewLine, ex.ToString());					}				}			}			catch (Exception ex)			{				Log("[ERROR]", "Failed to load assembly file '", Path.GetFileName(filename), "':", Environment.NewLine, ex.ToString());			}		}		foreach (string filename in filenameScripts)		{			scriptdomain.LoadScript(filename);		}		foreach (string filename in filenameAssemblies)		{			scriptdomain.LoadAssembly(filename);		}	}	else	{		Log("[ERROR]", "Failed to reload scripts because the directory is missing.");	}	return scriptdomain;}
Make sure you use the latest v3 build. That works for me, and that would work for you, too. Some old builds don't work due to a wrong root namespace.

 

Its lasted version

 

No, it's not (if you modified nothing). The code you posted is different from this (the latest build). https://github.com/crosire/scripthookvdotnet/blob/92614a6eb4d935524a24b6d166b9557772c60d5b/source/core/ScriptDomain.cs#L87

Here's the download link for the latest build. https://ci.appveyor.com/project/crosire/scripthookvdotnet/build/dev_v3/1390/artifacts

Edited by kagikn

Share this post


Link to post
Share on other sites
Appi

 

 

 

[20:35:52] [ERROR] Failed to create script domain ':

System.InvalidCastException: Could not cast transparent proxy to type "GTA.ScriptDomain".

in GTA.ScriptDomain.Load (String path)

 

Whats problem?

 

public static ScriptDomain Load(string path){	if (!Path.IsPathRooted(path))	{		path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);	}	// Create AppDomain	var setup = new AppDomainSetup();	setup.ApplicationBase = path;	setup.ShadowCopyFiles = "true";	setup.ShadowCopyDirectories = path;	var appdomain = AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, setup, new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted));	appdomain.InitializeLifetimeService();    Log("[DEBUG]", "Path ", path);    ScriptDomain scriptdomain = null;	try	{		scriptdomain = (ScriptDomain)(appdomain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName));	}	catch (Exception ex)	{		Log("[ERROR]", "Failed to create script domain':", Environment.NewLine, ex.ToString());		AppDomain.Unload(appdomain);		return null;	}	Log("[iNFO]", "Loading scripts from '", path, "' ...");	if (Directory.Exists(path))	{		var filenameScripts = new List<string>();		var filenameAssemblies = new List<string>();		try		{			filenameScripts.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories));			filenameScripts.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories));			filenameAssemblies.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories));		}		catch (Exception ex)		{			Log("[ERROR]", "Failed to reload scripts:", Environment.NewLine, ex.ToString());			AppDomain.Unload(appdomain);			return null;		}		for (int i = 0; i < filenameAssemblies.Count; i++)		{			var filename = filenameAssemblies[i];			var assemblyName = AssemblyName.GetAssemblyName(filename);			try			{				if (AssemblyName.GetAssemblyName(filename).Name.StartsWith("ScriptHookVDotNet", StringComparison.OrdinalIgnoreCase))				{					Log("[WARNING]", "Removing assembly file '", Path.GetFileName(filename), "'.");					filenameAssemblies.RemoveAt(i--);					try					{						File.Delete(filename);					}					catch (Exception ex)					{						Log("[ERROR]", "Failed to delete assembly file:", Environment.NewLine, ex.ToString());					}				}			}			catch (Exception ex)			{				Log("[ERROR]", "Failed to load assembly file '", Path.GetFileName(filename), "':", Environment.NewLine, ex.ToString());			}		}		foreach (string filename in filenameScripts)		{			scriptdomain.LoadScript(filename);		}		foreach (string filename in filenameAssemblies)		{			scriptdomain.LoadAssembly(filename);		}	}	else	{		Log("[ERROR]", "Failed to reload scripts because the directory is missing.");	}	return scriptdomain;}
Make sure you use the latest v3 build. That works for me, and that would work for you, too. Some old builds don't work due to a wrong root namespace.

Its lasted version

No, it's not (if you modified nothing). The code you posted is different from this (the latest build). https://github.com/crosire/scripthookvdotnet/blob/92614a6eb4d935524a24b6d166b9557772c60d5b/source/core/ScriptDomain.cs#L87

Here's the download link for the latest build. https://ci.appveyor.com/project/crosire/scripthookvdotnet/build/dev_v3/1390/artifacts

 

 

Im using last version, really last. Im download default source and execute.

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.