Quantcast

Jump to content

» «
Photo

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

48 replies to this topic
Lorenzo3024
  • Lorenzo3024

    Snitch

  • Members
  • Joined: 17 Dec 2011
  • None

#31

Posted 15 August 2012 - 09:13 PM

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

pavelsoft
  • pavelsoft

    Player Hater

  • Members
  • Joined: 16 Aug 2012

#32

Posted 17 August 2012 - 07:52 AM

really useful

wapeddell
  • wapeddell

    Punk-ass Bitch

  • Members
  • Joined: 16 Jul 2011

#33

Posted 22 August 2012 - 05:49 PM

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

carolynross09
  • carolynross09

    Player Hater

  • Members
  • Joined: 24 Aug 2012

#34

Posted 24 August 2012 - 10:50 AM

Nice script..It works well

pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#35

Posted 08 September 2012 - 03:43 PM

QUOTE (CaptainDingo @ Saturday, Mar 7 2009, 00:08)
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

123iamking
  • 123iamking

    Who am I?

  • Members
  • Joined: 21 Jan 2011

#36

Posted 24 December 2012 - 04:55 AM

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

tobu24
  • tobu24

    "Apes with ego trips."

  • Members
  • Joined: 21 May 2004

#37

Posted 24 December 2012 - 07:57 PM

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.

123iamking
  • 123iamking

    Who am I?

  • Members
  • Joined: 21 Jan 2011

#38

Posted 10 January 2013 - 10:16 AM

QUOTE (123iamking @ Monday, Dec 24 2012, 04:55)
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

SecondEmeraldMaster
  • SecondEmeraldMaster

    Transit Specialist

  • Members
  • Joined: 30 Jan 2012

#39

Posted 09 February 2013 - 09:02 PM

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...?

Grove Street Boy
  • Grove Street Boy

    Maggot for life!

  • Members
  • Joined: 06 Aug 2005

#40

Posted 08 May 2013 - 03:57 PM

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.

lilmcnessy
  • lilmcnessy

    FenderCore

  • Members
  • Joined: 29 Oct 2008

#41

Posted 09 May 2013 - 08:53 AM

QUOTE (Grove Street Boy @ Thursday, May 9 2013, 04:57)
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)

Grove Street Boy
  • Grove Street Boy

    Maggot for life!

  • Members
  • Joined: 06 Aug 2005

#42

Posted 09 May 2013 - 05:57 PM

QUOTE (lilmcnessy @ Thursday, May 9 2013, 08:53)
QUOTE (Grove Street Boy @ Thursday, May 9 2013, 04:57)
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.gif cookie.gif

Silent_Waffle
  • Silent_Waffle

    Player Hater

  • Members
  • Joined: 05 Jun 2013

#43

Posted 05 June 2013 - 03:02 PM

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. :)

Silent_Waffle
  • Silent_Waffle

    Player Hater

  • Members
  • Joined: 05 Jun 2013

#44

Posted 05 June 2013 - 03:10 PM

QUOTE (tobu24 @ Monday, Dec 24 2012, 19:57)
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 :)

DRUZZRIN12296
  • DRUZZRIN12296

    Square Civilian

  • Members
  • Joined: 04 Aug 2009
  • None

#45

Posted 20 July 2013 - 10:31 PM Edited by DRUZZRIN12296, 23 July 2013 - 09:54 PM.

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

ticofa2
  • ticofa2

    Player Hater

  • Members
  • Joined: 18 Dec 2013

#46

Posted 18 December 2013 - 11:00 PM Edited by ticofa2, 18 December 2013 - 11:13 PM.

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...


Wiebrendh
  • Wiebrendh

    Beginning C# programmer

  • Members
  • Joined: 22 Mar 2014
  • Netherlands

#47

Posted 22 March 2014 - 05:09 PM Edited by Wiebrendh, 22 March 2014 - 06:05 PM.

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!


Rugz007
  • Rugz007

    Scripters ... roll out !

  • Members
  • Joined: 19 Apr 2014
  • India

#48

Posted 09 May 2014 - 04:57 PM

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


Sukhbir Singh (SS)
  • Sukhbir Singh (SS)

    Player Hater

  • New Members
  • Joined: 4 weeks ago
  • India

#49

Posted 4 weeks ago

its really hard  :panic:





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users