Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (84,718 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

Andrew

[IV | .NET] Writing .net scripts in C#

Recommended Posts

Lorenzo3024

sorry, how can I spawn a vehicle and warp niko inside?

 

this is my code:

 

Public Class SpawnHoverCar

Inherits Script

 

Public Sub New()

BindKey(Keys.PageUp, AddressOf SpawnCar)

End Sub

 

Public Sub SpawnCar()

Dim v As Vehicle = World.CreateVehicle("INFERNUS", Player.Character.Position.Around(0.0F))

 

v.NoLongerNeeded()

End Sub

End Class

 

PS: Sorry for my bad engish

Share this post


Link to post
Share on other sites
pavelsoft

really useful

Share this post


Link to post
Share on other sites
wapeddell

How do I figure out what functions do what that is the only thing holding me back from writing my own scripts.

Share this post


Link to post
Share on other sites
carolynross09

Nice script..It works well

Share this post


Link to post
Share on other sites
pedro2555
I appreciate all the time you took to do this, but unfortunately this is worthless for people like me who don't know C# already. confused.gif

 

It's probably hard for someone who already knows it all, but from my perspective, this is nearly impossible. I can read it five times over and still not understand it, at all. I mean, I understand variables, strings, variable and string operations, but I don't understand the structure encased around them one bit.

 

It's a shame because I have a logical mind for programming, but nobody has come along yet who is really capable of teaching me how to actually program successfully. Like what's a method? What's "public class tutScriptVS : Script" do? What is "(object sender, GTA.KeyEventsArgs e)" all this stuff for? What does any of it mean? It looks like gibberish to me. Arg is the sound I make when I take a huge crap, and that's all I know. notify.gif

 

It's all the little things like this that coders take for granted when they're trying to teach and gloss over or ignore them, but that seriously make me feel confused and unable to learn any of this.

I will try yo give a full starter tutorial for C#. Next week should be ready

Share this post


Link to post
Share on other sites
123iamking

can u teach me how to write the code "flip car" and "warp to previous car"(in case player fly out of the car after crashing) ? thanks , I don't know where to find those command monocle.gif

Share this post


Link to post
Share on other sites
tobu24

I cannot seem to open any .NET scripts even with visual studio. I'm very confused. Is there a format I'm missing. I have a former .NET file created by someone who left the scene and I'm simply trying to open it to clean up the scripts and learn in the process.

Share this post


Link to post
Share on other sites
123iamking
can u teach me how to write the code "flip car" and "warp to previous car"(in case player fly out of the car after crashing) ? thanks , I don't know where to find those command monocle.gif

don't have to find how to do those things anymore , I have find it out by myself . I have made "Be a driver" mod and upload it to GTAgarage.com

Share this post


Link to post
Share on other sites
SecondEmeraldMaster

Am I able to use this with Visual C# 2010?

 

I saw that the one of the lines requires this:

 

using System.Windows.Forms

 

But C#2010 doesn't recognize this. Maybe I don't need it for this version...?

Share this post


Link to post
Share on other sites
GaryRoachSanderson

Is there a function in .net scripting similar to the below cleo opcode?

 

00FE: actor $PLAYER_ACTOR sphere 0 in_sphere -2883.06 -2921.75 4.5529 radius 299.0 299.0 299.0

 

Basically a method to detect if the player is in a certain radius from a point.

Share this post


Link to post
Share on other sites
lilmcnessy
Is there a function in .net scripting similar to the below cleo opcode?

 

00FE: actor $PLAYER_ACTOR sphere 0 in_sphere -2883.06 -2921.75 4.5529 radius 299.0 299.0 299.0

 

Basically a method to detect if the player is in a certain radius from a point.

if(Player.Character.Position.DistanceTo(new Vector3(-2883.06f, -2921.75f, 4.5529f) < 300)

Share this post


Link to post
Share on other sites
GaryRoachSanderson
Is there a function in .net scripting similar to the below cleo opcode?

 

00FE:  actor $PLAYER_ACTOR sphere 0 in_sphere -2883.06 -2921.75 4.5529 radius 299.0 299.0 299.0

 

Basically a method to detect if the player is in a certain radius from a point.

if(Player.Character.Position.DistanceTo(new Vector3(-2883.06f, -2921.75f, 4.5529f) < 300)

Amazing, thanks! biggrin.gifcookie.gif

Share this post


Link to post
Share on other sites
Silent_Waffle

Can someone help me find out when the character kicks someone? I'm making a disarming mod and I want a kick to knock a gun away. And also, how do you add weapons to the characters inventory? I know there is "Player.Character.Weapons.Select()" but how to ADD a weapon? Thanks in advance. :)

Share this post


Link to post
Share on other sites
Silent_Waffle
I cannot seem to open any .NET scripts even with visual studio. I'm very confused. Is there a format I'm missing. I have a former .NET file created by someone who left the scene and I'm simply trying to open it to clean up the scripts  and learn in the process.

That't because that script has been compiled. You can't read dll code. Try a decompiler like .net reflector. But, it doesn't always work very well. Better than nothing though I suppose. Happy modding :)

Share this post


Link to post
Share on other sites
DRUZZRIN12296

Hi I have a message saying

"The name 'Color' does not exist in the current context"

How do I reference for fonts I can't seem to find... Using Visual Studio Express 2012

 

Nvm got it tounge.gif

Edited by DRUZZRIN12296

Share this post


Link to post
Share on other sites
ticofa2

Hi, i need help, i actually dont understand all the C# language, but i know some code parts because its close to english, and i wanted to edit a Script, .dll file, obvously a mod for GTA IV, but i always get errors, between 20 to 999 of them :S

 

They are errors like:

 

- 'Object' is an ambiguous reference between 'GTA.Object' and 'object'

 

- Error 8 'Graphics' is an ambiguous reference between 'GTA.Graphics' and 'System.Drawing.Graphics'

 

- Error 17 'KeyEventArgs' is an ambiguous reference between 'GTA.KeyEventArgs' and 'System.Windows.Forms.KeyEventArgs'

 

ETC...

Edited by ticofa2

Share this post


Link to post
Share on other sites
Wiebrendh

Am I able to use this with Visual C# 2010?

 

I saw that the one of the lines requires this:

 

using System.Windows.Forms

 

But C#2010 doesn't recognize this. Maybe I don't need it for this version...?

Same here, finally managed to fix it!

Edited by Wiebrendh

Share this post


Link to post
Share on other sites
Rugz007

Hi I have a message saying

"The name 'Color' does not exist in the current context"

How do I reference for fonts I can't seem to find... Using Visual Studio Express 2012

 

Nvm got it tounge.gif

I Have The Same Problem Any Solution

Share this post


Link to post
Share on other sites
Sukhbir Singh (SS)

its really hard :panic:

Share this post


Link to post
Share on other sites
ashishcw

First of all sorry for the late post(Almost, posting a comment after a year from the last comment, lol :blink: )

 

But, I had to thank you for this in-depth explaining of the terms, I was following this for quiet a sometime now. :monocle:

 

I was curious to know, does anyone succeeded, creating ALL SIGNAL GREEN MOD? :barf:

 

What I mean is, when Niko(character) travels around in a car, all the signal in his row goes to green by this way up-head car doesn't have to stop, making Niko's car to drive smoothly without stopping or dodging the other cars. :whistle:

Share this post


Link to post
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

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.