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

Community Script Hook V .NET


crosire
 Share

Recommended Posts

Problem, Your .net scripthook crashes when i try to receive an event from public withevents.

Can you explain what's causing this?

Link to comment
Share on other sites

Ignore this, i figured out another way.

Edited by Enumerator
Link to comment
Share on other sites

identitymatrix

I got it working, Julio helped.

 

Anyone know how to get custom cameras working?

 

I have had no luck so far.

 

Which is the camera activator method? isActive? That doesn't work :(

 

Seems like it should be a readonly property

Link to comment
Share on other sites

unknown modder

I got it working, Julio helped.

 

Anyone know how to get custom cameras working?

 

I have had no luck so far.

 

Which is the camera activator method? isActive? That doesn't work :(

 

Seems like it should be a readonly property

show the code your using to try and make it work
Link to comment
Share on other sites

 

 

1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ScriptHookVDotNet", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

1> Mod_1 -> F:\GTAV_MOD\Projects\Mod_1\Mod_1\bin\Debug\Mod_1.dll

 

I get this when i try to call a native.

 

 

And

 

[14:37:07] CORE: An exception occurred while executing 'ScriptHookVDotNet.asi'

On ScrtipHoobV.log

 

 

Change your project settings architecture to x64.

Link to comment
Share on other sites

I got it working, Julio helped.

 

Anyone know how to get custom cameras working?

 

I have had no luck so far.

 

Which is the camera activator method? isActive? That doesn't work :(

 

Seems like it should be a readonly property

http://gtaforums.com/topic/789907-vrel-community-script-hook-v-net/page-28?do=findComment&comment=1067659774

http://gtaforums.com/topic/789907-vrel-community-script-hook-v-net/page-28?do=findComment&comment=1067660068

Link to comment
Share on other sites

I would like to use the camera on the helicopter (like in the missions, with the police maverick): and therefore be able to zoom in / out, etc. But I can't find a native to do that. Does anyone know a way to get it to work ?

Link to comment
Share on other sites

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Edited by Enumerator
Link to comment
Share on other sites

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Ehm, it's been there since v1.1: "UI.DrawTexture()"?!!

Link to comment
Share on other sites

 

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Ehm, it's been there since v1.1: "UI.DrawTexture()"?!!

 

q6NnmK5.png

o.0

Link to comment
Share on other sites

unknown modder

 

 

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Ehm, it's been there since v1.1: "UI.DrawTexture()"?!!

 

q6NnmK5.png

o.0

 

you are not using v1.1 , if you are make sure you are also using the correct ScriptHookVDotNet.dll file as a reference

ab20316af9.png

Edited by unknown modder
Link to comment
Share on other sites

 

 

 

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Ehm, it's been there since v1.1: "UI.DrawTexture()"?!!

 

q6NnmK5.png

o.0

 

you are not using v1.1 , if you are make sure you are also using the correct ScriptHookVDotNet.dll file as a reference

ab20316af9.png

 

I think crosire should build in an auto updater into his scripthook, a simple downloader and using zipforge to extract the package to the "./" same directory.. :/

Downloading these scripthooks constantly is annoying.

 

I completely forgot to check the updates, thanks allot though :) The simple things always slip my mind.

Link to comment
Share on other sites

unknown modder

 

 

 

 

When will crosire implement texture drawing? Scripthookv has this, obviously we can have it to, crosire???

oh and we need texture rotation/angle ectt..........

Ehm, it's been there since v1.1: "UI.DrawTexture()"?!!

 

q6NnmK5.png

o.0

 

you are not using v1.1 , if you are make sure you are also using the correct ScriptHookVDotNet.dll file as a reference

ab20316af9.png

 

I think crosire should build in an auto updater into his scripthook, a simple downloader and using zipforge to extract the package to the "./" same directory.. :/

Downloading these scripthooks constantly is annoying.

 

I completely forgot to check the updates, thanks allot though :) The simple things always slip my mind.

 

its not really constantly, 1.1 came out 10 days ago

Link to comment
Share on other sites

identitymatrix

 

Wrote a checkpoint class in VB.NET if intrested

 

http://pastebin.com/Jam0rw0u

instead of using rgba arguments you can use the System.Drawing.Color class then pass the color r,g,b,a values

 

 

