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 could I send a Ped or vehicle etc to a tick or keydown event

You can't do that because Tick and KeyDown need a specific signature in order to work. It would probably be best just to use a global variable inside these methods.

Link to comment
Share on other sites

Since this topic is quite active, I seem to be missing something smile.gif

 

I added a procedure to save all spawned objects to a file, and later re-load them in one go.

 

Apparently I completely forgot about an object's rotation smile.gif

 

Any native that will get the current object rotation, so that I can save that as well (apart from model, coordinates and heading) so that I can use setobjectrotation when loading them again ?

 

 

Link to comment
Share on other sites

Since this topic is quite active, I seem to be missing something smile.gif

 

I added a procedure to save all spawned objects to a file, and later re-load them in one go.

 

Apparently I completely forgot about an object's rotation smile.gif

 

Any native that will get the current object rotation, so that I can save that as well (apart from model, coordinates and heading) so that I can use setobjectrotation when loading them again ?

Ped.Direction

Link to comment
Share on other sites

 

Any native that will get the current object rotation, so that I can save that as well (apart from model, coordinates and heading) so that I can use setobjectrotation when loading them again ?

ehm...am I right that you're looking for the set/get object-heading natives?

 

GET_OBJECT_HEADING(Obj, &Heading);

 

 

SET_OBJECT_HEADING(Obj, Heading);

 

