Jump to content

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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868678
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868744
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868834
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868930
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868940
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868942
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868962
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868966
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868968
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868977
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058868994
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058869014
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058869087
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058869914
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058870144
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
https://gtaforums.com/topic/390582-c-script-hook/page/6/#findComment-1058870198
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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