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. Support

    3. Suggestions

errors


nordi
 Share

Recommended Posts

Hey

 

 

I got some errors when running my script, but I have a hard time, to find a solution: I get no error, on visual studio: only on scripthook log:

 

2014-04-11 16:57:22 - 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()

 

Thanks.

Edited by nordi
Link to comment
Share on other sites

I would imagine that GET_SOUND_ID would either need a sound name to look for or a sound played before a call to it.

Link to comment
Share on other sites

BTW, just noticed.

 

an if statement executes the code if the test expression returns true.

 

This:

if (call_setup == false){}

equals this:

if (!call_setup){}

And since you know the state of call_setup, you can do it like this, to execute once:

if (!call_setup){   call_setup = !call_setup;}
Link to comment
Share on other sites

Try:

soundID = GTA.Native.Function.Call<int>("GET_SOUND_ID");

If it keeps happening, just wait for JulioNIB to come by, he is the man behind the mask.

Link to comment
Share on other sites

I was just, again, looking at your code... that is a bit messy I think.

 

Is that method the one called on the tick event ? is it like this:

this.Tick += new EventHandler(APA_calls);
Edited by pedro2555
Link to comment
Share on other sites

 

BTW, just noticed.

 

an if statement executes the code if the test expression returns true.

 

This:

if (call_setup == false){}

equals this:

if (!call_setup){}

And since you know the state of call_setup, you can do it like this, to execute once:

if (!call_setup){   call_setup = !call_setup;}

 

Thanks for the tips ;)

 

Try:

soundID = GTA.Native.Function.Call<int>("GET_SOUND_ID");

If it keeps happening, just wait for JulioNIB to come by, he is the man behind the mask.

 

Still not working ...

 

 

I was just, again, looking at your code... that is a bit messy I think.

 

Is that method the one called on the tick event ? is it like this:

this.Tick += new EventHandler(APA_calls);

 

Indeed;

Everything is working: the blip is created,at the specified location, but like I said everything under soundID isn't working ... Messy: I don't know, I make sure the blip isn't already placed on the map, and the sound isn't playing, if not I place the blip, and play the sound, and when the player reach the position I delete the blip.

Edited by nordi
Link to comment
Share on other sites

 

 

I was just, again, looking at your code... that is a bit messy I think.

 

Is that method the one called on the tick event ? is it like this:

this.Tick += new EventHandler(APA_calls);

 

Indeed:

this.Interval = 10;this.Tick += new EventHandler(AFA_calls);

Everything is working: the blip is created,at the specified location, but like I said everything under soundID isn't working ... Messy: I don't know, I make sure the blip isn't already placed on the map, and the sound isn't playing, if not I place the blip, and play the sound, and when the player reach the position I delete the blip.

 

 

Then I suggest you to really learn more about the language, your code looks totally wrong.

 

Do you realize that interval at 10, means run this 100 times every second ? Back in the days, when I used to be learning programming, 100 times a second sounded like something that is way to fast do really happen, but believe me, the cheapest Intel laptop processor is capable of way more than that.

 

I can't really see what you are trying to achieve so I will not suggest anything.

Link to comment
Share on other sites

the soundID is declared as integer?

 

this line should work fine, i imagine (i use vb.net that is a little different):

soundID = GTA.Native.Function.Call<Int32>("GET_SOUND_ID");

you can add a Game.Console.Print(soundID.ToString) after this line to see what you receive from this call, must be bigger or equal 0, also, you need to obtain this sound ID only one time per use, game has a limit that fills very fast, in some seconds you will not get more sound IDs :), to keep obtaining sound IDs you need to use RELEASE_SOUND_ID method before get sound id again

so, in the startup of your Code you can do the line that get sound ID:

soundID = GTA.Native.Function.Call<Int32>("GET_SOUND_ID");

and just use it later in the Tick/Loop/Whatever you want :)

if the sound dont need to be stopped (like yours) you can use -1 as sound ID in the playback method:

GTA.Native.Function.Call("PLAY_SOUND_FROM_POSITION", -1, "BURGULAR_ALARM_BELL_LOOP", LocationX, LocationY, LocationZ);
Edited by julionib
Link to comment
Share on other sites

 

the soundID is declared as integer?

 

this line should work fine, i imagine (i use vb.net that is a little different):

soundID = GTA.Native.Function.Call<Int32>("GET_SOUND_ID");

you can add a Game.Console.Print(soundID.ToString) after this line to see what you receive from this call, must be bigger or equal 0, also, you need to obtain this sound ID only one time per use, game has a limit that fills very fast, in some seconds you will not get more sound IDs :), to keep obtaining sound IDs you need to use RELEASE_SOUND_ID method before get sound id again

 

so, in the startup of your Code you can do the line that get sound ID:

 

soundID = GTA.Native.Function.Call<Int32>("GET_SOUND_ID");

 

and just use it later in the Tick/Loop/Whatever you want :)

 

if the sound dont need to be stopped (like yours) you can use -1 as sound ID in the playback method:

GTA.Native.Function.Call("PLAY_SOUND_FROM_POSITION", -1, "BURGULAR_ALARM_BELL_LOOP", LocationX, LocationY, LocationZ);

 

Alright, using "Print(soundID.ToString)", displayed 0 on the screen, so this would mean SoundID isn't the source of the error, then, but what cause this error, the PLAY_SOUND_FROM_POSITION ?

I got the name of the song "BURGULAR_ALARM_BELL_LOOP" by going though audio file at SFX/resident, is it because it has to be in hexadecimal or something ?

 

right now, the only other source of the issue, can only be the song name, nothing else !

Edited by nordi
Link to comment
Share on other sites

in that tutorial you will find a Sounds Demo script and a sounds list file, look for "The Sounds demo script and the sounds list" and you will find the files and more instructions, based on that script you can try to play the sound before use it, some sounds cant be played. I extracted the sound names from a file that list sounds in game (cant remember the name now)

Link to comment
Share on other sites

in that tutorial you will find a Sounds Demo script and a sounds list file, look for "The Sounds demo script and the sounds list" and you will find the files and more instructions, based on that script you can try to play the sound before use it, some sounds cant be played. I extracted the sound names from a file that list sounds in game (cant remember the name now)

 

Ok, I managed to play the sound from position, using the audio name on your tutorial: "GENERAL_WEAPONS_ROCKET_LOOP". But I can not find the correct sound name to use through the SCOCL files, for: "BURGULAR_ALARM_BELL_LOOP" (SFR\resident\general\amb_resident), or "ALARM_SIREN_24K".

Link to comment
Share on other sites

you can use filters in that script, this makes easy find some sounds. the SCO file use this audio name? if he does you should use same native call to play it (from_position, from_ped, etc.)

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.