What, I did, didn't I?

 

- Well an overload

Edited by TheVideoVolcano
Link to comment
Share on other sites

identitymatrix

Anyone know how to get renderingcamera camera direction?

 

I am able to get all these

 

Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_HEADING)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_PITCH)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_ROT)
Native.Function.Call(Of Vector3)(Native.Hash.GET_GAMEPLAY_CAM_COORD)
Link to comment
Share on other sites

identitymatrix

 

Anyone know how to get renderingcamera camera direction?

 

I am able to get all these

 

Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_HEADING)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_PITCH)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_ROT)
Native.Function.Call(Of Vector3)(Native.Hash.GET_GAMEPLAY_CAM_COORD)

 

Well from ScripthookDotNet (iv)

 

GTA::Vector3 Helper::RotationToDirection(GTA::Vector3 Rotation) {
float rotZ = DegreeToRadian(Rotation.Z);
float rotX = DegreeToRadian(Rotation.X);
float multXY = System::Math::Abs((float)Math::Cos(rotX));
GTA::Vector3 res;
res.X = float(-Math::Sin(rotZ)) * multXY;
res.Y = float(Math::Cos(rotZ)) * multXY;
res.Z = float(Math::Sin(rotX));
return res;
}
Link to comment
Share on other sites

I cannot for the life of me figure out how to spawn a bodyguard. That is, spawn a ped, and actually have it follow and defend you.

I've referenced other sources and tried to convert that code to C# (which I did), but no matter what, the ped just would not follow you character.

 

Asking this here was my last resort. Can anybody help, point me in the right direction, or give me an example?

Edited by Raxdiam
Link to comment
Share on other sites

I dont know if this is the right section to ask this, but how can I check if player is inside a building? What is a correct Property for that? Is there something like Game.Player.Character.IsInBuilding? :/

 

I tried to look those functions and properties under Namespace GTA, but didn't find anything which is relevant to what I'm looking for :facedesk:

Edited by LizNet
Link to comment
Share on other sites

identitymatrix

I cannot for the life of me figure out how to spawn a bodyguard. That is, spawn a ped, and actually have it follow and defend you.

I've referenced other sources and tried to convert that code to C# (which I did), but no matter what, the ped just would not follow you character.

 

Asking this here was my last resort. Can anybody help, point me in the right direction, or give me an example?

Well, I haven't done that myself too much, but maybe try with

ped p = world.createRandomPed(player.position.around(2));p.isPersistent() = True;

And maybe just task the ped in the tick to goto player like so.

p.task.goto(player.position.around(2));

Oh, for defend, I would imagine it would be something 'like'

if (player.IsBeingJacked() || player.isInMeleeCombat()) {ped enemyped = world.getClosestPed(player.position, 2);if (enemyped.exists()) {enemyped.isEnemy();p.task.clearAll();//p.task.shootAt(enemyped);p.FightAgainstHatedTargets();}}

Something along those lines, this is untested and may not work. Ofcourse, build upon that, that is not nearly enough checks etc...

 

Sorry If the syntax is incorrect, I use vb.net for gta.

Edited by TheVideoVolcano
Link to comment
Share on other sites

identitymatrix

 

 

Anyone know how to get renderingcamera camera direction?

 

I am able to get all these

 

Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_HEADING)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_RELATIVE_PITCH)
Native.Function.Call(Of Double)(Native.Hash.GET_GAMEPLAY_CAM_ROT)
Native.Function.Call(Of Vector3)(Native.Hash.GET_GAMEPLAY_CAM_COORD)

 

Well from ScripthookDotNet (iv)

 

GTA::Vector3 Helper::RotationToDirection(GTA::Vector3 Rotation) {
float rotZ = DegreeToRadian(Rotation.Z);
float rotX = DegreeToRadian(Rotation.X);
float multXY = System::Math::Abs((float)Math::Cos(rotX));
GTA::Vector3 res;
res.X = float(-Math::Sin(rotZ)) * multXY;
res.Y = float(Math::Cos(rotZ)) * multXY;
res.Z = float(Math::Sin(rotX));
return res;
}

 

 

Doesn't matter I figured it out, I just converted Hazard Trigonometric calculations to VB.net

 

Here is the code in VB.NET

 

http://pastebin.com/WZDyfBcV

 

