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

How would I use the method World.CheckForCollisions? It doesn't return a value so how do I determine if it found collisions in that position or not? I'm trying to spawn up to 3 vehicles on the street, but I don't want them to accidentally overlap on top of each other. Is there anyway to prevent this?

 

@boomer678: That method is used to play audio events, not radio songs. If you put in "WEAPON_PICKUP_CAR_BOMB" or "MOBILE_PHONE_SMS_RECIEVE" it will work. Those are the only two I found in the sco files.

So anyway to play radio songs?

Link to comment
Share on other sites

 

How would I use the method World.CheckForCollisions? It doesn't return a value so how do I determine if it found collisions in that position or not? I'm trying to spawn up to 3 vehicles on the street, but I don't want them to accidentally overlap on top of each other. Is there anyway to prevent this?

 

@boomer678: That method is used to play audio events, not radio songs. If you put in "WEAPON_PICKUP_CAR_BOMB" or "MOBILE_PHONE_SMS_RECIEVE" it will work. Those are the only two I found in the sco files.

So anyway to play radio songs?

I don't know but I'm sure if somebody found out a way, there'd be a mod somewhere to do it. wink.gif I personally didn't looked into having the radio always playing.

 

 

I just found out that calling Model.Hash produces an error:

 

 

                      System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.                        at Scripting.?A0x8c39ee23.GetCharModel(Int32 , eModel* )                        at GTA.Ped.get_Model()

 

 

I tried using the model hash to compare peds, to determine which of my bodyguards was sitting in my passenger seat. At first, I tried comparing the ped objects but since it's two different references, they're never equal. I figured comparing the model hash would work better, since all my gurads have different models.

Link to comment
Share on other sites

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

Edited by diryboy
Link to comment
Share on other sites

hey CoMPMStR or hazard X. Is there a way to get the last key pressed. I made a custom teleport which loads from txt file like hazards. I made it so that if i press control and numpad 9 it will write the xyz to it so you can add custom teleports ingame without having to get out and add them. but i need the key to be in front of everthing except the vbCrLf( which is just making a new line before it writes the text. so its like this now

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)                   Game.DisplayText(Player.Character.Position.ToString + " written to txt flie")

 

 

but i want it to have the key that i pressed LAST first. so something like this it should look like( where key = last key pressed)

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & KEY & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)                   Game.DisplayText(Player.Character.Position.ToString + " written to txt flie")

 

Edited by boomer678
Link to comment
Share on other sites

 

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

You can use Game.Console.Print to print strings to the console. This is what I use to provide info, just set up commands to print out the info, something like command_help.

 

 

@boomer678: The way I would do it is set up a variable to record the last key pressed, which would be used in the keydown event.

 

 

    Private lastKeyPressed As Keys = Keys.None   Protected Overrides Sub KeyDown(ByVal key As Keys)       If key > 0 Then lastKeyPressed = key   End Sub

 

 

Then you could save it to the file as an integer or string:

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & CInt(lastKeyPressed) & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

Is this what you were talking about?

Link to comment
Share on other sites

hey CoMPMStR or hazard X. Is there a way to get the last key pressed. I made a custom teleport which loads from txt file like hazards. I made it so that if i press control and numpad 9 it will write the xyz to it so you can add custom teleports ingame without having to get out and add them. but i need the key to be in front of everthing except the vbCrLf( which is just making a new line before it writes the text. so its like this now

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)                   Game.DisplayText(Player.Character.Position.ToString + " written to txt flie")

 

 

but i want it to have the key that i pressed LAST first. so something like this it should look like( where key = last key pressed)

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & KEY & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)                   Game.DisplayText(Player.Character.Position.ToString + " written to txt flie")

 

i got an idea. you may hold a field to store it, and modify it in KeyDown method, and you may have to check the modifiers before modifying it

Link to comment
Share on other sites

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

You can use Game.Console.Print to print strings to the console. This is what I use to provide info, just set up commands to print out the info, something like command_help.

 

 

@boomer678: The way I would do it is set up a variable to record the last key pressed, which would be used in the keydown event.

 

 

    Private lastKeyPressed As Keys = Keys.None   Protected Overrides Sub KeyDown(ByVal key As Keys)       If key > 0 Then lastKeyPressed = key   End Sub

 

 

Then you could save it to the file as an integer or string:

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & CInt(lastKeyPressed) & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

Is this what you were talking about?

you are faster than me haha.

 

