IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules Attention:

This is for the discussion and releasing of tutorials for modifying GTA. Anything that isn't a tutorial will be deleted without notification.

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


Pages: (3) 1 [2] 3   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

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

 For .netscripthook
 
Andrew  
Posted: Saturday, Mar 13 2010, 09:40
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




If you use the above tutorial, which shows you how to use key presses and display stuff on the screen, that's the starting framework, then all you need to do is grab the current vehicle, and grab the speed from it.

CODE

//check if we are actually in a vehicle
if(Player.Character.isInVehicle())
{
float speed = Player.Character.CurrentVehicle.Velocity;
}


or something along those lines.
PM
  Top
 

 
Threepwood  
Posted: Saturday, Mar 13 2010, 12:05
Quote Post


Calm like a bomb.
Group Icon
Group: Members
Joined: Jul 13, 2008

XXXXX



Yeah figured it out step by step and with some other help - its not easy to jump into smth completely new wink.gif
Thanks for that!
PM
  Top
 

 
Gokaic  
Posted: Saturday, May 15 2010, 07:06
Quote Post


Rat
Group Icon
Group: Members
Joined: Jan 17, 2006

us.gif

XXXXX



I was going to ask how this was done, but I decided to do a bit of research and thought I'd post my findings. Please correct me if I'm wrong, because I haven't had a chance to test this.

This is how you would set information to a .ini file. I'm using the ini file format from the original tutorial for continuity:
CODE

Settings.SetValue("INTERVAL", "SETTINGS", [VALUE]);


where [VALUE] is the value you are trying to set. So let's say you have an integer with a set amount, and you want to write this amount into your ini file.

CODE

int i = 10000;
Settings.SetValue("INTERVAL", "SETTINGS", i);



EDIT: Sorry to dig up a few month old post, but I thought if I can help some green scripters learn how to make the next greatest mod, it would be worth it, and it would also be nice to continue this tutorial so we can all learn how to create better scripts.

This post has been edited by Gokaic on Saturday, May 15 2010, 07:09
Users WebsitePMMSNXbox Live
  Top
 

 
^- Dice ->  
Posted: Monday, Jan 24 2011, 15:39
Quote Post


love_triangle
Group Icon
Group: Members
Joined: Aug 12, 2008

se.gif

Member Award




Pardon my ignorance, but couldn't you just write your own system using System.Windows.IO ?

Edit: Sorry for the bump, didn't notice the post date

This post has been edited by ^- Dice -> on Monday, Jan 24 2011, 15:41
Users WebsitePM
  Top
 

 
samestreet  
Posted: Thursday, Nov 24 2011, 05:38
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 5, 2011

XXXXX



Hey friend! Do you know how to spawn attacking peds and, also, bodyguards? I was trying to do it through the Ped.Tasks (building a sequence) but it is not working. I'm also trying to detect when some mobs are dead, but, it seems to be not working properly. Something like this:

Ped ped;
ped = World.CreatePed(Player.Character.Position.Around(5.0f));

// code code code

if(ped.isDead)
// code code code
PM
  Top
 

 
jitsuin  
Posted: Sunday, Dec 11 2011, 07:30
Quote Post


Meat Popsicle
Group Icon
Group: BUSTED!
Joined: Dec 6, 2011

us.gif

XXXXX



dumb question deleted blush.gif

This post has been edited by jitsuin on Saturday, Jan 14 2012, 20:50
PMMSNXbox Live
  Top
 

 
YossiBz  
Posted: Wednesday, Jan 25 2012, 17:40
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 13, 2010

ie.gif

XXXXX



how I flip a car?
PMMSN
  Top
 

 
jitsuin  
Posted: Thursday, Jan 26 2012, 18:12
Quote Post


Meat Popsicle
Group Icon
Group: BUSTED!
Joined: Dec 6, 2011

us.gif

XXXXX



why does this not work when i try BindPhoneNumber? I place this.BindPhoneNumber in script constructor and create my method below the constructor

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

namespace GTA
{
   public class GTA : Script
   {
       public GTA()
       {
           this.BindPhoneNumber("1234567890", new PhoneDialDelegate(WrongNumber));
       }
       private void WrongNumber()
       {
           Game.DisplayText("Wrong Number Bitch");
       }
   }
}


i dial 1234567890 on phone but no method is called and i just get a busy signal, no text is displayed...thanks!!!

i also tried multiple strings for phone number like "777 400" or "1111" or "1111111111" and nothing confused.gif

This post has been edited by jitsuin on Thursday, Jan 26 2012, 18:24
PMMSNXbox Live
  Top
 

 
gatienthe  
Posted: Saturday, Jan 28 2012, 15:46
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jan 28, 2012

jolly-roger.gif

XXXXX



Hi,

Thank you for the tutorial !

jitsuin, i think you need to do that
CODE
BindConsoleCommand("WrongNumber", new ConsoleCommandDelegate(WrongNumberCommand), "Wrong Number Bitch");
PM
  Top
 

 
Don Wasyl  
Posted: Wednesday, May 9 2012, 23:34
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 22, 2007

pl.gif

XXXXX



Andrew, could you reupload images in your tutorial?
Tranks!
Users WebsitePM
  Top
 

 
Lorenzo3024  
Posted: Wednesday, Aug 15 2012, 21:13
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Dec 17, 2011

XXXXX



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
PM
  Top
 

 
pavelsoft  
Posted: Friday, Aug 17 2012, 07:52
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 16, 2012

bg.gif

XXXXX



really useful
Users WebsitePM
  Top
 

 
wapeddell  
Posted: Wednesday, Aug 22 2012, 17:49
Quote Post


Snitch
Group Icon
Group: Members
Joined: Jul 16, 2011

XXXXX



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

 
carolynross09  
Posted: Friday, Aug 24 2012, 10:50
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Aug 24, 2012

XXXXX



Nice script..It works well
Users WebsitePM
  Top
 

 
pedro2555  
Posted: Saturday, Sep 8 2012, 15:43
Quote Post


Rat
Group Icon
Group: Members
Joined: Sep 2, 2012

XXXXX



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
PM
  Top
 

 
123iamking  
Posted: Monday, Dec 24 2012, 04:55
Quote Post


The Only One Who has Member Log
Group Icon
Group: Members
Joined: Jan 21, 2011

XXXXX



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
PM
  Top
 

 
tobu24  
Posted: Monday, Dec 24 2012, 19:57
Quote Post


"Apes with ego trips."
Group Icon
Group: Members
Joined: May 21, 2004

XXXXX



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

 
123iamking  
Posted: Thursday, Jan 10 2013, 10:16
Quote Post


The Only One Who has Member Log
Group Icon
Group: Members
Joined: Jan 21, 2011

XXXXX



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
PM
  Top
 

 
SecondEmeraldMaster  
Posted: Saturday, Feb 9 2013, 21:02
Quote Post


Transit Specialist
Group Icon
Group: Members
Joined: Jan 30, 2012

us.gif

XXXXX



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...?
Users WebsitePMXbox LivePlayStation Network
  Top
 

 
Grove Street Boy  
Posted: Wednesday, May 8 2013, 15:57
Quote Post


Maggot for life!
Group Icon
Group: Members
Joined: Aug 6, 2005

mars.gif

XXXXX



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

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (3) 1 [2] 3 

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG