Quantcast

Jump to content

» «
Photo

Scripting for GTA IV?

23 replies to this topic
venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#1

Posted 10 May 2011 - 07:16 PM

Hello, Im new both to this forum and scripting for GTA IV, I got interested in scripting when i saw the bodyguard mods, zombie mods, etc

I would love a zombie mod for gta 4 , unfortunately i dont see the existing ones very fun. I have contagium 1.2b but its not very fun for me.

first i would just ask: Where do i learn scripting for gta iv? i got C# but find almost no tutorial for scripting in gta 4, secondly, Is there anybody that has zombie textures available for pedestrians?
also, How do i know what commands i can use for gta 4, where do i found these? I cant open scripthook.dll so what programs or tools do i need?


i got some basics because i was very good in lua language for another game, so i aint that bad smile.gif

now ill have a look at the forum see what i can learn biggrin.gif

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#2

Posted 10 May 2011 - 07:52 PM Edited by L0uNGeR, 10 May 2011 - 08:22 PM.


Hello venom330, welcome to the forums! colgate.gif


QUOTE (venom330 @ May 10 2011, 21:16)
first i would just ask: Where do i learn scripting for gta iv?  i got C# but find almost no tutorial for scripting in gta 4......

If you have the .Net ScriptHook package, have a look at this file:
scripthookdotnet_1.7.1.7beta.zip\scripts\for Developers\TestScriptCS\Scripts\TestScripts.cs
See bottom of this post for examples.


QUOTE (venom330 @ May 10 2011, 21:16)
also, How do i know what commands i can use for gta 4, where do i found these? I cant open scripthook.dll so what programs or tools do i need?

You can download the documentation for .Net ScriptHook here
If you want a specific function that isn't implemented in .Net ScriptHook, you can start looking for a GTA Native that might help you.
You can find the complete Natives listing here .
Also have a look at Scripting.h from the C++ ScriptHook source code (fixed)


QUOTE (venom330 @ May 10 2011, 21:16)
i got some basics because i was very good in lua language for another game, so i aint that bad smile.gif

We actually work(ed) with LUA in GTA IV through the "A.l.i.c.e." plugin...It's just that C#/VB makes everything that much easier, so that's what I use and recommend.



Examples

First example in .Net ScriptHook's TestScripts.cs, made into a ready-to-run script:
CODE
using System;
using System.Windows.Forms;
using GTA;

namespace TestScriptCS
{
   // ### get 10000 bucks each time you press M ###
   public class BasicKeyExample : Script
   {
       public BasicKeyExample()
       {
           // Bind method BasicKeyExample_KeyDown to the KeyDown event
           this.KeyDown += new GTA.KeyEventHandler(this.BasicKeyExample_KeyDown);
       }

       // KeyDown returns the pressed key.
       // but there is no need to check it when your script watches only this one key
       private void BasicKeyExample_KeyDown(object sender, GTA.KeyEventArgs e)
       {
           if (e.Key == Keys.M)
               Player.Money += 10000;
       }
   }
}


Another simple script:

CODE
using System;
using System.Windows.Forms;
using GTA;

namespace TestScriptCS
{
   public class BasicExample : Script
   {
       public BasicExample()
       {
           this.KeyDown += new GTA.KeyEventHandler(this.BasicExample_KeyDown);
       }

       private void BasicExample_KeyDown(object sender, GTA.KeyEventArgs e)
       {
           if (e.Key == Keys.M)
               DoSomeStuff();
       }

       private void DoSomeStuff()
       {
           Ped pl = Player.Character;
           if (pl.isAlive)
           {
               Game.DisplayText("Hello World!");
               Wait(600);
               pl.SayAmbientSpeech("Thanks");
           }
       }
   }
}




venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#3

Posted 10 May 2011 - 08:13 PM

Thank you , this should be helpfull biggrin.gif

gonna have some more look at those example scripts, So for example if you wanna make a simple zombie mod, You replace pedestrian models so it looks realistic and change their behavior to the player to hate and thats it?

btw how do you change animations to the pedestrian? like instead of walking they would go drunk or something?

QUOTE

Also have a look at Scripting.h from the C++ ScriptHook source code


I couldnt connect to the site sad.gif



L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#4

Posted 10 May 2011 - 08:30 PM

QUOTE (venom330 @ May 10 2011, 22:13)
So for example if you wanna make a simple zombie mod, You replace pedestrian models so it looks realistic and change their behavior to the player to hate and thats it?

It's easier said than done, but it is possible yes, there's even a zombie example in TestScripts.cs

QUOTE (venom330 @ May 10 2011, 22:13)
btw how do you change animations to the pedestrian? like instead of walking they would go drunk or something?

You can make them use predefined animations, there's also an example for this in TestScripts.cs (spliff smoking), or you could tweak physics for a ped by learning more about the Euphoria functions.
I don't have any experience with this so I have no idea what the possibilities are.

QUOTE (venom330 @ May 10 2011, 22:13)
I couldnt connect to the site  sad.gif

I've put up a mirror.

venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#5

Posted 10 May 2011 - 08:40 PM Edited by venom330, 10 May 2011 - 08:55 PM.

Alright thanks tounge.gif

How do i replace animations? example swat to make them walk drunk

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#6

Posted 10 May 2011 - 09:11 PM Edited by L0uNGeR, 10 May 2011 - 10:21 PM.

QUOTE (venom330 @ May 10 2011, 22:40)
now where do i find these animations? In pedprops i only find textures and models

Here you can find all the animations
http://www.gtamoddin...imations_(GTA4)
The game works with Animation Sets, so you request a set, then play an animation from that set, like so:
CODE
AnimationSet anims = new AnimationSet("amb@smoking_spliff");
AnimationFlags animflags = AnimationFlags.Unknown12 | AnimationFlags.Unknown11 | AnimationFlags.Unknown09;
Player.Character.Animation.Play(anims, "create_spliff", 8.0F, animflags);
Player.Character.Animation.WaitUntilFinished(anims, "create_spliff");

// Animation as a task:
Player.Character.Task.PlayAnimation(anims, "partial_smoke", 8.0F, animflags);



QUOTE (venom330 @ May 10 2011, 22:40)
and how do i edit behavior to make example a normal citizen to a gang member attitude with no fear?

I haven't tested this, since I never tried to alter a ped's relation to another group, but this might just work.
Question to others: Is this the best way to enumerate an enum? Thnx
CODE
// Get a close ped
Ped p = World.GetClosestPed(Player.Character.Position, 15f);

// Ped belongs to Gang_Biker1 group
p.RelationshipGroup = RelationshipGroup.Gang_Biker1;

// Ped's relation to Gang_Biker1 is Companion
p.ChangeRelationship(RelationshipGroup.Gang_Biker1, Relationship.Companion);

// Make the ped HATE everybody except his companions
foreach (RelationshipGroup group in Enum.GetValues(typeof(RelationshipGroup)))
{
   if (group == RelationshipGroup.Gang_Biker1)
       continue;

   p.ChangeRelationship(group, Relationship.Hate);
}

After test: This works! It's quite funny actually biggrin.gif
There isn't anything in this code to make the ped fearless, but they do start to attack everybody because of the hate relation.
You could just leave out the RelationshipGroup.Gang_Biker1 all together and make them hate everybody, even their own group.
QUOTE
// Make the ped HATE everybody
foreach ( RelationshipGroup group in Enum .GetValues( typeof ( RelationshipGroup ))) {
p.ChangeRelationship(group, Relationship .Hate);
}

(yay for syntax highlighting!)


QUOTE (venom330 @ May 10 2011, 22:40)
How do i replace animations? example swat to make them walk drunk

There's a Native SET_PED_IS_DRUNK, I don't know if it will do anything.
After test: Doesn't work...
This doesn't replace their animations like you are saying, if that's what you want, you just give them a new animation to perform, as explained above.


venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#7

Posted 10 May 2011 - 11:26 PM Edited by venom330, 10 May 2011 - 11:55 PM.

for walking drunk i guess you need some kinda event, like you said above. But i dont need to replace the animations for the pedestrian i think, like the zombie mod i have contagium script it doesnt replace anything, its just an .asi file which i guess makes an event that all pedestrians who get hit by another group pedestrians do the same animation, in that case, some kinda injure animation.

can you make a quick simple sample of an animation change on event on a pedestrian if you know how to do ?
or is it possible to find in any testscripts? xD