use like so:

dim dir as vector3 = THelper.rotationToDirection(gameplayCamera.rotation)
'WRITTEN BY HAZARDX/CODEAPARAT/TIM'TRANSLATED FROM C++ TO VB.NET BY THEVIDEOVOLCANOPublic Class THelperPublic Shared Function RadianToDegree(ByVal radians As Double) As DoubleReturn radians * Convert.ToDouble(180.0 / Math.PI)End FunctionPublic Shared Function DegreeToRadian(ByVal degrees As Double) As DoubleReturn degrees * Convert.ToDouble(Math.PI / 180.0)End FunctionPublic Shared Function DirectionToHeading(ByVal dir As GTA.Math.Vector3) As Doubledir.Z = 0.0Fdir.Normalize()Return RadianToDegree(-Math.Atan2(dir.X, dir.Y))End FunctionPublic Shared Function HeadingToDirection(ByVal Heading As Double) As GTA.Math.Vector3Heading = DegreeToRadian(Heading)Dim res As GTA.Math.Vector3res.X = Convert.ToDouble(-Math.Sin(Heading))res.Y = Convert.ToDouble(Math.Cos(Heading))res.Z = 0.0FReturn resEnd FunctionPublic Shared Function DirectionToRotation(ByVal dir As GTA.Math.Vector3, ByVal roll As Double)dir = GTA.Math.Vector3.Normalize(dir)Dim rotval As GTA.Math.Vector3' Z rotation calculated from the Floor - Vector of Direction . (Normal X and Z)rotval.Z = -RadianToDegree(Math.Atan2(dir.X, dir.Y))' X rotation calculated from the angle between the length of the floor and the height VectorsDim rotpos As GTA.Math.Vector3 = GTA.Math.Vector3.Normalize(New GTA.Math.Vector3(dir.Z, New GTA.Math.Vector3(dir.X, dir.Y, 0.0F).Length(), 0.0F))rotval.X = RadianToDegree(Math.Atan2(rotpos.X, rotpos.Y))rotval.Y = roll 'RollReturn rotvalEnd FunctionPublic Shared Function RotationToDirection(ByVal Rotation As GTA.Math.Vector3) As GTA.Math.Vector3Dim rotZ As Double = DegreeToRadian(Rotation.Z)Dim rotX As Double = DegreeToRadian(Rotation.X)Dim multiXY As Double = Math.Abs(Convert.ToDouble(Math.Cos(rotX)))Dim res As GTA.Math.Vector3res.X = Convert.ToDouble(-Math.Sin(rotZ)) * multiXYres.Y = Convert.ToDouble(Math.Cos(rotZ)) * multiXYres.Z = Convert.ToDouble(Math.Sin(rotX))Return resEnd FunctionEnd Class
Edited by TheVideoVolcano
Link to comment
Share on other sites

Pointless asking questions here.

Edited by Enumerator
Link to comment
Share on other sites

Wrote a checkpoint class in VB.NET if intrested

 

http://pastebin.com/Jam0rw0u

Okay could I ask does this work like for example like a police checkpoint?

or could you help me out by helping me get sample code to make a police checkpoint script?

Link to comment
Share on other sites

I have a question: when I change my ped model, I can't access the hair cut saloon, nor the clothing stores. How can I fix that ?

Edited by nordi
Link to comment
Share on other sites

TheRealMofu

Is it possible that ScriptHookVDotNet stopped working after latest patch ?

I'm just curious because i installed win10 today and after install i recognized that there is a new Update for GTA V, or if ScriptHookVDotNet has a problem with win10

 

Problem solved, i forgot to install the Redistributable Packages xD

Edited by TheRealMofu
Link to comment
Share on other sites

Is this working with the patch released last night?

 

I don't want to install it when RageHook is updated if it's broken.

Link to comment
Share on other sites

TheRealMofu

Is this working with the patch released last night?

 

I don't want to install it when RageHook is updated if it's broken.

Read my post above yours, yeah is working flawless ;)

Link to comment
Share on other sites

 

Is this working with the patch released last night?

 

I don't want to install it when RageHook is updated if it's broken.

Read my post above yours, yeah is working flawless ;)

 

Nevermind it works it appears the latest ci build fixed it

Edited by timnboys
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

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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