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

Btw, if there a way to be able hold down a key? Instead of tapping it? Somthing like overriding a other event?

What do you want to do with it? I don't know exactly what you are trying to achieve.

 

@boomer678: Why do you want to reload the scripts from inside a script? i don't see any good reason for it.

Link to comment
Share on other sites

 

Btw, if there a way to be able hold down a key? Instead of tapping it? Somthing like overriding a other event?

What do you want to do with it? I don't know exactly what you are trying to achieve.

 

@boomer678: Why do you want to reload the scripts from inside a script? i don't see any good reason for it.

For reloading customteleport locations... lol. I tried doing the loadteleportlocations that i use to load them on startup but thats in a different class and not working. Could you say how to reload a script...****** never mind i think i figured it out

Link to comment
Share on other sites

 

For reloading customteleport locations... lol. I tried doing the loadteleportlocations that i use to load them on startup but thats in a different class and not working. Could you say how to reload a script...****** never mind i think i figured it out

erm, if it is your script, why don't you just call the loading function again? there is absolutely no need to restart the whole script.

Link to comment
Share on other sites

For reloading customteleport locations... lol. I tried doing the loadteleportlocations that i use to load them on startup but thats in a different class and not working. Could you say how to reload a script...****** never mind i think i figured it out

erm, if it is your script, why don't you just call the loading function again? there is absolutely no need to restart the whole script.

Yea i figured it out. lol, because it as in a diff class i had to just paste it into this class tounge.gif and it worked

Link to comment
Share on other sites

 

Btw, if there a way to be able hold down a key? Instead of tapping it? Somthing like overriding a other event?

If you want to hold down a key, just use the isKeyPressed function inside the tick event. It will fire each time the tick event fires, if you are holding the key down.

 

 

EDIT: I also found out that calling Game.FadeScreenOut causes script errors.

 

 

                      System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.                        at Scripting.?A0xd3f7cbdd.DoScreenFadeOut(UInt32 )                        at GTA.Game.FadeScreenOut(Int32 time, Boolean WaitUntilDone)

 

Edited by CoMPMStR
Link to comment
Share on other sites

Btw, if there a way to be able hold down a key? Instead of tapping it? Somthing like overriding a other event?

If you want to hold down a key, just use the isKeyPressed function inside the tick event. It will fire each time the tick event fires, if you are holding the key down.

 

 

EDIT: I also found out that calling Game.FadeScreenOut causes script errors.

 

 

                      System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.                        at Scripting.?A0xd3f7cbdd.DoScreenFadeOut(UInt32 )                        at GTA.Game.FadeScreenOut(Int32 time, Boolean WaitUntilDone)

 

Also fadein

Link to comment
Share on other sites

 

i crash when i change from multyplayer game sad.gificon13.gif

Are you sure to have the new version 0.84? I bet you are using an old version.

Edited by HazardX
Link to comment
Share on other sites

 

Btw, if there a way to be able hold down a key? Instead of tapping it? Somthing like overriding a other event?

What do you want to do with it? I don't know exactly what you are trying to achieve.

 

@boomer678: Why do you want to reload the scripts from inside a script? i don't see any good reason for it.

Holding a key down to, for example, move a object. Its annoying that you have release the key before its jumps to Key_Press event again...

 

Ill try the IsKeyPressed. But thats not really what i want, then i have code in Key_Press and my Tick.

Link to comment
Share on other sites

 

Holding a key down to, for example, move a object. Its annoying that you have release the key before its jumps to Key_Press event again...

 

 

maybe you can trigger a while loop like:

 

 

var myKey = Keys.Up; //whateverBindKey(myKey, startMovingObject);//...void startMovingObject(){   while(isKeyPressed(myKey))   {      // your logic here   }}

 

you may want to move the while loop to a new method to reuse it. but this is clean enough.

Edited by diryboy
Link to comment
Share on other sites

Holding a key down to, for example, move a object. Its annoying that you have release the key before its jumps to Key_Press event again...

 

 

maybe you can trigger a while loop like:

 

 

var myKey = Keys.Up; //whateverBindKey(myKey, startMovingObject);//...void startMovingObject(){   while(isKeyPressed(myKey))   {      // your logic here   }}

 

you may want to move the while loop to a new method to reuse it. but this is clean enough.

That indeed alot cleaner, thx smile.gif

Link to comment
Share on other sites

hi, Hazard, when i call Vehicle.Explode(), the game crash.

 

here's the log

 

2009-02-15 20:38:26 - Error during Tick in script 'DiryBoy.ScriptCollection.CarsAreRocketsScript':                     System.AccessViolationException: ³¢Ô¶ÁÈ¡»òдÈëܱ£»¤µÄÄÚ´æ¡£Õâͨ³£Ö¸¾ÆäËûÄÚ´æÒÑË𻵡£                        ÔÚ Scripting.?A0x6b4a29d7.ExplodeCar(Int32 , Boolean , Boolean )                        ÔÚ GTA.Vehicle.Explode()                        ÔÚ DiryBoy.ScriptCollection.CarsAreRocketsScript.launchCarRocket()                        ÔÚ GTA.Script.ProcessBoundKey(Keys Key)                        ÔÚ GTA.Script.ProcessEvents()                        ÔÚ GTA.Script.DoTick()                        ÔÚ GTA.ScriptThread.OnTick()

 

 