I mean hm, if you get what i mean, A script triggers on start that a specific Pedestrian (group?) has a specific animation and a hate relation to all others, when he or she attacks another group then they get in the same group as the attacker, thats what the script is about, I find it simple, but as a noob at c# i dont have a clue how to put it as a sample, could you do it please? biggrin.gif

Then all problems solved, from there i can learn alot and experiment smile.gif

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#8

Posted 11 May 2011 - 01:02 AM

I'm actually making a zombie mod from scratch now...
Just because it's the most obvious and probably the funniest things you could do in this game.
I haven't looked at any other zombie mods or anything like that except for the example in .Net ScriptHook.

This may become an awesome mod, but atm I can't tell how it'll work out, it could be just zombie or more like "special infected" style (L4D).

venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#9

Posted 11 May 2011 - 08:31 AM Edited by venom330, 11 May 2011 - 10:05 AM.

nice biggrin.gif

hey i tested the testscript with the zombie and it looks awesome, it was exactly what i wanted, the same drunk animation biggrin.gif

So im trying to do it exact as the testscript but i dont want to have to press any buttons to activate it, i also want them to keep attacking me, this is my code so far, very simple, just like copy paste, got an error though

CODE


using System;
using System.Drawing;
using System.Windows.Forms;
using GTA;

namespace test {

   
   
   public class TaskSequenceExample : Script {

       TaskSequence FleeTask;


     public TaskSequenceExample() {
        // Add tasks to the TaskSequence
        FleeTask = new TaskSequence();
        FleeTask.AddTask.FightAgainstHatedTargets();


        // Get a close ped
        Ped p = World.GetClosestPed(Player.Character.Position, 15f);
        p.CurrentRoom = Player.Character.CurrentRoom;
        p.Task.PerformSequence(FleeTask);

        foreach (RelationshipGroup group in Enum.GetValues(typeof(RelationshipGroup)))
        {
            p.ChangeRelationship(group, Relationship.Hate);
        }

        p.CurrentRoom = Player.Character.CurrentRoom;

     }

  }


  // ### Press Z and the ped you are aiming at will start walking towards you like a zombie  ###
  public class EuphoriaExample : Script {

     Ped Zombie;

     

     public EuphoriaExample() {
        Interval = 250;

        this.Tick += new EventHandler(this.EuphoriaExample_Tick);
     }

     private void DoTheZombie() {
        if (Exists(Zombie)) {
           Zombie.isRagdoll = false;
           Zombie = null;
           return;
        }


        Game.DisplayText("ZOMBIES!!!");
        Zombie.Euphoria.BodyBalance.Start(-1);
     }

     private void EuphoriaExample_Tick(object sender, EventArgs e) {
        if (!Exists(Zombie)) return;

        if (Zombie.isGettingUp) return; // wait until the zombie is standing
        if (!Zombie.isRagdoll) Zombie.Euphoria.BodyBalance.Start(-1);
        if (!Zombie.Euphoria.BodyBalance.isBalanced) { // get up again when fallen to the ground
           Zombie.isRagdoll = false;
           return;
        }

        Zombie.Euphoria.LeanToPosition.Amount = 1.0F;
        Zombie.Euphoria.LeanToPosition.ApplyAsForce = true;
        Zombie.Euphoria.LeanToPosition.Position = Player.Character.Position;
        Zombie.Euphoria.LeanToPosition.Start();
     }

   }

}



L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#10

Posted 11 May 2011 - 05:30 PM

In the TaskSequenceExample class, TaskSequenceExample() is only fired once, you probably don't want this. Also, you didn't check if the closest ped actually exists (after GetClosestPed).
Also, you specify "p.CurrentRoom" twice.
CODE
if (!p.Exists()) return;

And another: FightAgainstHatedTargets() should have at least one argument.


In the EuphoriaExample class, the Ped Zombie is never actually assigned or created, so it can't be used. You can also see that DoTheZombie() is never used from anywhere.

venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#11

Posted 11 May 2011 - 11:11 PM

Yea i just found FightAgainstHatedTargets() at the scripthook documentation so i was gonna try it out, dont know what kinda argument i should have lol.

and i cant use Dothezombie? aww.. so ill have to set an animation for the random ped then, But i only find tutorial activating them by pressing a key, isnt there a command that when the ped is spawned and it sees the player or other peds, then it does the drunk animation and attacks?

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#12

