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

I have a "little" problem with the SampleCustomFiber when I put SampleCustomFiber.asi in my GTA4 folder the ASI loader load it but the "CustomFiberThread::RunScript()" never executed

to see if it runs I added

LogInfo("RunScript");

before the

while(IsThreadAlive())

 

 

I try to load it with Alice ASI loader and Xlive ASI loader, my game is patch and the SampleCustom.asi work perfectly.

Link to comment
Share on other sites

@klanly... I'm aware of the problem... just haven't figured out a way to solve it with the least amount of resource usage yet smile.gif

 

@sjaak327... you can try this

 

eColour colour1,colour2;

 

Just match the types... enums can be safely casted to int and back... so if you want a int value of it, do something like:

 

int colourInt = (int)colour1;colour1 = (eColour)colourInt;

 

 

@GAK... interesting problem, since I can't reproduce it. I'm assuming you got in-game (RunScript isn't started till it gets ingame). Can you post the contents of SampleCustomFiber.log. If you can't find SampleCustomFiber.log, try running GTAIV as admin.

Edited by aru
Link to comment
Share on other sites

I can see the SampleCustom.log but the SampleCustomFiber.log don't exist.In the log of the ASI loader of Alice I saw this(without other ASI) :

Loading ASI J:\Rockstar Games\Grand Theft Auto IV\SampleCustomFiber.asiASI loaded : J:\Rockstar Games\Grand Theft Auto IV\SampleCustomFiber.asi, Address 0x00000000

 

 

and this (with orther ASI) :

 

Loading ASI J:\Rockstar Games\Grand Theft Auto IV\flight_mod_dingbat2k.asiASI loaded : J:\Rockstar Games\Grand Theft Auto IV\flight_mod_dingbat2k.asi, Address 0x10000000Loading ASI J:\Rockstar Games\Grand Theft Auto IV\SampleCustom.asiASI loaded : J:\Rockstar Games\Grand Theft Auto IV\SampleCustom.asi, Address 0x03310000Loading ASI J:\Rockstar Games\Grand Theft Auto IV\SampleCustomFiber.asiASI loaded : J:\Rockstar Games\Grand Theft Auto IV\SampleCustomFiber.asi, Address 0x00000000

 

 

So the SampleCustomFiber.asi is always loaded at 0x00000000 unlike other ASI And I think the content of SampleCustomFiber.asi is never executed why? I don't know.Any idea?

Link to comment
Share on other sites

Hm, stuff i compile with 0.2 get loaded at 0x00000000 in AsiLog.txt. With Debug and Release Build... Even CustomSampleFiber.asi...

 

Edit: just like above.

Link to comment
Share on other sites

Thank you klanly.

But he don't work for me. I will try to find what, in my GTA4 folder, can interact with the ASI loader or ASI file.

Link to comment
Share on other sites

here's mine... complied by default and it works in my gta4.

 

http://rapidshare.com/files/182096828/Samp...mFiber.rar.html

Wierd my filesize is different...

 

Out of the box compile

 

Release build:

SampleCustomFiber.dll : 110 KB (113.152 bytes)

 

Debug build:

SampleCustomFiber.dll : 98,0 KB (100.352 bytes)

 

Yours is 105 KB (107.520 bytes)

Link to comment
Share on other sites

If the load address is 0x00000000, that usually means an exception occurred while loading the dll... what I would do in this case is start commenting out stuff from Main.cpp until it gives a non-zero address. Maybe its the Log::AddLogger, or maybe its ScriptHookManager::Initialize or ScriptHookManager::RegisterThread.... or maybe its even the static CustomFiberThread declaration.

Link to comment
Share on other sites

 

Thank you klanly.

But he don't work for me. I will try to find what, in my GTA4 folder, can interact with the ASI loader or ASI file.

I'm a newbie to C and its complier... biggrin.gif

I load it in dependency-walker and found it needs msvcr90D, may this help? blush.gif

 

@Intosia

I just complied it with my newly installed vc2008.. maybe it's a debug version

Edited by klanly
Link to comment
Share on other sites

By starting the game with GTAIV.exe directly in my GTA 4 folder(not with the launcher) I have an error : IsThreadAFiber is not found in kernel32.dll

 

So I search IsThreadAFiber with google and I find this :

Minimum supported client	Windows Vista 

 

(http://msdn.microsoft.com/en-us/library/ms684131(VS.85).aspx)

 

I have Windows XP and I wonder if this is not the cause of my problem.

 

Link to comment
Share on other sites

By starting the game with GTAIV.exe directly in my GTA 4 folder(not with the launcher) I have an error : IsThreadAFiber is not found in kernel32.dll

 

So I search IsThreadAFiber with google and I find this :

Minimum supported client	Windows Vista 

 

(http://msdn.microsoft.com/en-us/library/ms684131(VS.85).aspx)

 

I have Windows XP and I wonder if this is not the cause of my problem.

Yep, that would be it. sad.gif

Link to comment
Share on other sites

 

If the load address is 0x00000000, that usually means an exception occurred while loading the dll... what I would do in this case is start commenting out stuff from Main.cpp until it gives a non-zero address. Maybe its the Log::AddLogger, or maybe its ScriptHookManager::Initialize or  ScriptHookManager::RegisterThread.... or maybe its even the static CustomFiberThread declaration.

Even with this i get 0x0000000

 

       case DLL_PROCESS_ATTACH:        { 	// Initialize loggers 	//Log::AddLogger( LoggerODS::GetInstance() ); 	//Log::AddLogger( LoggerFile::GetInstance() ); 	// Initialize the script hook manager and register threads 	//ScriptHookManager::Initialize(); 	//ScriptHookManager::RegisterThread( &_customThread );           break;       }

 

 

EDIT: Even you're dll dont work (Aru). Damn this is annoying!

Link to comment
Share on other sites

By starting the game with GTAIV.exe directly in my GTA 4 folder(not with the launcher) I have an error : IsThreadAFiber is not found in kernel32.dll

 

So I search IsThreadAFiber with google and I find this :

Minimum supported client	Windows Vista 

 

(http://msdn.microsoft.com/en-us/library/ms684131(VS.85).aspx)

 

I have Windows XP and I wonder if this is not the cause of my problem.

Yep, that would be it. sad.gif

Aaah your sh*ttin' me right? wow.gif I hate Vista tounge.gif No way thats comming on my system tounge.gif

Link to comment
Share on other sites

GAK/Intosia.. try this...

 

Open ScriptHook\NativeFiberThread.cpp... Find:

 

 

if (IsThreadAFiber())

 

 

Replace it with:

 

 

if (!IsBadReadPtr(GetCurrentFiber(), sizeof(ptr)))

 

 

 

Link to comment
Share on other sites

GAK/Intosia.. try this...

 

Open ScriptHook\NativeFiberThread.cpp... Find:

 

 

if (IsThreadAFiber())

 

 

Replace it with:

 

 

if (!IsBadReadPtr(GetCurrentFiber(), sizeof(ptr)))

 

Wel i dont get the Kernel error. And i get loaded at Address 0x10000000 biggrin.gif So i guess that works biggrin.gif

Link to comment
Share on other sites

 

GAK/Intosia.. try this...

 

Open ScriptHook\NativeFiberThread.cpp... Find:

 

 

if (IsThreadAFiber())

 

 

Replace it with:

 

 

if (!IsBadReadPtr(GetCurrentFiber(), sizeof(ptr)))

 

Perfect! thank you very much aru. its works very well.

Edited by GAK
Link to comment
Share on other sites

@Aru, amazing, not only this great hook, but also the quick and efficient support you're offering via this thread.

 

Thanks !

 

 

 

 

Link to comment
Share on other sites

Ok how can i check if a function return a usefull value?

 

I have this:

 

 	closeCar = GetClosestCar(x,y,z,50,false,70); 	if(closeCar != 0) 	{   //LogInfo(closeCar)   Cars.push_back(closeCar); 	}

 

 

But i get this error:

 

error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'Scripting::Vehicle'ORerror C2676: binary '>' : 'Scripting::Vehicle' does not define this operator or 

 

Link to comment
Share on other sites

You should use

closeCar.Handle != 0

 

because the Vehicle is a struct with 1 variable I think aru want to add more variables later because the Handle is simply a u32

Link to comment
Share on other sites

You should use
closeCar.Handle != 0

 

because the Vehicle is a struct with 1 variable I think aru want to add more variables later because the Handle is simply a u32

Thanks, helped me out ALOT biggrin.gif

Link to comment
Share on other sites

does that means no annoying dlls to join my mods?

 

coz if so ill recomplie all my mods in this baby!

This stuff is tha sh*t, way better/faster/stable then LUA smile.gif Builds a ASI file.

Link to comment
Share on other sites

Ok dont know if this is the right place to ask, but do it anyway.

 

If if i get the coords from a car, the X is way more different then my X.

 

[iNFO] Searching car at player coords 592.643188, 1373.206421, 11.272066[iNFO]  - Found Car (2602)[iNFO]  - Car coords 11.338131, 1367.277954, 11.272066

 

 

Altough the car is standing next to me?

 

My code:

http://pastebin.com/mc5d977a

Link to comment
Share on other sites

I think its because the coords of a car is the "center" of the car, you can see this with the example of aru when the car spawn you are on the center.

 

The center of a player and the center of a car is different because the car is much larger.

 

EDIT : and I think we should create a post for help in C++ hook^^

Link to comment
Share on other sites

 

I think its because the coords of a car is the "center" of the car, you can see this with the example of aru when the car spawn you are on the center.

 

The center of a player and the center of a car is different because the car is much larger.

 

EDIT : and I think we should create a post for help in C++ hook^^

Ok, but it cant have a difference of almost 600? Even if the coords are in the front or center or back of the car. 600 is to much... Thats almost the otherside of the map(?)

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.