Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    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. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. 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. 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
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

HazardX

[BETA] GTAIV .Net ScriptHook

Recommended Posts

Intosia

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

Share this post


Link to post
Share on other sites
HazardX
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.

Share this post


Link to post
Share on other sites
boomer678

 

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

Share this post


Link to post
Share on other sites
HazardX

 

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.

Share this post


Link to post
Share on other sites
boomer678
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

Share this post


Link to post
Share on other sites
CoMPMStR

 

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

Share this post


Link to post
Share on other sites
boomer678
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

Share this post


Link to post
Share on other sites
Diaz070

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

Share this post


Link to post
Share on other sites
HazardX

 

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

Share this post


Link to post
Share on other sites
Intosia

 

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.

Share this post


Link to post
Share on other sites
diryboy

 

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

Share this post


Link to post
Share on other sites
Intosia

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

Share this post


Link to post
Share on other sites
diryboy

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();}

 

Share this post


Link to post
Share on other sites
sjaak327

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

 

 

Share this post


Link to post
Share on other sites
diryboy

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.

Share this post


Link to post
Share on other sites
Erik JS

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.

Share this post


Link to post
Share on other sites
diryboy

 

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

Share this post


Link to post
Share on other sites
fengyeblade

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

 

 

Share this post


Link to post
Share on other sites
CoMPMStR

 

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()

 

Share this post


Link to post
Share on other sites
Phnx
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

Share this post


Link to post
Share on other sites
thaCURSEDpie

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.

Share this post


Link to post
Share on other sites
sjaak327
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.

 

 

Share this post


Link to post
Share on other sites
CleanShot

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.

Share this post


Link to post
Share on other sites
Intosia

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.

Share this post


Link to post
Share on other sites
HazardX

 

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)

 

Share this post


Link to post
Share on other sites
Intosia
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

Share this post


Link to post
Share on other sites
boomer678

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

Share this post


Link to post
Share on other sites
CoMPMStR

 

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

Share this post


Link to post
Share on other sites
boomer678

 

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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

×
×
  • Create New...

Important Information

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