Posted 12 May 2011 - 03:45 AM Edited by L0uNGeR, 12 May 2011 - 03:52 AM.

QUOTE (venom330 @ May 12 2011, 01:11)
Yea i just found FightAgainstHatedTargets() at the scripthook  documentation so i was gonna try it out, dont know what kinda argument i should have lol.

FightAgainstHatedTargets( float radius [, int duration] )

QUOTE (venom330 @ May 12 2011, 01:11)
and i cant use Dothezombie?

You can use Dothezombie(), I just told you that you never use it.

QUOTE (venom330 @ May 12 2011, 01:11)
But i only find tutorial activating them by pressing a key, isnt there a command that when the ped is spawned and it sees the player or other peds, then it does the drunk animation and attacks?

You'd have to use Tick
CODE
public class MyTest : Script
{
   public MyTest()
   {
       Interval = 1000;
       this.Tick += new EventHandler(MyTest_Tick);
   }

   internal void MyTest_Tick(object sender, EventArgs e)
   {
       foreach (Ped p in World.GetAllPeds())
       {
           if (p != null && p != Player.Character && p.Exists() && p.isAlive)
           {
               // DO STUFF TO PED
           }
       }
   }
}


World.GetAllPeds() works best for stuff like this, but it could be slow.
You can always use World.GetPeds() with a reasonable radius if the above is too slow.


venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#13

Posted 12 May 2011 - 12:16 PM Edited by venom330, 12 May 2011 - 12:23 PM.

Ok i try this

CODE

using System;
using System.Drawing;
using System.Windows.Forms;
using GTA;

namespace MyTest
{


   public class MyTest : Script
   {


       TaskSequence FleeTask;

       public MyTest()
       {

           // Add tasks to the TaskSequence
           FleeTask = new TaskSequence();
           FleeTask.AddTask.FightAgainstHatedTargets(3, 5);
           FleeTask.AddTask.FightAgainst(Player);


           {
               Interval = 1000;
               this.Tick += new EventHandler(MyTest_Tick);
           }
       }
       internal void MyTest_Tick(object sender, EventArgs e)
       {
           {

               foreach (RelationshipGroup group in Enum.GetValues(typeof(RelationshipGroup)))
           {

               foreach (Ped p in World.GetAllPeds())
               {
                   if (p != null && p != Player.Character && p.Exists() && p.isAlive)
                       p.Task.PerformSequence(FleeTask);
                       p.ChangeRelationship(group, Relationship.Hate);
                   {
                       // DO STUFF TO PED
                   }
               }
               }
           }
       }
                   Ped Zombie;
               
           
                       private void DoTheZombie() {
                       if (Exists(Zombie))
                       Zombie.isRagdoll = false;
                       Zombie = null;
                       return;
               
                   }
   }


        ERROR    --->      Zombie = Player.GetTargetedPed(); {
                   if (!Exists(Zombie)) return;

                   Game.DisplayText("ZOMBIES!!!");
                   Zombie.Euphoria.BodyBalance.Start(-1);
               }


               {
                   if (!Exists(Zombie)) return;


                   if (Zombie.isGettingUp) return; // wait until the zombie is standing
                   if (!Zombie.isRagdoll) Zombie.Euphoria.BodyBalance.Start(-1);
                   if (!Zombie.Euphoria.BodyBalance.isBalanced)
                   { // get up again when fallen to the ground
                       Zombie.isRagdoll = false;
                       return;
                   }

                   Zombie.Euphoria.LeanToPosition.Amount = 1.0F;
                   Zombie.Euphoria.LeanToPosition.ApplyAsForce = true;
                   Zombie.Euphoria.LeanToPosition.Position = Player.Character.Position;
                   Zombie.Euphoria.LeanToPosition.Start();
}
}








But i get error at Zombie, It says: a namespace cannot directly contain members such as fields or methods

I want it to 1 script, so if you go around then you see some peds walking like zombies without you need to aim at them! cant find command, but i wanna find another command instead of you must aim so they become zombies. So i want all the text to go together, They attack everybody they see except their own zombie faction, Could you fix the problem ? xD

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#14

