Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Tuners
      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. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

      1. 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. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. 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. 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

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

C++ Script Hook


aru
 Share

Recommended Posts

im using old one so im using a car not vehicle, how to use FreezePositionOfClosestObjectOfType()?

like this?

 

x,y,z= char coord

25 = radius

1 = yes

obj= object

FreezePositionOfClosestObjectOfType(obj, x, y, z, 25, 1)

 

Please update to the never version, like Lounger said it has alot more Natives included... Its easier to give support to smile.gif

Link to post
Share on other sites

Id like to make a general suggestion to modders, It would be smart if you could rig up a button to disable the mod from inside the game so if a person uses a mod that uses the same keys they can disable the conflicting mod temporarily with one key. Allowing them to use the same keys for another mod. There is still a possibility for conflict but its greatly reduced. All it takes is one key toggling a bool that must be true for the other keys to work.

Link to post
Share on other sites

Well, then the toggle keys can still be conflicting with others can't they.

A better one would be to make a small INI file that tells the ASI what key to use.

Link to post
Share on other sites

I have update it, so how to use key like 'q'?

I use the get nearest car but error, why?

Link to post
Share on other sites

These are the Keys

 

As for the car, with no info of your error i would guess you don't check if it found one and then try to use (the null car) in a script but it doesn't exist.

Edited by C06alt
Link to post
Share on other sites

 

Id like to make a general suggestion to modders, It would be smart if you could rig up a button to disable the mod from inside the game so if a person uses a mod that uses the same keys they can disable the conflicting mod temporarily with one key. Allowing them to use the same keys for another mod. There is still a possibility for conflict but its greatly reduced. All it takes is one key toggling a bool that must be true for the other keys to work.

Yeah, I thought about that when I made my Car Spawner script. That's also the reason I implemented a hotkeys file. The way I did it would make most programmers shake their heads while facepalmed. Basicly I copyed snippets I found from google and went with that confused.gif

But most importantly, it works and since it loads the stuff on initalization, there can't be any major performance hit, either.

Edited by asd23
Link to post
Share on other sites

ApplyForceToCar param please, is this right?

 

