Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

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

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

    1. Grand Theft Auto Series

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

    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

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

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

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

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    2. Forum Support

    3. Suggestions

[BETA] GTAIV .Net ScriptHook


HazardX
 Share

Recommended Posts

GTA.Player.Skin is read only

 

@EDIT:

I used GTA.Player.Skin.Template instead and it worked, but I tested again and then game crashed. I've tested once again and it crashed anyway sad.gif

Edited by _hax
Link to comment
Share on other sites

I just found a bug with the vehicle.rotation property, but object.rotation works as expected. The Y and Z values get switched up from set to get. What I mean is that I set the rotation X and Z values, and all works just fine, but when I get the vehicle rotation to a string, it shows X and Y values are the ones being changed. I fixed this to work right in my script as it is now, took me a bit to figure out the actual problem (I thought it was an error with my code), but I guess I'll hold out on the update release until it's fixed. wink.gif

Link to comment
Share on other sites

I'm having some problems with getting the players last vehicle. I'm trying to store all the details of the vehicle after the player has left it.

 

So far I've tried using the Player.LastVehicle, that doesn't work. I just end up with an object not refereneced error. And I've also tried to manually set the vehicle.

 

Whilst Player Driving. LastVeh = Player.Character.CurrentVehicle.

 

Again when I try and access this once the player is outside the vehicle, I get the object ref error.

Link to comment
Share on other sites

I'm having some problems with getting the players last vehicle. I'm trying to store all the details of the vehicle after the player has left it.

 

So far I've tried using the Player.LastVehicle, that doesn't work. I just end up with an object not refereneced error. And I've also tried to manually set the vehicle.

 

Whilst Player Driving. LastVeh = Player.Character.CurrentVehicle.

 

Again when I try and access this once the player is outside the vehicle, I get the object ref error.

This is completely as intended. Player.LastVehicle returns NULL if the player had no vehicle before and Player.Character.CurrentVehicle returns NULL if the player is is no vehicle currently. What else should the methods return if there is nothing to return? Thus you always have to check the values for being NULL before using it, since you can't access methods of a nonexisting vehicle.

Link to comment
Share on other sites

WOOOHOOO biggrin.gif. Came back from my holiday today. Checked my mail 'n stuff. Decided to check the GtaForums ("probably nothing new, but oh well...") and then I find... THIS! A new version of the script-hook?

 

Thank you!

 

(or... not tounge.gif. Now I have to spend a lot of time in my holiday on modding GTA biggrin.gif)

Same lol.gif

 

btw, what other good net mods are there apart from the grabscipt (forgot sigh.gif )

Link to comment
Share on other sites

I'm having some problems with getting the players last vehicle. I'm trying to store all the details of the vehicle after the player has left it.

 

So far I've tried using the Player.LastVehicle, that doesn't work. I just end up with an object not refereneced error. And I've also tried to manually set the vehicle.

 

Whilst Player Driving. LastVeh = Player.Character.CurrentVehicle.

 

Again when I try and access this once the player is outside the vehicle, I get the object ref error.

This is completely as intended. Player.LastVehicle returns NULL if the player had no vehicle before and Player.Character.CurrentVehicle returns NULL if the player is is no vehicle currently. What else should the methods return if there is nothing to return? Thus you always have to check the values for being NULL before using it, since you can't access methods of a nonexisting vehicle.

Ah, but when I've done it. The player had a vehicle before. It is as soon as I get out of the vehicle. Works in vehilce but as soon as I get out. Any access done to the vehicle doest work. Its as though the game destroys it as soon as the player gets out of it.

 

 

Link to comment
Share on other sites

HazardX, can you finnaly answer me, why my stupid hook doesnt work?

No, i haven't got the slightest clue of what may cause your errors, TBH. confused.gif

Link to comment
Share on other sites

KingBulleT 8747
HazardX, can you finnaly answer me, why my stupid hook doesnt work?

No, i haven't got the slightest clue of what may cause your errors, TBH. confused.gif

Fix it an release new version.

Link to comment
Share on other sites

 

HazardX, can you finnaly answer me, why my stupid hook doesnt work?

No, i haven't got the slightest clue of what may cause your errors, TBH. confused.gif

Fix it an release new version.

lol, leave the man alone, you're the only one with this problem? If you want you can send me the script and ill try it on my PC...

Link to comment
Share on other sites

Dvt-MedShot
HazardX, can you finnaly answer me, why my stupid hook doesnt work?

No, i haven't got the slightest clue of what may cause your errors, TBH. confused.gif

Fix it an release new version.

lol, leave the man alone, you're the only one with this problem? If you want you can send me the script and ill try it on my PC...

Yeah, what Intosia says... Leave him alone, as the hook works with most of the people.

 

Btw is it normal that it takes some time before the hook is loaded?

Link to comment
Share on other sites

Yeah from spawning to loaded takes like 6-10 seconds. Thats because the DX Hook has to be initialized.