(did'n tested it...straight outta sco wink.gif)

 

//Edit-->

Oh...'Rotation' not only 'Heading'. blush.gif

What about...

 

GET_OBJECT_ROTATION_VELOCITY(Obj, &RVX, &RVY, &RVZ);

 

...maybe you can calc the rotation. (I'm not at home, that's why I can't test it.)

 

//Edit�-->

Yet another one (last guess...I swear turn.gif )...

 

GET_OBJECT_QUATERNION(Obj, &qX, &qY, &qZ, &qW);

 

... Quaternion to AxisAngle

... Quaternion to Euler. blush.gif �

 

//Edit(again)-->

@sjaak:

You just want to know the natives to use them with the C++ ScriptHook, right?

Otherwise the stuff above is bullsh**, I think.

 

Greetz!

Edited by oinkoink
Link to comment
Share on other sites

What is a way to stop killing spree without using

BlockPermanentEvents

Have you tried using Ped.Task.ClearAllImmediately?

Link to comment
Share on other sites

What is a way to stop killing spree without using

BlockPermanentEvents

Have you tried using Ped.Task.ClearAllImmediately?

Nope that doesn't work

And how do you use the open doors and stuff for cars? I can't figure it out

Link to comment
Share on other sites

 

And how do you use the open doors and stuff for cars? I can't figure it out

What's there to figure out? Vehicle.Door(VehicleDoor.Hood).Open(); will open the hood, nothing hard about that. mercie_blink.gif

Link to comment
Share on other sites

And how do you use the open doors and stuff for cars? I can't figure it out

What's there to figure out? Vehicle.Door(VehicleDoor.Hood).Open(); will open the hood, nothing hard about that. mercie_blink.gif

Cool thanks, the BlockPermanentEvents is quite annoying

And when I use Task.FightAgainstTarget my group members kill everyone else as well

And how do you make the car speed a bigger number and bring it down to 2 decimal places

Link to comment
Share on other sites

 

And how do you make the car speed a bigger number and bring it down to 2 decimal places

I don't really know what you mean here. Do you want to take a number like 24.342 and reduce it to 24.34 or do you want to take a number like 23 and convert it to 0.23? Please be specific when asking for help because not everyone knows what you're thinking when you post something. wink.gif

 

To reduce a number to 2 decimal places you can just use the ToString("N2") method. For example:

 

        float num = 1224.345678f;       string formatnum = num.ToString("N2", CultureInfo.InvariantCulture);

 

This will set formatnum to a value of "1,224.34". You may need to add a using statement to System.Globalization to use this (or just remove CultureInfo.InvariantCulture). You can also change the 2 in N2 to another number like N4 to format 4 decimal places. Note that this can easily be found by searching google. biggrin.gif

Link to comment
Share on other sites

And how do you make the car speed a bigger number and bring it down to 2 decimal places

I don't really know what you mean here. Do you want to take a number like 24.342 and reduce it to 24.34 or do you want to take a number like 23 and convert it to 0.23? Please be specific when asking for help because not everyone knows what you're thinking when you post something. wink.gif

 

To reduce a number to 2 decimal places you can just use the ToString("N2") method. For example:

 

        float num = 1224.345678f;       string formatnum = num.ToString("N2", CultureInfo.InvariantCulture);

 

This will set formatnum to a value of "1,224.34". You may need to add a using statement to System.Globalization to use this (or just remove CultureInfo.InvariantCulture). You can also change the 2 in N2 to another number like N4 to format 4 decimal places. Note that this can easily be found by searching google. biggrin.gif

Thanks, that was half of what I meant, an example will be better

if I have a number like 25.984305

I would like it to look like this : 259.84

And I've got the Dp working

Link to comment
Share on other sites

And how do you make the car speed a bigger number and bring it down to 2 decimal places

I don't really know what you mean here. Do you want to take a number like 24.342 and reduce it to 24.34 or do you want to take a number like 23 and convert it to 0.23? Please be specific when asking for help because not everyone knows what you're thinking when you post something. wink.gif

 

To reduce a number to 2 decimal places you can just use the ToString("N2") method. For example:

 

        float num = 1224.345678f;       string formatnum = num.ToString("N2", CultureInfo.InvariantCulture);

 

This will set formatnum to a value of "1,224.34". You may need to add a using statement to System.Globalization to use this (or just remove CultureInfo.InvariantCulture). You can also change the 2 in N2 to another number like N4 to format 4 decimal places. Note that this can easily be found by searching google. biggrin.gif

Thanks, that was half of what I meant, an example will be better

if I have a number like 25.984305

I would like it to look like this : 259.84

And I've got the Dp working

Multiply it by 10?

Link to comment
Share on other sites

And how do you make the car speed a bigger number and bring it down to 2 decimal places

I don't really know what you mean here. Do you want to take a number like 24.342 and reduce it to 24.34 or do you want to take a number like 23 and convert it to 0.23? Please be specific when asking for help because not everyone knows what you're thinking when you post something. wink.gif

 

To reduce a number to 2 decimal places you can just use the ToString("N2") method. For example:

 

        float num = 1224.345678f;       string formatnum = num.ToString("N2", CultureInfo.InvariantCulture);

 

This will set formatnum to a value of "1,224.34". You may need to add a using statement to System.Globalization to use this (or just remove CultureInfo.InvariantCulture). You can also change the 2 in N2 to another number like N4 to format 4 decimal places. Note that this can easily be found by searching google. biggrin.gif

Thanks, that was half of what I meant, an example will be better

if I have a number like 25.984305

I would like it to look like this : 259.84

And I've got the Dp working

Multiply it by 10?

I know but how?

Link to comment
Share on other sites

 

And how do you make the car speed a bigger number and bring it down to 2 decimal places

I don't really know what you mean here. Do you want to take a number like 24.342 and reduce it to 24.34 or do you want to take a number like 23 and convert it to 0.23? Please be specific when asking for help because not everyone knows what you're thinking when you post something. wink.gif

 

To reduce a number to 2 decimal places you can just use the ToString("N2") method. For example:

 

        float num = 1224.345678f;       string formatnum = num.ToString("N2", CultureInfo.InvariantCulture);

 

This will set formatnum to a value of "1,224.34". You may need to add a using statement to System.Globalization to use this (or just remove CultureInfo.InvariantCulture). You can also change the 2 in N2 to another number like N4 to format 4 decimal places. Note that this can easily be found by searching google. biggrin.gif

Thanks, that was half of what I meant, an example will be better

if I have a number like 25.984305

I would like it to look like this : 259.84

And I've got the Dp working

 

Double number = 25.984305; //Initial valuenumber *= 10; //Multiply by 10number = Math.Round(number, 2); //Round to 2 decimals

 

Result: 259.84

Link to comment
Share on other sites

Wow, that's some heavy math here! ; )

 

Any advice on how to GET the relationship between two peds and/or groups? Currently I'm getting the model hashes and making decisions based on what model a ped is, but that's really just a very very awkward workaround. It would be much easier and straight forward if we could somehow get the relationship between peds. There's a native IS_RELATIONSHIP_SET but I didn't get it to work, yet.

 

Also, does anyone know what the floating point value and the last 4 parameters in the TASK_PLAY_ANIM native are for? (That's the native: GTA.Native.Function.Call("TASK_PLAY_ANIM", 0, "animationName", "animationSet", float a, bool b, int unknown1, int unknown2, int unknown3, int unknown4); The only thing I really know about this native is that setting "b" will loop the animation.

 

Link to comment
Share on other sites

 

Wow, that's some heavy math here! ; )

 

Any advice on how to GET the relationship between two peds and/or groups? Currently I'm getting the model hashes and making decisions based on what model a ped is, but that's really just a very very awkward workaround. It would be much easier and straight forward if we could somehow get the relationship between peds. There's a native IS_RELATIONSHIP_SET but I didn't get it to work, yet.

 

Also, does anyone know what the floating point value and the last 4 parameters in the TASK_PLAY_ANIM native are for?  (That's the native: GTA.Native.Function.Call("TASK_PLAY_ANIM", 0, "animationName", "animationSet", float a, bool b, int unknown1, int unknown2, int unknown3, int unknown4); The only thing I really know about this native is that setting "b"  will loop the animation.

i searched the C++ scripthook Scripting.h and ScriptingDirty.h files and neither of them contains the native IS_RELATIONSHIP_SET so either aru left it out or it doesn't do anything. Either way, I can't test it without knowing how many parameters it takes. confused.gif

 

The float value for TASK_PLAY_ANIM is probably the speed that the anim is played. I'm not sure what the rest of the values do but here's some examples, just try changing values to see if they modify anything noticable otherwise I'd just use 0:

 

 

TASK_PLAY_ANIM(0, "sprint", "missfrancis3", 10000.0f, 0, 1, 1, 0, -1);TASK_PLAY_ANIM(0, "plead", "missfrancis3", 1.0f, 1, 0, 0, 0, -2);TASK_PLAY_ANIM(0, var1, var2, 2.0f, 1, 0, 0, 0, 0);TASK_PLAY_ANIM(L[752][0], "street_chat_a", "missfrancis3", 8.0f, 1, 0, 0, 0, -2);TASK_PLAY_ANIM(0, "street_chat_a", "missfrancis3", 8.0f, 1, 0, 0, 0, -2);

 

Link to comment
Share on other sites

hmm...the flags of TASK_PLAY_ANIM reminds me a lil bit of the perform_anim opcodes of SA.

From the SannyBuilder Opcode Search Tool...

 

0812: AS_actor -1 perform_animation "LRGIRL_IDLELOOP" IFP_file "LOWRIDER" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB

 

...maybe the flags are the same?

 

The only thing I can say about IS_RELATIONSHIP_SET is...none of the org. scripts (sco's) contain this native and param guessing could be a endless story. confused.gif

 

Greetz!

Link to comment
Share on other sites

Is there a way other than native call to turn on the vehicle lights

I found this ForceVehicleLights(Vehicle vehicle, eVehicleLights lights)

But what is eVehicleLights lights, I don't know what to set it to

eVehicleLights is something like this

VEHICLE_LIGHTS_0,

VEHICLE_LIGHTS_1,

VEHICLE_LIGHTS_2,

Link to comment
Share on other sites

 

Is there a way other than native call to turn on the vehicle lights

I found this ForceVehicleLights(Vehicle vehicle, eVehicleLights lights)

But what is eVehicleLights lights, I don't know what to set it to

eVehicleLights is something like this

VEHICLE_LIGHTS_0,

VEHICLE_LIGHTS_1,

VEHICLE_LIGHTS_2,

eVehicleLights is an enum; basically just a set of numbers arranged as words, nothing special really. VEHICLE_LIGHTS_0 would equal 0 and so on, so you can just use normal numbers to test the native. Using Native.Function.Call("FORCE_CAR_LIGHTS", vehicle, 0); will turn the vehicle's lights on (headlights and breaklights) while using 1 will turn them off. confused.gif Another great example of professional coding by R*, shouldn't it be 1 for on and 0 for off? lol.giftounge.gif

Link to comment
Share on other sites

Is there a way other than native call to turn on the vehicle lights

I found this ForceVehicleLights(Vehicle vehicle, eVehicleLights lights)

But what is eVehicleLights lights, I don't know what to set it to

eVehicleLights is something like this

VEHICLE_LIGHTS_0,

VEHICLE_LIGHTS_1,

VEHICLE_LIGHTS_2,

eVehicleLights is an enum; basically just a set of numbers arranged as words, nothing special really. VEHICLE_LIGHTS_0 would equal 0 and so on, so you can just use normal numbers to test the native. Using Native.Function.Call("FORCE_CAR_LIGHTS", vehicle, 0); will turn the vehicle's lights on (headlights and breaklights) while using 1 will turn them off. confused.gif Another great example of professional coding by R*, shouldn't it be 1 for on and 0 for off? lol.giftounge.gif

Not if the parameters are: Vehicle, bForceOff

 

xD tounge.gif

Link to comment
Share on other sites

 

Is there a way other than native call to turn on the vehicle lights

I found this ForceVehicleLights(Vehicle vehicle, eVehicleLights lights)

But what is eVehicleLights lights, I don't know what to set it to

eVehicleLights is something like this

VEHICLE_LIGHTS_0,

VEHICLE_LIGHTS_1,

VEHICLE_LIGHTS_2,

eVehicleLights is an enum; basically just a set of numbers arranged as words, nothing special really. VEHICLE_LIGHTS_0 would equal 0 and so on, so you can just use normal numbers to test the native. Using Native.Function.Call("FORCE_CAR_LIGHTS", vehicle, 0); will turn the vehicle's lights on (headlights and breaklights) while using 1 will turn them off. confused.gif Another great example of professional coding by R*, shouldn't it be 1 for on and 0 for off? lol.giftounge.gif

Ok thanks 3 is actually on

How can I save cars for later use

How do I use decimals for this

float numb = 2 / 4;

Edited by lilmcnessy
Link to comment
Share on other sites

 

How do I stop cars spawning in alleys?

If you mean cars spawned by your own script, CoMPMStR is right.

You could also use this one...

 

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

 

...to get also the heading. (if I used this native my car was always spawned on a street...never in a alley...so far)

 

If you mean cars spawned by car-generators, you could use this one...

 

GTA.Native.Function.Call("REMOVE_CARS_FROM_GENERATORS_IN_AREA", minX, minY, minZ, maxX, maxY, maxZ);

 

...didn't tested it, but it should work...used in 'gerry4.sco'.

 

Greetz!

Link to comment
Share on other sites

 

How do I stop cars spawning in alleys?

World.GetNextPositionOnStreet()?

But the alley is part of the street, that is what i'm using

 

Just Checking if this is all right

Code

 

public BulletTime()   {       string Lilmcnessy = Settings.Filename;       //Settings.Filename = Lilmcnessy;       Keys Bull = Settings.GetValueKey("KEYS", "BULLETTIME", Keys.P);       BindKey(Bull, new KeyPressDelegate(Time));       this.Tick += new EventHandler(this.Time_Tick);   }

 

 

And ini, which is named lilmcnessy.ini

 

[bULLETTIME]KEYS = T

 

Edited by lilmcnessy
Link to comment
Share on other sites

I noticed that the character controls for single player are different than the controls in multiplayer. In single player you have to press a button and tap it to run and in multiplayer you instantly run by just pressing far enough on the analog stick. Also in single player you can throw objects that you pick up on the street but you cannot do the same in multiplayer. Does anyone know how to switch between these control styles i.e. make multiplayer controls the same as single player and vice versa?

Link to comment
Share on other sites

Hazard, I can't thank you enough for coming back to this mod. My machinima projects were put on hold while you were gone because I couldn't use my mods after I updated! I just finished the first episode of "The Bad Assassin," an action-comedy machinima movie that I'm most likely turning into a series (or at least mini-series) I gave you props in the credits for your mod (the video was exactly 10 minutes, so the credits don't roll at the end, they're in the description)

 

Here's the link, if you want to watch it:

 

Again, thank you for your mod!

Link to comment
Share on other sites

Hazard, I can't thank you enough for coming back to this mod. My machinima projects were put on hold while you were gone because I couldn't use my mods after I updated! I just finished the first episode of "The Bad Assassin," an action-comedy machinima movie that I'm most likely turning into a series (or at least mini-series) I gave you props in the credits for your mod (the video was exactly 10 minutes, so the credits don't roll at the end, they're in the description)

 

Here's the link, if you want to watch it:

 

Again, thank you for your mod!

Dude, that was A W E S O M E! Keep up the good work wow.gif

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.