static void ApplyForceToCar(Car car, f32 p1, f32 p2, f32 p3, f32 p4, f32 p5, f32 p6, f32 p7, f32 p8, f32 p9, f32 p10, f32 p11) { NativeInvoke::Invoke<scriptVoid>("APPLY_FORCE_TO_CAR", car, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }

 

Link to post
Share on other sites

 

ApplyForceToCar param please, is this right?

 

static void ApplyForceToCar(Car car, f32 p1, f32 p2, f32 p3, f32 p4, f32 p5, f32 p6, f32 p7, f32 p8, f32 p9, f32 p10, f32 p11) { NativeInvoke::Invoke<scriptVoid>("APPLY_FORCE_TO_CAR", car, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }

Nope, thats the Dirty (scriptingdirty.h) version... IF you have 2.1 you can just type ApplyForceToCar and get a nice list of params. (Vehicle, x,y,z, etc)

Link to post
Share on other sites

Can you use wait or something that delay?

 

Edit : Hey, what is the key of a-z type?

keypressed?

Edited by aceship
Link to post
Share on other sites

I made a new class in the CustomFiberThread folder. But when i include the H files for the Types (in my H file). I get these wierd errors.... :

 

 

#include "../ScriptHook/ScriptingEnums.h"#include "../ScriptHook/ScriptingTypes.h"Errors:c:\werkmap\force2\scripthook\scriptingenums.h(2753) : error C2146: syntax error : missing ';' before identifier 'eColour'c:\werkmap\force2\scripthook\scriptingenums.h(2753) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\werkmap\force2\scripthook\scriptingenums.h(2753) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\werkmap\force2\scripthook\scriptingtypes.h(65) : error C2146: syntax error : missing ';' before identifier 'X'c:\werkmap\force2\scripthook\scriptingtypes.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\werkmap\force2\scripthook\scriptingtypes.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\werkmap\force2\scripthook\scriptingtypes.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\werkmap\force2\scripthook\scriptingtypes.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

 

When i comment them out theres no problem. Scripthook itself doesnt error on this?

Link to post
Share on other sites

 

I think you just forget to put a ";" at the end of a line^^

lol, i didnt touch the file tounge.gif

 

Btw, the errors VS spits out are so crap... I always though Borland was bad, but atleast they have to the point error messages, jeez...

Link to post
Share on other sites

 

Can you use wait or something that delay?

 

Edit : Hey, what is the key of a-z type?

keypressed?

Just use the same function for it. There's a list of all virtual key codes here. You have to use those heximal numbers for the A-Z a-z though to make it work.

Link to post
Share on other sites

hi there on compiling i get the follow errors

 

1>------ Rebuild All started: Project: ScriptHook, Configuration: Release Win32 ------

1>Deleting intermediate and output files for project 'ScriptHook', configuration 'Release|Win32'

1>Compiling...

1>Game.cpp

1>ScriptHookManager.cpp

1>NativeThread.cpp

1>NativeFiberThread.cpp

1>.\NativeFiberThread.cpp(60) : error C3861: 'SwitchToFiber': identifier not found

1>.\NativeFiberThread.cpp(77) : error C3861: 'DeleteFiber': identifier not found

1>.\NativeFiberThread.cpp(80) : error C3861: 'CreateFiber': identifier not found

1>.\NativeFiberThread.cpp(115) : error C3861: 'ConvertThreadToFiber': identifier not found

1>.\NativeFiberThread.cpp(119) : error C3861: 'CreateFiber': identifier not found

1>.\NativeFiberThread.cpp(138) : error C3861: 'SwitchToFiber': identifier not found

1>.\NativeFiberThread.cpp(199) : error C3861: 'SwitchToFiber': identifier not found

1>.\NativeFiberThread.cpp(215) : error C3861: 'SwitchToFiber': identifier not found

1>.\NativeFiberThread.cpp(237) : error C3861: 'DeleteFiber': identifier not found

1>LoggerODS.cpp

1>LoggerFile.cpp

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS' : undeclared identifier

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT' : undeclared identifier

1>.\LoggerFile.cpp(35) : error C3861: 'GetModuleHandleEx': identifier not found

1>Log.cpp

1>Build log was saved at "file://c:\myself\Bureaublad\gta4\hook\ScriptHook\Release\BuildLog.htm"

1>ScriptHook - 12 error(s), 0 warning(s)

2>------ Rebuild All started: Project: SampleCustom, Configuration: Release Win32 ------

2>Deleting intermediate and output files for project 'SampleCustom', configuration 'Release|Win32'

3>------ Rebuild All started: Project: SampleCustomFiber, Configuration: Release Win32 ------

3>Deleting intermediate and output files for project 'SampleCustomFiber', configuration 'Release|Win32'

3>Compiling...

2>Compiling...

3>Main.cpp

2>Main.cpp

2>CustomThread.cpp

3>CustomFiberThread.cpp

2>Linking...

3>Linking...

2>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

3>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

2>Build log was saved at "file://c:\myself\gta4\hook\SampleCustom\Release\BuildLog.htm"

2>SampleCustom - 1 error(s), 0 warning(s)

3>Build log was saved at "file://c:\myself\gta4\hook\SampleCustomFiber\Release\BuildLog.htm"

3>SampleCustomFiber - 1 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 3 failed, 0 skipped ==========

 

who can help me out? or who has the same probs [ using vs2008 v 9.0.21022.8]

 

 

Link to post
Share on other sites

I agree that the DisplayTextWithLiteralString will do the trick for displaying text, but I don't want to make all kinds of checks, just to display some text to indicate I have enabled something by pressing a button. Yes the text was displayed but only for a brief moment.

 

So I checked some other natives and found this one:

 

 

 

static void PrintStringWithLiteralStringNow(const ch *gxtName, const ch *literalStr, int ms, int enable) { NativeInvoke::Invoke<scriptVoid>("PRINT_STRING_WITH_LITERAL_STRING_NOW", gxtName, literalStr, ms, enable); }

 

 

This will put text at the bottom of the screen, and I can control for how long it will stay there (the ms parm).

 

I use this:

 

PrintStringWithLiteralStringNow("CP_MAX_2", "my own string",7500,1);

 

to display text. Of course it is using a GXT message (that will dispay 2-32 players). I have simply edited the relevant GXT (CRC32: 11f63f55) and now only my own string is displayed in game.

 

smile.gif

Link to post
Share on other sites

@Intosia : check the line 2753 and 65 of scriptingenums.h

 

@bobba2 : you don't modify the files?

no i dint mod any files at all the first thing i do is alway try to complile

 

so thats why i cant figer out. also it says i mis a lib file also not in the packets sad.gif

Link to post
Share on other sites

@Intosia : check the line 2753 and 65 of scriptingenums.h

 

@bobba2 : you don't modify the files?

no i dint mod any files at all the first thing i do is alway try to complile

 

so thats why i cant figer out. also it says i mis a lib file also not in the packets sad.gif

You normally don't have to do this... and I dont know why its breaking for you. But open NativeFiberThread.cpp and at the very top before all the other #include, add in:

 

 

#define _WIN32_WINNT 0x0501

 

 

Do the same for LoggerFile.cpp

Link to post
Share on other sites

 

@Intosia : check the line 2753 and 65 of scriptingenums.h

 

@bobba2 : you don't modify the files?

no i dint mod any files at all the first thing i do is alway try to complile

 

so thats why i cant figer out. also it says i mis a lib file also not in the packets sad.gif

You normally don't have to do this... and I dont know why its breaking for you. But open NativeFiberThread.cpp and at the very top before all the other #include, add in:

 

 

#define _WIN32_WINNT 0x0501

 

 

Do the same for LoggerFile.cpp

thnx m8t that works fine but only left 1 error

 

2>Linking...

3>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

2>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

 

so where to get the scripthook.lib?

 

and these errors

 

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS' : undeclared identifier

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT' : undeclared identifier

1>.\LoggerFile.cpp(35) : error C3861: 'GetModuleHandleEx': identifier not found

Link to post
Share on other sites

You normally don't have to do this... and I dont know why its breaking for you. But open NativeFiberThread.cpp and at the very top before all the other #include, add in:

 

 

#define _WIN32_WINNT 0x0501

 

 

Do the same for LoggerFile.cpp

thnx m8t that works fine but only left 1 error

 

2>Linking...

3>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

2>LINK : fatal error LNK1181: cannot open input file '..\release\scripthook.lib'

 

so where to get the scripthook.lib?

 

and these errors

 

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS' : undeclared identifier

1>.\LoggerFile.cpp(34) : error C2065: 'GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT' : undeclared identifier

1>.\LoggerFile.cpp(35) : error C3861: 'GetModuleHandleEx': identifier not found

Did you do it for LoggerFile.cpp too? Add the very same line in LoggerFile.cpp. scripthook.lib is generated automatically... the only reason it doesn't exist is because LoggerFile.cpp doesn't compile yet.

 

Link to post
Share on other sites

PrintStringWithLiteralStringNow("CP_MAX_2", "my own string",7500,1);

 

You can't use "STRING" instead of "CP_MAX_2"?

Yes !

 

You can smile.gif

 

I was trying that this morning, but I needed to go to work, but anyway it wasn't working this morning, (as in not displaying anything) I changed a parm on the native later today, but just changed a GXT, but I have just tried it with:

 

PrintStringWithLiteralStringNow("STRING", "Comet Spawned",5000,1);

 

and it works, so no need to even change the GXT.

 

 

Link to post
Share on other sites

PrintStringWithLiteralStringNow("STRING", "Comet Spawned",5000,1);

 

 

 

Thanks nice smile.gif

 

I just tried SET_TEXT_SCALE(f32 Width, f32 Height), but nothing changes to my text displayed with DisplayTextWithLiteralString... Anyone have a snipped?

Link to post
Share on other sites

I use SetTextScale like that and is work :

 

SetTextScale(0.4f,0.4f);DisplayTextWithLiteralString(x, y, "STRING", "my string");

 

 

And I add this in my Scripting.h :

 

static void SetTextScale(f32 SW, f32 SH) { NativeInvoke::Invoke<scriptVoid>("SET_TEXT_SCALE", SW, SH); }

 

Link to post
Share on other sites

I use SetTextScale like that and is work :

 

SetTextScale(0.4f,0.4f);DisplayTextWithLiteralString(x, y, "STRING", "my string");

 

 

And I add this in my Scripting.h :

 

static void SetTextScale(f32 SW, f32 SH) { NativeInvoke::Invoke<scriptVoid>("SET_TEXT_SCALE", SW, SH); }

 

You're right. Im stupid, i was compiling Debug, but compying dll from Release folder, AARGGGGG

Link to post
Share on other sites

Strange, the GetModelHash function doesn't seem to work. GetModelHash("MODEL_M_M_GRU2_HI_01") for example does not return 0x6F31C4B4 , as it is defined in ScriptingEnums.h . The returned hash also doesn't work. Or am i doing something wrong here? Isn't that the correct way to get the hash of a model by string?

 

[EDIT] Same for GetHashKey... confused.gif

Edited by HazardX
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
 Share

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

×
×
  • Create New...

Important Information

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