here's the code snipet of my script in an key event handler

 

var v = World.GetClosestVehicle(Player.Character.Position, 100f, VehicleType.All);if ( Exists(v) ){   v.Heading = Player.Character.Heading;   v.EveryoneLeaveVehicle();   Wait(500);   v.Speed = 300f;   v.Explode();}

 

Link to comment
Share on other sites

I'm wondering how the natives set_text_colour works. Is this scripthook using this native, and if so, what are the exact parameters ?

 

 

Link to comment
Share on other sites

Holding a key down to, for example, move a object. Its annoying that you have release the key before its jumps to Key_Press event again...

 

 

maybe you can trigger a while loop like:

 

 

var myKey = Keys.Up; //whateverBindKey(myKey, startMovingObject);//...void startMovingObject(){   while(isKeyPressed(myKey))   {      // your logic here   }}

 

you may want to move the while loop to a new method to reuse it. but this is clean enough.

That indeed alot cleaner, thx smile.gif

well this may seems clean, but it may block the override Tick() from being executed. be careful.

Link to comment
Share on other sites

I'm getting the error pointed by diryboy in Vehicle.ApplyForce as well.

 

 

2009-02-15 10:31:16 - Error during Tick in script 'ErikScript01':                     System.AccessViolationException: Tentativa de leitura ou gravação em memória protegida. Normalmente, isso é uma indicação de que outra memória está danificada.                        em NativeInvoke.Invoke<unsigned int,int,unsigned int,float,float,float,float,float,float,unsigned int,unsigned int,unsigned int,unsigned int>(SByte* , Int32 , UInt32 , Single , Single , Single , Single , Single , Single , UInt32 , UInt32 , UInt32 , UInt32 )                        em GTA.Vehicle.ApplyForce(Vector3 Directional, Vector3 Angular)                        em ErikScript01.KeyDown(Keys key)                        em GTA.Script.ProcessEvents()                        em GTA.Script.DoTick()                        em GTA.ScriptThread.OnTick()

 

 

I was trying to use ApplyForce to launch the exploding car into the air since Speed makes it go forward only and Velocity is unsettable.

Link to comment
Share on other sites

 

I'm getting the error pointed by diryboy in Vehicle.ApplyForce as well.

 

...

 

I was trying to use ApplyForce to launch the exploding car into the air since Speed makes it go forward only and Velocity is unsettable.

 

did i say it earlier?

the Vehicle.Velocity in 0.84 version is settable, but i think it has some problem.

 

 

2009-02-16 00:06:12 - Error during Tick in script 'DiryBoy.ScriptCollection.RealRCScript':                     System.AccessViolationException: ³¢Ô¶ÁÈ¡»òдÈëܱ£»¤µÄÄÚ´æ¡£Õâͨ³£Ö¸¾ÆäËûÄÚ´æÒÑË𻵡£                        ÔÚ NativeInvoke.Invoke<unsigned int,int,unsigned int,float,float,float,float,float,float,unsigned int,unsigned int,unsigned int,unsigned int>(SByte* , Int32 , UInt32 , Single , Single , Single , Single , Single , Single , UInt32 , UInt32 , UInt32 , UInt32 )                        ÔÚ GTA.Vehicle.ApplyForce(Vector3 Directional, Vector3 Angular)                        ÔÚ GTA.Vehicle.set_Velocity(Vector3 value)                        ÔÚ DiryBoy.ScriptCollection.RealRCScript.addjustAccelerate()                        ÔÚ DiryBoy.ScriptCollection.RealRCScript.startRcControl()                        ÔÚ GTA.Script.ProcessBoundKey(Keys Key)                        ÔÚ GTA.Script.ProcessEvents()                        ÔÚ GTA.Script.DoTick()                        ÔÚ GTA.ScriptThread.OnTick()

 

 

my code snippet

 

if ( isKeyPressed(Keys.Up) ){   car.Velocity *= 1.1f;}

 

 

while in another test script i wrote

 

vehicle.ApplyForce(new Vector3(100f,100f,100f), new vector3(100f,100f,100f));

 

and this works fine.

 

maybe some special edge case...

Edited by diryboy
Link to comment
Share on other sites

Hi HazardX :

 

I find two bugs in 0.84 today..

 

Model.Name and Model.ToString() : return null string "" . So can't find model name...

Vehicle.Explode() : This Method no file effect, and call this method some times the GAME will DIE.

 

 

BLADE

 

 

Link to comment
Share on other sites

 

So, what about cameras?

This isn't a request thread. You can't keep coming back and saying "So, what about cameras" and expect someone to drop everything they're doing just to make you a camera script. How about you go download VB and make it yourself. Then come post it here for all of us to use? We all have our own issues to worry about. I know you can see that people are now having more problems than before.

 

 

Ok back on topic: lol.gif