but this may cause a lot of custom ListInfoDiryboy or ListInfoComputerMaster so on..

Link to comment
Share on other sites

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

I thought about it while adding the BindConsoleCommand. it would be no problem to include the commands with a custom helptext into the "help" listing. BUT this way the help list would be prettly large and confusing soon. But i'm considering to add a scroll option to the console, which would allow to have such a large list

Link to comment
Share on other sites

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

I thought about it while adding the BindConsoleCommand. it would be no problem to include the commands with a custom helptext into the "help" listing. BUT this way the help list would be prettly large and confusing soon. But i'm considering to add a scroll option to the console, which would allow to have such a large list

a scrollbar is cool! hope that we can mouse wheel to browse the console outputs, might need a ClearScreen command, haha~

i also have an idea, is it possible to make a help menu and categorize the custom commands hotkeys or some meta data, that will be cool.

Link to comment
Share on other sites

In a loop. Call World.GetClosestPe(,) n times,the game must die....  n > 8

Indeed¡£the same to Call GetRandomPeds() cry.gifcry.gif

 

HazardX i need your help ! or my chaos mod wouldn't work !

 

http://www.gtaforums.com/index.php?showtopic=397744

Hmm, i was expecting problems like that after the threading fix. confused.gif Oh well... to get it to work, use the native call instead, until the next (fixed) version is out:

 

 

   Public Function GetRandomPed(ByVal Position As Vector3, ByVal Radius As Single) As Ped     Dim ped As New Native.Pointer(GetType(Ped))     Native.Function.Call("BEGIN_CHAR_SEARCH_CRITERIA")     Native.Function.Call("END_CHAR_SEARCH_CRITERIA")     Native.Function.Call("GET_RANDOM_CHAR_IN_AREA_OFFSET_NO_SAVE", Position.X - Radius, Position.Y - Radius, Position.Z - Radius, Radius * 2.0F, Radius * 2.0F, Radius * 2.0F, ped)     Return ped  End Function

 

 

Native.Function.Call does not suffer from the problems that some functions have with the new threading architecture.

Link to comment
Share on other sites

In a loop. Call World.GetClosestPe(,) n times,the game must die.... n > 8

Indeed¡£the same to Call GetRandomPeds() cry.gifcry.gif

 

HazardX i need your help ! or my chaos mod wouldn't work !

 

http://www.gtaforums.com/index.php?showtopic=397744

Hmm, i was expecting problems like that after the threading fix. confused.gif Oh well... to get it to work, use the native call instead, until the next (fixed) version is out:

 

 

   Public Function GetRandomPed(ByVal Position As Vector3, ByVal Radius As Single) As Ped     Dim ped As New Native.Pointer(GetType(Ped))     Native.Function.Call("BEGIN_CHAR_SEARCH_CRITERIA")     Native.Function.Call("END_CHAR_SEARCH_CRITERIA")     Native.Function.Call("GET_RANDOM_CHAR_IN_AREA_OFFSET_NO_SAVE", Position.X - Radius, Position.Y - Radius, Position.Z - Radius, Radius * 2.0F, Radius * 2.0F, Radius * 2.0F, ped)     Return ped  End Function

 

 

Native.Function.Call does not suffer from the problems that some functions have with the new threading architecture.

Thx£¬ it seems works happy.gif

 

but how to use native call to replace CetClosetVehical() function ?

Link to comment
Share on other sites

Unfortunate£¬ i found even the native call could not resolve crashing cry.gif , just relaying it.

 

So, Hazardx, i must wait for new version.

Link to comment
Share on other sites

hi, Hazard, is there any way to provide our own help info for our commands?

such as listing the available commands not only the built in commands and some additional help info.

 

it's nice that if we can register the additinal info too. maybe provide an overloaded version of BindConsoleCommand?

I thought about it while adding the BindConsoleCommand. it would be no problem to include the commands with a custom helptext into the "help" listing. BUT this way the help list would be prettly large and confusing soon. But i'm considering to add a scroll option to the console, which would allow to have such a large list

Ok nice, i wanted to suggest for the console: When you press ~ you this the current console, and with shift+~ you get a fullscreen console (for when you have alot of debug messages). This is the way the console in COD4 works, always liked it. Ow and maybe a 'mini-console'. So when the console is hidden you see 1 row of text from the console without a background color. Hope you get what i meant tounge.gif

Link to comment
Share on other sites

 

Unfortunate£¬ i found even the native call could not resolve crashing  cry.gif , just relaying it.

