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

with this .net scripthook installed the game stop responding after alt_tab!

 

gtaiv 1.04 (windows7 rtm x64)

What does the logs say?

Link to comment
Share on other sites

It's the same for me on windows7 x64. BUT I can do ALT+TAB if I press ESC (menu screen) and then alt+tab. Try that, maybe it works for you as well.

Link to comment
Share on other sites

AAAAHH Ok i asked this before, but still no real answer...

 

When i spawn a object, why does it stick in the air until i hit it (bullit, walk against it etc.)??? So useless!

 

Is there a fix? Dont say Apply a little force because it doesnt work... The object doesnt get 'gravity and physics' until to walk against it...

Link to comment
Share on other sites

AAAAHH Ok i asked this before, but still no real answer...

 

When i spawn a object, why does it stick in the air until i hit it (bullit, walk against it etc.)??? So useless!

 

Is there a fix? Dont say Apply a little force because it doesnt work... The object doesnt get 'gravity and physics' until to walk against it...

It's stuck because the physics are "asleep". You'll have to find a method to wake it up.

Link to comment
Share on other sites

 

AAAAHH Ok i asked this before, but still no real answer...

 

When i spawn a object, why does it stick in the air until i hit it (bullit, walk against it etc.)??? So useless!

 

Is there a fix? Dont say Apply a little force because it doesnt work... The object doesnt get 'gravity and physics' until to walk against it...

MulleDK19 is right, once an object becomes idle it returns to a broadphase state until something comes in contact with it. You can always use World.GetGroundPosition so the object spawns on the ground instead of in the air. tounge.gif

 

Another option could be to mess with the actual native and see if modifying one of the values allows the force to 'wake up' an object that is idle.

 

APPLY_FORCE_TO_OBJECT(obj, uint_3, float_x, float_y, float_z, float_rotx, float_roty, float_rotz, uint_0, uint_1, uint_1, uint_1)

 

 

The first uint_1 after the rotz and uint_0 determines whether the force is calculated in world coords or model coords (relative or not), 0 is for ApplyForce and 1 is for ApplyForceRelative. You can try changing other values to see if they make a difference on those objects you're having problems with. wink.gif

Link to comment
Share on other sites

@Intosia:

You can also use...

 

Wait(0); // importantGTA.Native.Function.Call("SET_OBJECT_DYNAMIC", obj, 1); 

 

...after creating your object. But if you place it on the ground like CoMPMStR sad it's not really necessary.

 

What we need is the option to stop the original game scripts. Then we can make mission/scripts that dont interfere with that game.

A lil bit late, but It's possible...

 

GTA.Native.Function.Call("TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME", "ambTV");

 

...with this example the TV's doesn't work anymore. cryani.gif ( tounge.gif )

 

@HazardX:

The Color.Alpha for DrawSprite seems not to work, so I use something like this at the moment...

 

ImageAttributes imgAttr = new ImageAttributes();ColorMatrix colMatrix = new ColorMatrix( new float[][]{  new float[] {1.0f,  0.0f,  0.0f,  0.0f, 0.0f},        new float[] {0.0f,  1.0f,  0.0f,  0.0f, 0.0f},         new float[] {0.0f,  0.0f,  1.0f,  0.0f, 0.0f},         new float[] {0.0f,  0.0f,  0.0f,  alpha, 0.0f},         new float[] {0.0f,  0.0f,  0.0f,  0.0f, 1.0f}});imgAttr.SetColorMatrix(colMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);

 

...or did I miss something?

 

Oh...btw two nice natives which I can't find (or am I just blind?)...

 

GTA.Native.Function.Call<bool>("IS_PLAYER_BEING_ARRESTED")

 

 

Vector3 pp = Player.Character.Position;GTA.Native.Pointer vx = typeof(float);GTA.Native.Pointer vy = typeof(float);GTA.Native.Pointer vz = typeof(float);GTA.Native.Pointer vh = typeof(float);GTA.Native.Function.Call("GET_CLOSEST_CAR_NODE_WITH_HEADING", (float)pp.X, (float)pp.Y, (float)pp.Z, vx, vy, vz, vh);

 

...maybe you like to include them in your next release.

 

Oh...btw part2...

...Yes, you got me...the 'CurrentRPM' thing was a lil bit like a 'Wink mit dem Zaunpfahl'. wink.gif

So...thanx a lot, Dude.

 

Peace! smile.gif

 

Link to comment
Share on other sites

Can I only add peds i have spawned to my group?

When ever I try to get a ped and add to group they are just stuck on the spot

 