Link to comment
Share on other sites

Doh, I solved my vehicle problem. It wasn't the vehicle at all, it was some other code that I forgot to initialise.

 

Edit: Got another question now, ive stored the Vehicles Identifer to a value, how can I now check if that vehicle has been removed or destroyed?

 

I've tried if vehicle is null, or isalive, but both always say vehicle still exsists when it doesn't.

Edited by Gangsta Killa
Link to comment
Share on other sites

KingBulleT 8747
HazardX, can you finnaly answer me, why my stupid hook doesnt work?

No, i haven't got the slightest clue of what may cause your errors, TBH. confused.gif

Fix it an release new version.

lol, leave the man alone, you're the only one with this problem? If you want you can send me the script and ill try it on my PC...

Its not my script, i have only TuningMod & GrabScript.

Link to comment
Share on other sites

thaCURSEDpie

I'm having a bit of trouble with the Settings file.

 

When my script is first loaded, it reads the settings file fine. But when I try to read something from the settings file later on, it doesn't seem to work.

 

Example:

 

 

private void Startup()     {         if (!bStartup)         {        // All startup stuff in here             bStartup = true;             ReloadSettings();                      }     }// and then ReloadSettings():private void ReloadSettings() //This function works only the first time =/     {                  GodmodeKey = Settings.GetValueKey("GodmodeKey", "Keybinds", Keys.F1);         FlyThroughWindshieldImmunity = Settings.GetValueInteger("FlyThroughWindshieldImmunity", "Parameters", 0);         FireImmunity = Settings.GetValueInteger("FireImmunity", "Parameters", 0);         DragOutImmunity = Settings.GetValueInteger("DragOutImmunity", "Parameters", 0);         Console.Write("[GodmodePlus]: Settings file read");  //This doesn't work either.     }private void ReloadSettingsFileConsole(ParameterCollection Parameter) // This function get's called by the console command.     {         ReloadSettings();     }

 

 

Link to comment
Share on other sites

KingBulleT 8747

btw this is my log. dunno why its german.

 

 

2009-08-02 14:23:17 - Initializing ScriptHookDotNet v0.892 BETA (GTA IV version 1.0.4.0)2009-08-02 14:24:34 - Direct3D device created!2009-08-02 14:24:34 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()2009-08-02 14:24:47 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()

 

Link to comment
Share on other sites

btw this is my log. dunno why its german.

 

 

2009-08-02 14:23:17 - Initializing ScriptHookDotNet v0.892 BETA (GTA IV version 1.0.4.0)2009-08-02 14:24:34 - Direct3D device created!2009-08-02 14:24:34 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()2009-08-02 14:24:47 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()

 

Maybe its those scripts?? Did you tried making a script youself? I bed that works...

Link to comment
Share on other sites

thaCURSEDpie

Hm, something strange is going on. When I make a script with Microsoft C# Express edition, the plain script works fine.

 

But when I compile the script and use the compiled version, it doesn't work...

 

Error log:

 

Unable to load Assembly 'scripts\GodmodePlus.net':                     System.IO.FileLoadException: Unverifiable code failed policy check. (Exception from HRESULT: 0x80131402)                        at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)                        at System.Reflection.Assembly.Load(Byte[] rawAssembly)                        at GTA.RemoteScriptDomain.LoadAssembly(String Filename)

 

Link to comment
Share on other sites

 

Doh, I solved my vehicle problem. It wasn't the vehicle at all, it was some other code that I forgot to initialise.

 

Edit: Got another question now, ive stored the Vehicles Identifer to a value, how can I now check if that vehicle has been removed or destroyed?

 

I've tried if vehicle is null, or isalive, but both always say vehicle still exsists when it doesn't.

The Exists method checks if the vehicle still exists in the game world.

 

if v is your vehicle, use this:

 

if (v.Exists()) {

 

note that this will throw an exception when v is NULL.

 

 

However, inside your script class you can use this:

 

if (Exists(v)) {

 

it will return true when v is not NULL and still exists in game world

 

 

@thaCURSEDpie: The SettingsFile caches the values and thus will not notice by itself when the values in the file changed. Use Settings.Load() to trigger a reload of all values from the file.

Which version of Microsoft C# Express Edition do you use? Make sure to set .Net Framework 2.0 as target in the advanced compile options, not .Net Framework 3.5 .

Edited by HazardX
Link to comment
Share on other sites

KingBulleT 8747
btw this is my log. dunno why its german.

 

 

2009-08-02 14:23:17 - Initializing ScriptHookDotNet v0.892 BETA (GTA IV version 1.0.4.0)2009-08-02 14:24:34 - Direct3D device created!2009-08-02 14:24:34 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()2009-08-02 14:24:47 - Error during ScriptDomain.Create:                     System.InvalidCastException: Der transparente Proxy kann nicht in den Typ "GTA.RemoteScriptDomain" umgewandelt werden.                        bei GTA.ScriptDomain.Create()

 

Maybe its those scripts?? Did you tried making a script youself? I bed that works...

But they should work, both are updated for 1.0.3.0 and 1.0.4.0

Link to comment
Share on other sites

But they should work, both are updated for 1.0.3.0 and 1.0.4.0

Try to install THIS. I doubt it will solve the problem, but at least we can try.

Link to comment
Share on other sites

thaCURSEDpie

I am using Microsoft Visual C# 2008 Express Edition.

 

It's obviously not compiling the way it should... I can't seem to find the advanced compile options. Where should I look?

Link to comment
Share on other sites

 

I am using Microsoft Visual C# 2008 Express Edition.

 

It's obviously not compiling the way it should... I can't seem to find the advanced compile options. Where should I look?

Rightclick your project in the Solution Explorer and select "Properties". In the new window, select "Compile" (one of the options on the left side). In the compile options there is a button called "Advanced Compile Options". Click on it and select ".Net Framework 2.0" as target framework.

 

You could also copy the included TestScriptCS project and remove all existing scripts to get a fully configured starting point.

Edited by HazardX
Link to comment
Share on other sites

thaCURSEDpie

 

I am using Microsoft Visual C# 2008 Express Edition.

 

It's obviously not compiling the way it should... I can't seem to find the advanced compile options. Where should I look?

Rightclick your project in the Solution Explorer and select "Properties". In the new window, select "Compile" (one of the options on the left side). In the compile options there is a button called "Advanced Compile Options". Click on it and select ".Net Framework 2.0" as target framework.

 

You could also copy the included TestScriptCS project and remove all existing scripts to get a fully configured starting point.

I see no "compile" option...

 

here's a screenshot of my screen:

http://i122.photobucket.com/albums/o268/th...ng?t=1249322669

 

I'm using your testscript.cs as a base for my script. I don't know why it's not working confused.gif

 

EDIT:

I can't open your WindowExamples... I'll try to re-install Visual C# Express. Maybe it'll work.

Link to comment
Share on other sites

I can't open your WindowExamples... I'll try to re-install Visual C# Express. Maybe it'll work.

Which file did you try to open? Make sure to open the solution file ( TestScriptCS.sln ) and not one of the underlying cs files.

Hmm, the Express Editions seems to have a different layout for the options. Is the target framework directly in the "Application" tab maybe?

Link to comment
Share on other sites

thaCURSEDpie

I had opened the project file. I then tried to open the windowexample.cs file (through the Solution Explorer), but it gave me an error.

 

I've uninstalled Visual C# Express edition, I'm re-installing right now. Will report back smile.gif

Link to comment
Share on other sites

Doh, I solved my vehicle problem. It wasn't the vehicle at all, it was some other code that I forgot to initialise.

 

Edit: Got another question now, ive stored the Vehicles Identifer to a value, how can I now check if that vehicle has been removed or destroyed?

 

I've tried if vehicle is null, or isalive, but both always say vehicle still exsists when it doesn't.

The Exists method checks if the vehicle still exists in the game world.

 

if v is your vehicle, use this:

 

if (v.Exists()) {

 

note that this will throw an exception when v is NULL.

 

 

However, inside your script class you can use this:

 

if (Exists(v)) {

 

it will return true when v is not NULL and still exists in game world

 

 

@thaCURSEDpie: The SettingsFile caches the values and thus will not notice by itself when the values in the file changed. Use Settings.Load() to trigger a reload of all values from the file.

Which version of Microsoft C# Express Edition do you use? Make sure to set .Net Framework 2.0 as target in the advanced compile options, not .Net Framework 3.5 .

Cheers for that Hazard, worked like a dream!

Link to comment
Share on other sites

thaCURSEDpie
I can't open your WindowExamples... I'll try to re-install Visual C# Express. Maybe it'll work.

Which file did you try to open? Make sure to open the solution file ( TestScriptCS.sln ) and not one of the underlying cs files.

Hmm, the Express Editions seems to have a different layout for the options. Is the target framework directly in the "Application" tab maybe?

it is directly under the "application" tab.

 

re-installing Visual C# hasn't really improved anything yet. I've yet to try compiling a script, but I still can't view your Windowexample.cs. Screeny:

http://i122.photobucket.com/albums/o268/th...ng?t=1249325547

Link to comment
Share on other sites

it is directly under the "application" tab.

 

re-installing Visual C# hasn't really improved anything yet. I've yet to try compiling a script, but I still can't view your Windowexample.cs. Screeny:

http://i122.photobucket.com/albums/o268/th...ng?t=1249325547

Ah yes. Damn, sorry about that. blush.gif The main class in this file is derived from class "component". Thus Visual Studio tried to load a visual designer for it when you doubleclick it. But since there is no visual disigner (yet) the whole thing fails. Do a rightclick on it and select "View Code" to get to the sourcecode.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

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

×
×
  • Create New...

Important Information

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