Posted 12 May 2011 - 07:48 PM Edited by L0uNGeR, 12 May 2011 - 09:10 PM.

Your code is completely messed up, are you even using Visual Studio or?
Also, you can't do BodyBalance and Tasks at the same time, I've tried it.
You could however pause BodyBalance and do a task, then continue BodyBalance, but it looks awkward.

I did a test with the code below, right now I commented out the "PerformSequence" because it still needs a check to see if they already have this task.
If you un-comment the line, they keep restarting the Task so it looks weird.
For now, this works, everybody hates everybody, no special faction or anything, I'm still working on that.

EDIT: This is probably better for setting relationships:

World.SetGroupRelationship( RelationshipGroup group, Relationship level, RelationshipGroup targetgroup )

CODE
using System;
using GTA;

namespace MyTest
{
   public class MyTest : Script
   {
       TaskSequence FightTask;

       public MyTest()
       {
           Interval = 1000;

           FightTask = new TaskSequence();
           FightTask.AddTask.FightAgainstHatedTargets(3, 5);
           FightTask.AddTask.FightAgainst(Player);

           this.Tick += new EventHandler(MyTest_Tick);
       }

       internal bool IsPedReady(Ped p)
       {
           return (p != null && p != Player.Character && p.Exists() && p.isAlive);
       }

       internal void SetPedHateEverybody(Ped p)
       {
           if (!p.Exists()) return;

           foreach (RelationshipGroup group in Enum.GetValues(typeof(RelationshipGroup)))
               p.ChangeRelationship(group, Relationship.Hate);
       }

       internal void MyTest_Tick(object sender, EventArgs e)
       {
           // Code in here is being run the whole time, according to "Interval"

           foreach (Ped p in World.GetAllPeds())
           {
               if (IsPedReady(p))
               {
                   SetPedHateEverybody(p);
                   //p.Task.PerformSequence(FightTask);
               }
           }
       }
   }
}

venom330
  • venom330

    Player Hater

  • Members
  • Joined: 10 May 2011

#15

Posted 13 May 2011 - 12:54 PM

Yeah sorry im still very nooby xd

but i tried atleast, ehm ok i take this code, but is it then possible to include the zombie thing aswell? becuase i want the zombie thing O.o

should i add it here?

SetPedHateEverybody(p);
//p.Task.PerformSequence(FightTask);

Zombie things
Zombie things
Zombie things
Zombie things
Zombie things
Zombie things

}
}
}
}
}

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#16

Posted 13 May 2011 - 10:04 PM

QUOTE (venom330 @ May 13 2011, 14:54)
Yeah sorry im still very nooby xd

but i tried atleast, ehm ok i take this code, but is it then possible to include the zombie thing aswell? becuase i want the zombie thing O.o

should i add it here?

SetPedHateEverybody(p);
//p.Task.PerformSequence(FightTask);

Zombie things
Zombie things
Zombie things
Zombie things
Zombie things
Zombie things

}
}
}
}
}

Yes it is possible, but it requires a much more advanced system to take care of the "BodyBalance" for ALL the zombies, instead of just 1.

Donny78
  • Donny78

    Zombie

  • Members
  • Joined: 18 Jul 2008

#17

Posted 14 May 2011 - 09:54 AM

Off topic:

You don't have to use the "internal" and "this" keywords (sorry forgot name of them), you can just do:

CODE

void myFunc() {}

// and

Tick += new .......


Not a big deal, just telling you so you save on redundant code.

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#18

Posted 14 May 2011 - 01:27 PM

QUOTE (Donny78 @ May 14 2011, 11:54)
Off topic:

You don't have to use the "internal" and "this" keywords (sorry forgot name of them), you can just do:

CODE

void myFunc() {}

// and

Tick += new .......


Not a big deal, just telling you so you save on redundant code.

Thanks for the heads up, but: Every example that I've seen used "this.tick" and "private void ...."
I only started using internal instead of private because I understood that it was better.
Why do all Hazard's examples use "this" and "private" ? I'm sure he's not a beginner...

lindsayslorach
  • lindsayslorach

    Rat

  • Members
  • Joined: 26 Dec 2006

#19

Posted 14 May 2011 - 02:37 PM

I'm pretty sure variables and methods are private anyway, so there's no need to have the private keyword.