And what's a way so certain Peds relationships aren't gotten for Player.GetTargetedPed();

 

Link to comment
Share on other sites

Thanks oinkoink ill try that, because i dont want to spawn on the ground. Yeah native for the script stopping, but you need to know all the scripts running... Isnt there a command to stop all MissionScripts? (I dont need it, but would be really usefull). So the TV and other things still work, but that the phone calls are disabled.

Link to comment
Share on other sites

Thanks oinkoink ill try that, because i dont want to spawn on the ground. Yeah native for the script stopping, but you need to know all the scripts running... Isnt there a command to stop all MissionScripts? (I dont need it, but would be really usefull). So the TV and other things still work, but that the phone calls are disabled.

Just stop the phone script, spcellphone.

 

 

Link to comment
Share on other sites

Thanks oinkoink ill try that, because i dont want to spawn on the ground. Yeah native for the script stopping, but you need to know all the scripts running... Isnt there a command to stop all MissionScripts? (I dont need it, but would be really usefull). So the TV and other things still work, but that the phone calls are disabled.

Just stop the phone script, spcellphone.

Ow sweet, never thought of that... Aahhhhhh silence sleepy.gif

Link to comment
Share on other sites

Can I only add peds i have spawned to my group?

When ever I try to get a ped and add to group they are just stuck on the spot

 

And what's a way so certain Peds relationships aren't gotten for Player.GetTargetedPed();

No you can add any ped on the street to your group. If they are stuck then you probably didn't set them to follow you after clearing their tasks?

I'd use a procedure like this to add a ped to my group:

 

 

      playerped = Player.Character;      Ped temp;      Group pGroup = Player.Group;

 

 

Get the closest ped:

 

       public Ped getClosestPedClearTasks(float range)       {           temp = World.GetClosestPed(playerPed.Position, range);           if (!Exists(temp)) { Game.DisplayText("No pet close enough"); return null; }           temp.LeaveGroup();           temp.BecomeMissionCharacter();           return temp;       }

 

 

clear peds tasks.

 

       // clear peds tasks       public void setClearTasks(Ped ped)       {           if (!Exists(ped)) { Game.DisplayText("Selected ped does not exist"); return; }           ped.Task.ClearAll();           ped.BlockPermanentEvents = true;           ped.BlockGestures = true;           ped.BlockWeaponSwitching = true;       }

 

 

Add ped to Group

 

private void AddToGroup(Group g, Ped p)       {           if (!Exists(p)) return;           if (g.isMember(p)) return;           p.CurrentRoom = playerPed.CurrentRoom;           p.WillDoDrivebys = true;           p.PriorityTargetForEnemies = true;           p.CanSwitchWeapons = true;           p.DuckWhenAimedAtByGroupMember = true;           p.SetPathfinding(true, true, true);           p.WillUseCarsInCombat = true;           p.MaxHealth = 100;           p.Armor = 100;           p.WillFlyThroughWindscreen = true;           p.RelationshipGroup = RelationshipGroup.Player;           p.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);           g.AddMember(p);           Game.DisplayText("Added to group");       }

 

 

Now you can either define your own follow Script to make the ped follow you (for example using a tick method and GTA.Native.Function.Call("TASK_GO_STRAIGHT_TO_COORD", followPed, pos.X, pos.Y, pos.Z, 3, 1); ) or you can use the built in Group Property:

 

           pGroup.FollowStatus = 1;

 

Link to comment
Share on other sites

 

And what's a way so certain Peds relationships aren't gotten for Player.GetTargetedPed();

 

        Player p = Player;       Ped t = p.GetTargetedPed();       if (Exists(t))           if (t.RelationshipGroup == RelationshipGroup.Cop)               p.WantedLevel = 0;

 

 

Maybe this will help with your target ped issue.. wink.gifconfused.gif

 

 