Are you sure that it is the native call that is crashing? Could you send me the ScriptHookDotNet.log right after a crash?

And the GetClosetVehicle also results in a crash sometimes?

 

@Intosia: Currently you can use the PageUp and PageDown keys to shrink/grow the console (small is 1/3 of the screen, large is 3/4). I might reuse the keys for scrolling in the next version, but keep the grow/shrink when you hold Shift maybe and change it to 1/4 steps up to complete fullscreen.

Edited by HazardX
Link to comment
Share on other sites

Unfortunate£¬ i found even the native call could not resolve crashing  cry.gif , just relaying it.

Are you sure that it is the native call that is crashing? Could you send me the ScriptHookDotNet.log right after a crash?

And the GetClosetVehicle also results in a crash sometimes?

 

@Intosia: Currently you can use the PageUp and PageDown keys to shrink/grow the console (small is 1/3 of the screen, large is 3/4). I might reuse the keys for scrolling in the next version, but keep the grow/shrink when you hold Shift maybe and change it to 1/4 steps up to complete fullscreen.

Hmm ok, thanks for the tip. Maybe you have to block the Pageup and down keys when the console is open. I had something binded on it, and when the console was open the keys still functioned (and the console didnt resize i remember now). I thought it was wierd, since the console was open... But this explains.

Link to comment
Share on other sites

Hmm ok, thanks for the tip. Maybe you have to block the Pageup and down keys when the console is open. I had something binded on it, and when the console was open the keys still functioned (and the console didnt resize i remember now). I thought it was wierd, since the console was open... But this explains.

The keys are blocked when the console is open, but i can only block the input of .Net scripts, not any other scripts/plugins. Or was it a .Net script?

Link to comment
Share on other sites

In a loop. Call World.GetClosestPe(,) n times,the game must die....  n > 8

Indeed¡£the same to Call GetRandomPeds() cry.gifcry.gif

 

HazardX i need your help ! or my chaos mod wouldn't work !

 

http://www.gtaforums.com/index.php?showtopic=397744

Hmm, i was expecting problems like that after the threading fix. confused.gif Oh well... to get it to work, use the native call instead, until the next (fixed) version is out:

 

 

   Public Function GetRandomPed(ByVal Position As Vector3, ByVal Radius As Single) As Ped     Dim ped As New Native.Pointer(GetType(Ped))     Native.Function.Call("BEGIN_CHAR_SEARCH_CRITERIA")     Native.Function.Call("END_CHAR_SEARCH_CRITERIA")     Native.Function.Call("GET_RANDOM_CHAR_IN_AREA_OFFSET_NO_SAVE", Position.X - Radius, Position.Y - Radius, Position.Z - Radius, Radius * 2.0F, Radius * 2.0F, Radius * 2.0F, ped)     Return ped  End Function

 

 

Native.Function.Call does not suffer from the problems that some functions have with the new threading architecture.

Thank you very much....

\

 

 

I want you can give us some Docment(or source list) about the GTA.Euphoria. Thanks..

Link to comment
Share on other sites

 

Are you sure that it is the native call that is crashing? Could you send me the ScriptHookDotNet.log right after a crash?

And the GetClosetVehicle also results in a crash sometimes?

 

 

Humm, maybe something is REAL wrong.

 

i see only this in this log:

 

 

2009-02-14 19:29:05 - Initializing ScriptHookDotNet v0.84 BETA (GTA IV version 1.0.2.0)2009-02-14 19:30:49 - SEARCHING FOR SCRIPTS...2009-02-14 19:30:50 - Loading scripts in Assembly 'E:\games\Rockstar Games\Grand Theft Auto IV\scripts\WildCity.net.dll' ...2009-02-14 19:30:50 -  ...found script 'SmokyRain_WildCity'!2009-02-14 19:30:50 - DONE! 1 valid scripts found!2009-02-14 19:30:50 - STARTING SCRIPTS...2009-02-14 19:30:50 -  ...successfully started script 'SmokyRain_WildCity'!

 

 

over.

 

The code you show me is based on VB.net, but i wrote it using C#.so i rewrited it like this:

 