Donny78
  • Donny78

    Zombie

  • Members
  • Joined: 18 Jul 2008

#20

Posted 14 May 2011 - 03:12 PM Edited by Donny78, 14 May 2011 - 03:16 PM.

QUOTE (L0uNGeR @ May 14 2011, 13:27)

Thanks for the heads up, but:  Every example that I've seen used "this.tick"  and "private void ...."
I only started using internal instead of private because I understood that it was better.
Why do all Hazard's examples use "this" and "private" ?  I'm sure he's not a beginner...


There could be reasons it's used in the examples you're using but in the above code it's not required as no other objects/instances/classes are being accessed anywhere. All the keywords are designed to allow access to other classes/instances etc, if you're not doing this then there is no need to use them.

Check out the MSDN website, it's got tons of great information on this type of thing.

Edit:

Grabbed a few links for you dude, Access Modifiers, this.

L0uNGeR
  • L0uNGeR

    Ya, that's what I said.

  • Members
  • Joined: 03 Dec 2008

#21

Posted 14 May 2011 - 06:29 PM

Well the code was actually a straight copy/paste from a much bigger script....
You should probably check the TestScripts.cs from the ScriptHook.Net package, there's "private" and "this" in every class and my code is not much different.
I'm not saying I know best, I'm still learning and I appreciate the help.

Donny78
  • Donny78

    Zombie

  • Members
  • Joined: 18 Jul 2008

#22

Posted 14 May 2011 - 11:31 PM

I'm no expert either (by far!), it was just something I noticed so I thought I'd throw my two cents in dude icon14.gif

It's a good suggestion to look at the examples, not looked at them since a very early version of the scripthook.

gavlar1992
  • gavlar1992

    Player Hater

  • Members
  • Joined: 29 Mar 2012

#23

Posted 29 March 2012 - 04:16 PM

Could someone help me create this, i'm pretty much new to scripting/coding. i really would want this to work though

OK, so i have a really cool new idea. I've recently started adding extra (not replacing) vehicles into the game, and a few times i've added a car that is a tuned version of one i already have, and added the ext_rare tag to it.. so its kinda like a rare tuned version... eg i have a mercedes and the amg version.. bmw and the haman version etc

MY IDEA: seeing as theres lots of these car mods kicking around and i was thinking of making a mod whereby you would go to brucies garage with a certain car.. eg a sultan and you would pay so much money and it would give you a sultanrs... so thus 'tuning' the car.. even though its just swapping the model. so im guessing the script would check the car name, display a prompt somewhere or even a menu, asking if you want it pimped, if yes then destroy the car, take x amount of money and spawn the new car associated with that car.. i.e sultanrs if the players car is a sultan.. and in my case 'turismogt' if players car is 'turismo'... etc... i get the idea but i'm no good at coding.. i can read basic bits etc but not create a script really from scratch without some help... could someone please help me with this?

I think this mod would be pretty impressive.. hey it could even turn into a huge overhaull and come with its own IMG file of these extra modded vehicles.. gtaiv NEEDS some form of tuning cars, even if its not really doing so.

Any help is much appreciated.

lamar_mustapha
  • lamar_mustapha

    Player Hater

  • BUSTED!
  • Joined: 17 Mar 2012

#24

Posted 29 March 2012 - 07:53 PM Edited by lamar_mustapha, 29 March 2012 - 08:09 PM.

i would assume u need the hash and then create using hash, try using the model name u added to vehicles.ide to get it's hash code

http://www.gtamoddin...itle=CREATE_CAR
http://www.gtamoddin...le=GET_HASH_KEY

C#
CODE
int myAddedCarsHash = GTA.Native.Function.Call("GET_HASH_KEY", "ModelNameofCarAdded");
Vehicle myCar = null;

GTA.Native.Function.Call("CREATE_CAR", myAddedCarsHash, Game.LocalPlayer.Character.Position.X, (Game.LocalPlayer.Character.Position.Y + 5), Game.LocalPlayer.Character.Position.Z, myCar, true);

GTA.Native.Function.Call("SET_CAR_ON_GROUND_PROPERLY", myCar);
myCar.Heading = Game.LocalPlayer.Character.Heading;


im just taking a wild guess but try that, i positioned car on ground in front of u with car pointing the direction u r looking




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users