Also, I created a little app that helps me create forms visually and generates some code to use with the scripthook (it's just a rewrite of a program I made last year for MHS). It works good enough for me so I'll put it up here for you all to use as well. If for some reason hazard can't implement visual form creation with VS then I may create a new post for it, but for now since it's to be used with the scripthook... here it is: http://www.mediafire.com/download.php?ciooznhyuyt (don't forget about the readme wink.gif)

 

EDIT: I added event generation to the app so no need to add them all manually anymore (for control events such as Click, KeyDown, and Paint). wink.gif So now all you need to do is add the code to each event after you generate the code, just tick and click. http://www.mediafire.com/download.php?jnnjj5wnmzz

Edited by CoMPMStR
Link to comment
Share on other sites

Also, I created a little app that helps me create forms visually and generates some code to use with the scripthook (it's just a rewrite of a program I made last year for MHS). It works good enough for me so I'll put it up here for you all to use as well. If for some reason hazard can't implement visual form creation with VS then I may create a new post for it, but for now since it's to be used with the scripthook... here it is: http://www.mediafire.com/download.php?ciooznhyuyt (don't forget about the readme ;))

Very nice work. I started the very same thing - you totally overtook me with that app, though :D

Link to comment
Share on other sites

Is there any way to allow a camera object as a native parameter in the current release? I'm trying to use the native "ATTACH_CAM_TO_PED", cam, ped (or maybe it's ped, cam... I can't test it tounge.gif) and it doesn't allow the cam to be passed as a native parameter directly as with the other types. I tried to declare a new Native.Parameter variable with the cam object as a parameter and that allows me to build the dll but it still throws an error upon conversion of GTA.Camera to Native.Parameter, invalid cast exception.

Link to comment
Share on other sites

Is there any way to allow a camera object as a native parameter in the current release? I'm trying to use the native "ATTACH_CAM_TO_PED", cam, ped (or maybe it's ped, cam... I can't test it tounge.gif) and it doesn't allow the cam to be passed as a native parameter directly as with the other types. I tried to declare a new Native.Parameter variable with the cam object as a parameter and that allows me to build the dll but it still throws an error upon conversion of GTA.Camera to Native.Parameter, invalid cast exception.

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Link to comment
Share on other sites

I cant find scripthookdotnet.dll anywhere ! Yes I searched through the rar

No you did not.

 

RAR\scripts\for Developers\bin\ScriptHookDotNet.dll

Link to comment
Share on other sites

I cant find scripthookdotnet.dll anywhere ! Yes I searched through the rar

No you did not.

 

RAR\scripts\for Developers\bin\ScriptHookDotNet.dll

blush.gif strange I read a readme that said that all the basic stuff are not in the developer's folder tounge2.gif ...thanks a lot icon14.gif

Link to comment
Share on other sites

 

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

Link to comment
Share on other sites

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

lol. Funny... I made a class that transforms Windows Forms to the GTA.Forms.Form's on the fly, xD.

Link to comment
Share on other sites

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

Where is it? smile.gif

Link to comment
Share on other sites

 

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

Where is it? smile.gif

On the previous page I believe. wink.gifhttp://www.mediafire.com/download.php?jnnjj5wnmzz

Link to comment
Share on other sites

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

Where is it? smile.gif

On the previous page I believe. wink.gifhttp://www.mediafire.com/download.php?jnnjj5wnmzz

Hey thats pretty neat smile.gif But i know HazardX is gonna surprise us with a GUI Builder i know it sigh.gif

Link to comment
Share on other sites

 

Yes, the Camera class in not yet supported as a native parameter. But cam.GetHashCode returns the internal pointer for the cam, thus using it as the parameter should work.

Excellent tip! This works great. biggrin.gif

 

Also, did you see the little app I made for visual form creation? Are you still going to implement visual design in VS with the scripthook forms, or is it implemented already? Just wondering so I can either continue on it and add more features or go back to my other projects. wink.gif

Where is it? smile.gif

On the previous page I believe. wink.gifhttp://www.mediafire.com/download.php?jnnjj5wnmzz

I like my method better tounge.gif

 

I made a class that converts a Windows Application Form on the fly. So I just use the designer tounge.gif

 

user posted image

user posted image

Link to comment
Share on other sites

 

I like my method better tounge.gif

 

I made a class that converts a Windows Application Form on the fly. So I just use the designer tounge.gif

Yea I'm sure if you can do that then hazard will be able to as well, so no need for me to update my little app anymore. cryani.gif

 

 

On a side note, I was wondering if anyone found a way to get the aim camera into an object so I can get it's rotation (you know, the camera when you aim a weapon). Using Game.DefaultCamera doesn't get the aim camera, and Game.CurrentCamera won't work because I have another camera activated. I just need a way to get the camera rotation when you're aiming a weapon even with another camera activated (so I can update the activated cam accordingly), and I couldn't find a native to do so. All I found were GetCinematicCam, GetDebugCam, GetRootCam, GetScriptCam, and GetGameCam but none of these worked for me.. anyway to do this or does the scripthook not support camera pointers either?

Link to comment
Share on other sites

 

 

On a side note, I was wondering if anyone found a way to get the aim camera into an object so I can get it's rotation (you know, the camera when you aim a weapon). Using Game.DefaultCamera doesn't get the aim camera, and Game.CurrentCamera won't work because I have another camera activated. I just need a way to get the camera rotation when you're aiming a weapon even with another camera activated (so I can update the activated cam accordingly), and I couldn't find a native to do so. All I found were GetCinematicCam, GetDebugCam, GetRootCam, GetScriptCam, and GetGameCam but none of these worked for me.. anyway to do this or does the scripthook not support camera pointers either?

camera move should be the same like mouse move, Native:GET_MOUSE_INPUT

or do you wonna get the target?

Link to comment
Share on other sites

 

camera move should be the same like mouse move, Native:GET_MOUSE_INPUT

or do you wonna get the target?

No I want to set a new camera object's rotation according to the rotation of the camera used when you aim a gun. Game.DefaultCamera works when you don't aim a weapon, but that's all. confused.gif

 

There is only SET_GAME_CAM_HEADING and SET_GAME_CAM_PITCH which work for the camera while aiming a weapon. There is the native GET_GAME_CAM but either it doesn't work or there is a bug with the scripthook because I tried using it but the camera never exists. confused.gif

 

 

    Function GetGameCam() As Camera       Dim camptr As New Native.Pointer(GetType(Camera))       Native.Function.Call("GET_GAME_CAM", camptr)       Return camptr.Value   End Function

 

 

Also, here're a few cleaned up natives I found that work:

 

Ped       Native.Function.Call("SET_CHAR_DIES_INSTANTLY_IN_WATER", ped, bool_dies)       Native.Function.Call("SET_ROTATION_FOR_ATTACHED_PED", ped, rotX, rotY, rotZ)       Native.Function.Call("TASK_CLIMB", ped, int_0)       Native.Function.Call("TASK_DUCK", ped, int_0)       Native.Function.Call("TASK_JUMP", ped, int_0)       Native.Function.Call("SET_CHAR_COLLISION", ped, bool_coll)       Native.Function.Call("TASK_TOGGLE_DUCK", ped, bool_duck)Vehicle       Native.Function.Call("SET_VEH_ALARM", veh, bool_set)       Native.Function.Call("SET_HELI_BLADES_FULL_SPEED", veh)       Native.Function.Call("SET_CAN_BURST_CAR_TYRES", veh, bool_burst)       Native.Function.Call("SET_LOUD_VEHICLE_RADIO", veh, bool_loud)       Native.Function.Call("SET_TAXI_LIGHTS", veh, bool_on)       Native.Function.Call("SMASH_CAR_WINDOW", veh, window)Game/World       Native.Function.Call("SET_NO_RESPRAYS", bool)       Native.Function.Call("SET_CREATE_RANDOM_COPS", bool_create)       Native.Function.Call("SET_MONEY_CARRIED_BY_ALL_NEW_PEDS", int_money)Player       Native.Function.Call("CREATE_MOBILE_PHONE", int_0)       Native.Function.Call("DESTROY_MOBILE_PHONE")Camera       Native.Function.Call("SET_CAM_ATTACH_OFFSET", cam, float_X, float_Y, float_Z)       Native.Function.Call("SET_CAM_ATTACH_OFFSET_IS_RELATIVE", cam, bool_relative)       Native.Function.Call("ATTACH_CAM_TO_PED", cam, ped)

 

 

And I also found that the GTA.VehicleWindow enum Front and Rear values are incorrect. The correct values are Front = 426 and Rear = 427. wink.gif There are quite a few more values for others such as the windows on limos and vans, the limo sunroof, and also the small rear windows on some vehicles.

 

EDIT: For TASK_JUMP the int parameter specifies how the ped will jump, whether they will stand and jump in place (0) or move forward while jumping (1) and TASK_CLIMB might act similar. There's also "TASK_COMBAT_ROLL", ped, int where the int values are 0=roll left, 1=roll right, 2=roll forward, and 3=roll backward.

Edited by CoMPMStR
Link to comment
Share on other sites

Is there a way to get the Relationship between two peds and/or groups?

There's a native IS_RELATIONSHIP_SET. I havent tried it though and I'm not quite sure about it's parameters as well. Any Ideas?

Link to comment
Share on other sites

How could I send a Ped or vehicle etc to a tick or keydown event

eg

 

Example_Tick(ped);}private void Example_Tick(object sender, GTA.KeyEventArgs e, Ped ped) {blach.BlahBlah}

 

I think I have found out

Edited by lilmcnessy
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.