private Ped MyGetRandomPed(Vector3 Position, float Radius)   {       GTA.Native.Pointer myPed = new GTA.Native.Pointer(typeof(Ped));       GTA.Native.Function.Call("BEGIN_CHAR_SEARCH_CRITERIA");       GTA.Native.Function.Call("END_CHAR_SEARCH_CRITERIA");       GTA.Native.Function.Call("GET_RANDOM_CHAR_IN_AREA_OFFSET_NO_SAVE",                                   Position.X - Radius/2,                                    Position.Y - Radius/2,                                    Position.Z - Radius/2,                                    Radius,                                    Radius,                                   Radius,                                   myPed);       return ((Ped)myPed);   }

 

 

Anything wrong?

 

Link to comment
Share on other sites

hi, Hazard, maybe is better to implement IEnumerable<T> interface for the types that has -Collection suffix. so that we can take advantage of the foreach loop. thank you!

Link to comment
Share on other sites

 

 

@boomer678: The way I would do it is set up a variable to record the last key pressed, which would be used in the keydown event.

 

 

    Private lastKeyPressed As Keys = Keys.None   Protected Overrides Sub KeyDown(ByVal key As Keys)       If key > 0 Then lastKeyPressed = key   End Sub

 

 

Then you could save it to the file as an integer or string:

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & CInt(lastKeyPressed) & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

 

Is this what you were talking about?

Yea.... thats what i meant. Thanks biggrin.gif now i can set custom teleports ingame

Edited by boomer678
Link to comment
Share on other sites

hi, is there a way to determine whether niko is swimming? i want to speed up while he's swimming, and only when he's swimming. thank you!

Link to comment
Share on other sites

 

                Game.DisplayText("You have 5 seconds to press a key, after you press your key dont touch anything.", 5000)               Wait(5000)               If key > 0 Then lastKeyPressed = key               My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)

 

I know why this isnt working.. while waiting it does not do anything. so it doesnt get the last key. How could i fix it?

Link to comment
Share on other sites

 

I thought about it while adding the BindConsoleCommand. it would be no problem to include the commands with a custom helptext into the "help" listing. BUT this way the help list would be prettly large and confusing soon. But i'm considering to add a scroll option to the console, which would allow to have such a large list

I've already implemented a similar feature in my script, since I have large amounts of options to display for certain things. Here's an example: (for those who care to use it)

 

 

    Private Sub WaitForKeypress()       Do Until CheckAnyKeypress() = True           If Game.Console.isActive = False Then Exit Do           Wait(0)       Loop   End Sub   Private Function CheckAnyKeypress() As Boolean       Do While True           For ck As Integer = 1 To 255               If isKeyPressed(ck) Then Return True               Threading.Thread.Sleep(0)           Next : Wait(0)       Loop   End Function

 

 

Now when you call WaitForKeypress, it will pause the script until you press a key (naturally). Also if you close the console, it will exit the loop to continue on with the script functions. Here's an example of usage:

 

 

    Private Sub PrintValidOptions()       Game.Console.Print("Available Key Options:")       Game.Console.Print("master, index, spawn, tasktype, spawncount, spawntype, attachpoint, attachpr, modifier")       Game.Console.Print(" ")       Game.Console.Print("Available Value Options:")       Game.Console.Print("alwaysdisplaystatswhenenabled, minpeddist, maxpeddist, ragdollforce, richpeds")       Game.Console.Print("pedfriendlyfire, alwaysrandompeds, alwaysplacepedsonstreet, standstillpedcount")       Game.Console.Print("standstillpeddist, fleepedcount, fleepeddist, showfleepedblips")       Game.Console.Print("fleepedblipmindist, fleepedblipmaxdist, fleefalltime, fleefallforce")       Game.Console.Print("Press any key to continue...") : Wait(250) : WaitForKeypress()       Game.Console.Print("fleefallpedcount, mindefendpeddist, maxdefendpeddist, defendpedhealth")       Game.Console.Print("defendpedarmor, defendpedweapon, defendpedaccuracy, defendpedsenserange")       Game.Console.Print("defendpeddefensearea, defendpedmodels, defendpedcount, defendpeddist")       Game.Console.Print("showdefendpedblips, formationspacing, defendpedblipmindist, defendpedblipmaxdist")       Game.Console.Print("minfightpeddist, maxfightpeddist, fightpedhealth, fightpedarmor, fightpedweapon")       Game.Console.Print("fightpedaccuracy, fightpedsenserange, fightpeddefensearea, fightpedmodels")       Game.Console.Print("fightpedcount, fightpeddist, showfightpedblips, fightpedrespawninterval")       Game.Console.Print("playfightpedsounds, fightpedblipmindist, fightpedblipmaxdist, followpedhealth")       Game.Console.Print("Press any key to continue...") : Wait(250) : WaitForKeypress()       Game.Console.Print("followpedcount, followpeddist, showfollowpedblips, followpedblipmindist")       Game.Console.Print("followpedblipmaxdist, firepedhealth, firepedcount, firepeddist, wanderpedcount")       Game.Console.Print("wanderpeddist, showwanderpedblips, wanderpedblipmindist, wanderpedblipmaxdist")       Game.Console.Print("passengerpeddist, mincardist, maxcardist, alwaysrandomcars, alwaysplacecarsonstreet")       Game.Console.Print("invinciblecardist, explodecartime, explodecarcount, passengercardist")       Game.Console.Print("minobjectdist, maxobjectdist, alwaysplaceobjsonstreet, objectcount, objectdist")       Game.Console.Print("objectposrotchange, objectheadchange")   End Sub

 

 