I've had reports of a few other methods that were causing corrupt memory script crashes.

 

 

                      System.AccessViolationException: Poging tot het lezen of schrijven van beveiligd geheugen. Dit duidt er vaak op dat ander geheugen is beschadigd.   (=effort to read or write of secured memory. This results in the possibility that other memory is damaged)                        bij Scripting.?A0x6b4a29d7.DeleteCar(Int32* )                        bij GTA.Vehicle.Delete()

 

 

 

                      System.AccessViolationException: Poging tot het lezen of schrijven van beveiligd geheugen. Dit duidt er vaak op dat ander geheugen is beschadigd.                        bij Scripting.?A0x8c39ee23.GetCharHealth(Int32 , UInt32* )                        bij GTA.Ped.get_Health()

 

Link to comment
Share on other sites

So, what about cameras?

This isn't a request thread. You can't keep coming back and saying "So, what about cameras" and expect someone to drop everything they're doing just to make you a camera script. How about you go download VB and make it yourself. Then come post it here for all of us to use? We all have our own issues to worry about. I know you can see that people are now having more problems than before.

Ok, ok. Sorry for the SPAM then! tounge.gif

Link to comment
Share on other sites

I get the following error when I try to run the .NET scripthook 0.84:

 

Runtime error!R6030- CRT not initialized

 

 

I have all the .net updates (up to 3.5). I have microsoft visual C++ express installed.

Link to comment
Share on other sites

I get the following error when I try to run the .NET scripthook 0.84:

 

Runtime error!R6030- CRT not initialized

 

 

I have all the .net updates (up to 3.5). I have microsoft visual C++ express installed.

I think this is due to the asi loader, try xliveless or yasil.

 

 

Link to comment
Share on other sites

Hi HazardX,

 

another AccessViolation when setting Game.MainCamera.Position property.

 

System.AccessViolationException: Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.

bei NativeInvoke.Invoke<unsigned int,unsigned int,float,float,float>(SByte* , UInt32 , Single , Single , Single )

bei GTA.Camera.set_Position(Vector3 value)

bei FunpackDotNet.FunpackScript.KeyDown(Keys key)

bei GTA.Script.ProcessEvents()

bei GTA.Script.DoTick()

bei GTA.ScriptThread.OnTick()

 

Bye.

Link to comment
Share on other sites

Ok, this is a noob question i feel it: how can i get the distance between 2 coords(vec)? For ex. i want to detect if a player is close a this end point.

Link to comment
Share on other sites

 

Ok, this is a noob question i feel it: how can i get the distance between 2 coords(vec)? For ex. i want to detect if a player is close a this end point.

it is, somewhat. wink.gif

 

Thats the basic math:

 

distance = (pos1-pos2).Length

 

The length of the difference between two positions is the distance.

 

But i've included the DistanceTo function for readability:

 

distance = pos1.DistanceTo(pos2)

 

Link to comment
Share on other sites

Ok, this is a noob question i feel it: how can i get the distance between 2 coords(vec)? For ex. i want to detect if a player is close a this end point.

it is, somewhat. wink.gif

 

Thats the basic math:

 

distance = (pos1-pos2).Length

 

The length of the difference between two positions is the distance.

 

But i've included the DistanceTo function for readability:

 

distance = pos1.DistanceTo(pos2)

 

See! LOL. Yeah basic math sure (although i stink at math), i know a-b tounge.gif But i didnt thought it would work with vectors, because it has 3 axis. Thanks for the DistanceTo function smile.gif

Link to comment
Share on other sites

Hey hazard.. how would you play a mp3 or wav file. I got something working(my.computer.audio.play) and it plays wav sounds. But only pcm wav ( which is like windows wav file) if i try to play other wav than a sound from windwos i get an error. Also i tried wmp.dll and that did not work... so you know any way to play a mp3 or wav file other than my.computer.audio.play

Link to comment
Share on other sites

 

Hey hazard.. how would you play a mp3 or wav file. I got something working(my.computer.audio.play) and it plays wav sounds. But only pcm wav ( which is like windows wav file) if i try to play other wav than a sound from windwos i get an error. Also i tried wmp.dll and that did not work... so you know any way to play a mp3 or wav file other than my.computer.audio.play

 

Dim wav As New System.Media.SoundPlayerwav.SoundLocation = "filename.wav"wav.Play()

 

 

Enjoy! biggrin.gif

Link to comment
Share on other sites

 

Hey hazard.. how would you play a mp3 or wav file. I got something working(my.computer.audio.play) and it plays wav sounds. But only pcm wav ( which is like windows wav file) if i try to play other wav than a sound from windwos i get an error. Also i tried wmp.dll and that did not work... so you know any way to play a mp3 or wav file other than my.computer.audio.play

 

Dim wav As New System.Media.SoundPlayerwav.SoundLocation = "filename.wav"wav.Play()

 

 

Enjoy! biggrin.gif

Thanks biggrin.gif can you play mp3s?

*********EDIT THIS DOESNT WORK

IT gives me an error just like other one. IT can only play PCM wave files

ALso i think this is the same thing as doing my.computer.audio.play("FILE.wav")

Edited by boomer678
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

  • 4 Users Currently Viewing
    0 members, 0 Anonymous, 4 Guests

×
×
  • Create New...

Important Information

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