Now as you can tell this is quite a lot of lines to print to the console at once. I still haven't found out how to resize the console window, so only 9 lines are displayed at any one time. When you call the sub, it will show the first 9 lines (8 lines then the Press any key to continue line), then wait for any keypress, and continue, repeating until all the lines are displayed. Easy and effective! biggrin.gif It works like the DOS Prompt.

 

 

 

@boomer678: When you call the Wait command, the script does exactly that. It doesn't process anymore commands until the wait time has been reached. You can solve it by using the above WaitForKeypress method, but modify it for your personal use.

 

 

    Private lastKeyPressed As Keys = Keys.None   Private Sub WaitForLastKeyPressed()       lastKeyPressed = Keys.None       Do Until CheckAnyKeypress() = True           Wait(0)       Loop   End Sub   Private Function CheckAnyKeypress() As Boolean       Do While True           For ck As Integer = 1 To 255               If isKeyPressed(ck) Then lastKeyPressed = ck : Return True               Threading.Thread.Sleep(0)           Next : Wait(0)       Loop   End Function   Private Sub Keysub()       Game.DisplayText("You now have to press a key.", 5000)       Wait(250)       WaitForLastKeyPressed()       Game.DisplayText("Last key: " & lastKeyPressed.ToString, 5000)       'My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)   End Sub   Protected Overrides Sub KeyDown(ByVal key As Keys)       If key > Keys.None Then lastKeyPressed = key       If key = Keys.Oemcomma Then Keysub()   End Sub

 

 

In this code, when you press the comma key it will tell you that you need to press another key. I hope this helps.

Link to comment
Share on other sites

 

 

@boomer678: When you call the Wait command, the script does exactly that. It doesn't process anymore commands until the wait time has been reached. You can solve it by using the above WaitForKeypress method, but modify it for your personal use.

 

 

    Private lastKeyPressed As Keys = Keys.None   Private Sub WaitForLastKeyPressed()       lastKeyPressed = Keys.None       Do Until CheckAnyKeypress() = True           Wait(0)       Loop   End Sub   Private Function CheckAnyKeypress() As Boolean       Do While True           For ck As Integer = 1 To 255               If isKeyPressed(ck) Then lastKeyPressed = ck : Return True               Threading.Thread.Sleep(0)           Next : Wait(0)       Loop   End Function   Private Sub Keysub()       Game.DisplayText("You now have to press a key.", 5000)       Wait(250)       WaitForLastKeyPressed()       Game.DisplayText("Last key: " & lastKeyPressed.ToString, 5000)       'My.Computer.FileSystem.WriteAllText(Game.InstallFolder & "\scripts\customteleport.txt", vbCrLf & lastKeyPressed.ToString & ", " & Player.Character.Position.X & ", " & Player.Character.Position.Y & ", " & Player.Character.Position.Z, True)   End Sub   Protected Overrides Sub KeyDown(ByVal key As Keys)       If key > Keys.None Then lastKeyPressed = key       If key = Keys.Oemcomma Then Keysub()   End Sub

 

 

In this code, when you press the comma key it will tell you that you need to press another key. I hope this helps.

Thanks... your awesome biggrin.gif

Link to comment
Share on other sites

 

Game.Console.SendCommand("ReloadScripts")

Anyway to reload the scripts? I tried this but it just freezes ** edit I think this should work

 

 

sendkeys.send("`reloadscripts{ENTER}")

 

 

EDIT THAT DIDNT WORK sad.gif

 

** Edit , didnt need to reload( i got it)

lol could someone just tell me how to reload scripts? the thing i just tried wasnt work

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.