Jump to content

Recommended Posts

^ You might have a lot more luck if you move scripthook.dll into the main GTAIV directory.

 

Unless you have an asi loader that does support loading asi's from the plugins directory (hint NOT dsound) it might help to move your script there too.

Edited by sjaak327
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059726920
Share on other sites

Well, I just got a x64 install of Win7 going.... going to need some time to figure this out, but its fairly odd that it worked just fine in Vista x64.

 

Please do Aru, I have many ideas for mods involving globals and for now im stuck.

I succesfully used Game::GetBase() In a script but using Game::GetGlobalAddress() and derivatives seems to always crash me on Win 7 x64.

 

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059727758
Share on other sites

MadthatModsareDisabled

Hi everyone,

 

I've been enjoying using my newly written trailer in MP (thanks to all your help of course) colgate.gif

 

Does anyone know how to use this function to get water levels changed?

 

Here's what I've been working on:

 

 

void CustomFiberThread::WaterLevelAdjustment(){//f32 x, y, z;//f32 xoff, yoff, zoff;//Ped ped = GetPlayerPed();//if (IsCharInWater(GetPlayerPed()))//{ //GetCharCoordinates(ped, &x, &y, &z); //GetOffsetFromCharInWorldCoords(ped, X, Y, Z, &xoff, &yoff, &zoff); waterLevel -=1; // point at current object to be seen (increments backward) if (waterLevel <  -9999999) //12 { 	waterLevel = 1; // 1 }//}// //Water water;// GetWaterHeight (x,y,z,par1, par2, par3, par4, par5, par6); // 5,8,9,13 par5 (<4 hides water, 5 vis water w/height waves, 8/9 - water invisible, 13 vis water w/no waves GetWaterHeightNoWaves(5 - waterLevel, 2000, 17 + waterLevel, 2000);GetWaterHeight(5 - waterLevel, 2000, 15 + waterLevel, waterMode);//GetWaterHeight(waterMode , 3000 - waterLevel, -3000 - waterLevel,  waterLevel);//GetWaterHeight(waterMode , 3000 - waterLevel, -3000 - waterLevel,  waterLevel);//GetWaterHeightNoWaves(ped, 3000 - waterLevel, -3000 - waterLevel,  waterLevel);sprintf_s(mes1, 300,"Changing the water height: %i, %i, %i, %i" , 5 - waterLevel, 2000, 17 + waterLevel, waterMode);PrintStringWithLiteralStringNow("STRING", mes1, 9500, 1);}

 

 

You will probably noticed all the comments (//). I was testing a whole lot of things and could never get the friggin thing to work. suicidal.gif

 

Oh well this is only one of the minor problems with the new patch.

 

If anybody has figured this out using the Script Hook (other than modifying the water.dat file) let me know.

 

Also has anybody ever figured out ApplyForcetoCar and ApplyForcetoPed natives? Never got those working either. Just curious.

 

Thanks! biggrin.gif

Edited by MadthatModsareDisabled
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059732348
Share on other sites

You should check for the exsistance of an object ped or vehicle before trying to use a command on it.

 

 

if(DoesVehicleExist(mycar)){    // u could do some car command here e.g   SetVehAlarm(mycar, true);}

 

 

 

When it dirves away it probably deletes its self so mycar is nolonger valid.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059733494
Share on other sites

 

Log start: Wed Jan 13 15:54:09 2010-----------------------------------------------[iNFO] GTA IV Script Hook 0.4.0 - © 2009, Aru - Initialized[iNFO] Process base address: 0xe60000[iNFO] Auto detecting game version[iNFO] Using game version 1.0.4[iNFO] [CustomThread] Thread started[iNFO] [bodyguard] Thread started[iNFO] [CarBomb] Thread started[iNFO] [FirstPerson] Thread started[iNFO] [CustomThread] Thread started[iNFO] [CustomThread] Thread started[iNFO] [PlayerSelector] Thread started[iNFO] [CustomFiberThread] Thread started[iNFO] [RideAlong] Thread started[iNFO] [DXHook] Thread started[iNFO] [CustomFiberThread] Thread started[iNFO] [TouchOfDeath] Thread started[iNFO] [WinampIV] Thread started[iNFO] [CustomThread] Thread started[WARN] [WinampIV] Thread instance is being deleted while still hooked[iNFO] [WinampIV] Thread killed[WARN] [TouchOfDeath] Thread instance is being deleted while still hooked[iNFO] [TouchOfDeath] Thread killed[WARN] [CustomFiberThread] Thread instance is being deleted while still hooked[iNFO] [CustomFiberThread] Thread killed[WARN] [DXHook] Thread instance is being deleted while still hooked[iNFO] [DXHook] Thread killed[WARN] [RideAlong] Thread instance is being deleted while still hooked[iNFO] [RideAlong] Thread killed[WARN] [CustomFiberThread] Thread instance is being deleted while still hooked[iNFO] [CustomFiberThread] Thread killed[WARN] [PlayerSelector] Thread instance is being deleted while still hooked[iNFO] [PlayerSelector] Thread killed[WARN] [CustomThread] Thread instance is being deleted while still hooked[iNFO] [CustomThread] Thread killed[WARN] [CustomThread] Thread instance is being deleted while still hooked[iNFO] [CustomThread] Thread killed[WARN] [FirstPerson] Thread instance is being deleted while still hooked[iNFO] [FirstPerson] Thread killed[WARN] [CarBomb] Thread instance is being deleted while still hooked[iNFO] [CarBomb] Thread killed[WARN] [bodyguard] Thread instance is being deleted while still hooked[iNFO] [bodyguard] Thread killed[WARN] [CustomThread] Thread instance is being deleted while still hooked[iNFO] [CustomThread] Thread killed[iNFO] Script Hook - Shutdown

 

 

I'm going to try and find the old scripthook i had and see it it works

 

Edit: I was originally using scripthook 2.6.0 but replaced it with this new one so i can use police pursuit mod, and now I'm getting all these errors that are killing my game, So Can someone help me get that older version of the scripthook? Cus the new one crashes all the time for me

 

Edit: Found the older scripthook, My games working again, so 0.4.0 or w.e. is weird for vista 64 unless its comflicting with something else i have in the folder? shrug

Edited by Josheh
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059733821
Share on other sites

Hey

I have a problem.

Im programmed a .net script with the scripthook 0.3. In the Gta IV directory is the dsound.dll, scripthook.dll, trainer.asi and filecheckfix.asi.

In the folder scripts is the .net script.

When i start gta the .net script doesnt work? Nothing happened, no console and so on. But the trainer.asi works.

Where is the problem? Its gta IV 1.0.0.4 (5#patch) and the scripthook.dll is from aru (c++)

user posted image

 

Sry for my bad english sad.gif

 

cfw

 

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059739771
Share on other sites

Hey there. I wrote a Lua script to output all the functions and their arguments from Scripting.h in a Php array format, and put it up on a website, added some funky searching and styling and this is the result:

 

http://errur.com/GTAIV/Search.php

 

Hope you'll find it useful. If you have any suggestions just put 'em up here and I'll look into it smile.gif

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059744975
Share on other sites

Hey guys I get heaps of error when I build this script.

CustomFiberThread.h

 

#pragma once#include "../ScriptHook/ScriptThread.h"#include "../ScriptHook/ScriptingEnums.h"#include "../ScriptHook/ScriptingTypes.h"class CustomFiberThread : public ScriptThread{private:Scripting::Player GetPlayer();Scripting::Ped GetPlayerPed();Scripting::Vehicle closestCar;protected:   // We don't want a Tick based script, so we override RunScript.void RunScript();public:CustomFiberThread();};

 

 

CustomFiberthread.cpp

 

#include "CustomFiberThread.h"#include "Scripting.h"#include "../ScriptHook/Log.h"#include <windows.h>// Pull in all our scripting functions/typesusing namespace Scripting;CustomFiberThread::CustomFiberThread(){   // Give your own name here!SetName("Stop");}// Some helper functionsPlayer CustomFiberThread::GetPlayer(){Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());return playerIndex;}Scripting::Ped CustomFiberThread::GetPlayerPed(){Ped ped;GetPlayerChar(GetPlayer(), &ped);return ped;}void CustomFiberThread::RunScript(){// This is a fiber thread, so we use an loop to run the contents of this script.// The thread will terminate when we return from this function.while(IsThreadAlive()){       if ((GetAsyncKeyState(VK_F4) & 1) != 0)       {           LogInfo("Stopping car");        	f32 x,y,z; 	GetCharCoordinates(GetPlayerPed(), &x, &y, &z); 	closestCar = GetClosestCar(x, y, z, 50.0f, 0, 70): 	if(DoesVehicleExist(closestCar)) {   ExplodeCar(closestCar 1, 0);   MarkCarAsNoLongerNeeded(&closestCar): 	} } // Call Wait () so we can process other game scripts/game code // You must call Wait(...) in your loop code for a fiber thread! Wait(100);}}

 

 

 

LOG

 

Compiling...CustomFiberThread.cppc:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(47) : error C2668: 'Scripting::GetClosestCar' : ambiguous call to overloaded function       c:\users\noel\desktop\gtaiv\downloads\scripthook\scripthook\scripting.h(758): could be 'Scripting::Vehicle Scripting::GetClosestCar(f32,f32,f32,f32,b8,u32)'       c:\users\noel\desktop\gtaiv\downloads\scripthook\scripthook\scripting.h(457): or       'Scripting::Vehicle Scripting::GetClosestCar(f32,f32,f32,f32,u32,u32)'       while trying to match the argument list '(f32, f32, f32, float, int, int)'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(47) : error C2143: syntax error : missing ';' before ':'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(47) : error C2143: syntax error : missing ';' before ':'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(48) : error C2143: syntax error : missing ';' before '{'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(49) : error C2143: syntax error : missing ')' before 'constant'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(49) : error C2660: 'Scripting::ExplodeCar' : function does not take 1 argumentsc:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(49) : error C2059: syntax error : ')'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(50) : error C2143: syntax error : missing ';' before ':'c:\users\noel\desktop\gtaiv\downloads\scripthook\samplecustomfiber\customfiberthread.cpp(50) : error C2143: syntax error : missing ';' before ':'Main.cppGenerating Code...Results   Build log was saved at "file://c:\Users\Noel\Desktop\GTAIV\downloads\scripthook\SampleCustomFiber\Debug\BuildLog.htm"SampleCustomFiber - 9 error(s), 0 warning(s)

 

 

Please help. this is my first C++ script.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059745097
Share on other sites

 

closestCar = GetClosestCar(x, y, z, 50.0f, 0, 70):

 

 

See that line there? ^ You used a colon instead of semi-colon at the end. wink.gif (Probably still inadvertently had the shift key down when typing the parenthesis... happens to all of us.)

 

Edit:

 

 

MarkCarAsNoLongerNeeded(&closestCar):

 

 

^ You did it there, too, probably for the same reason. smile.gif

Edited by Zach
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059745295
Share on other sites

  • 2 weeks later...

Hi everyone, i am having a bit of troubles with running this when i go to play multiplayer, I have GTA 4 Patch 5 (1.0.0.4/1.0.5.0) and latest scripthook, it works fine in singleplayer but when I try to use multiplayer I get "The connection to LIVE was lost. Returning to singleplayer." (Tested on LAN Free Mode) but if I remove scripthook.dll multiplayer works with no errors. I am also using the file check fix so if it is supposed to be blocked i should be able to use it.

Any ideas on how i can get it working?

 

Edit: I am using Windows 7 x64.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059759279
Share on other sites

Why you play with 1.0.0.0 version ? that_guy2057_evilgrin.gifthat_guy2057_evilgrin.gifthat_guy2057_evilgrin.gif

What's utility for you ? that_guy2057_evilgrin.gifthat_guy2057_evilgrin.gifthat_guy2057_evilgrin.gif

Do an update of your games, or use an old version of scripthook. That's all. rolleyes.gifrolleyes.gifrolleyes.gif

I did an update for GTA IV v1.0.0.0. to v1.0.1.0. but it crashed my game!!!!

I Reinstalled the game and then i have the same game crash!!!!

I Reinstalled it again and it was fixed!!!!

I will Never do it again!!!!

Installing the GTA IV takes 40 minutes!!!!

nervous.gif

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059777199
Share on other sites

Hi

 

I loved this trainer, but recently upgraded from windows 7 (beta) to retail and installed gta 4 but now when i try and run the game its asking to update Games For Windows and the trainer wont work.

 

Ive tried by passing this using xliveless and still when i hit F1 nothing happens (but the game running LaunchGTA seems laggy)

 

I had the latest patch (patch 5) before on 7 beta and it worked , i cant figure out why it wont work anymore.

 

Ive completely removed GTA4 and will do a clean install again and await any comments or help from others who have this trainer working with Windows 7 Ultimate 32-bit.

 

Thanks

 

Darren

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059784409
Share on other sites

I was wondering how would i get the current vehicle that your player is in?

That's easy:

 

 

Char c; 	Vehicle veh; 	u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId()); 	GetPlayerChar(playerIndex, &c);   if (IsCharSittingInAnyCar© == 1)   {   GetCarCharIsUsing(c,&veh);

 

 

When you want to do stuff later on with it, it doesn't hurt to do:

 

 

if ((veh.IsValid())&&(DoesVehicleExist(veh))){SetCarHealth(veh,1000);}

 

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059785571
Share on other sites

I'm having a bit of trouble with the dev-loader...

 

It's set up correctly. I start GTA. I get the message:

"Loading module myModName.asi"

"Starting Developer Menu Thread"

 

Etc.

 

But when I get in-game, my mod doesnt work. I press ALT+F12 to open up the Dev-Loader menu, but all I see is 'about', I can't 're-load' my mod...

 

EDIT:

Nevermind... Screwed up my mod. There was a

break;

missing

Edited by thaCURSEDpie
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059787085
Share on other sites

I'm having a bit of trouble with the dev-loader...

 

It's set up correctly. I start GTA. I get the message:

"Loading module myModName.asi"

"Starting Developer Menu Thread"

 

Etc.

 

But when I get in-game, my mod doesnt work. I press ALT+F12 to open up the Dev-Loader menu, but all I see is 'about', I can't 're-load' my mod...

 

EDIT:

Nevermind... Screwed up my mod. There was a

break;

missing

For me, devloader doesn't seem to work. My game won't start up after copying d3d9.dll in gta directory.

Anyone having the same issue? What I'm doing wrong?

 

Any help appreciated.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059787318
Share on other sites

I guess my game doesnt wanna work. i compile SampleCustom on release and transfer the ScriptHook.dll and SampleCustom.dll into my game directory and run it but it doesnt seem to work. I have other mods and a trainer that works, but not my mod.

u need to rename SampleCustom.dll to SampleCustom.asi !! and also u need the asi loader which is a dsound.dll

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059789336
Share on other sites

Hello,

 

Is there anyway to share Player, Vehicle, Object etc variables between ScriptThreads? I'm writing wrapper classes with all relevant functions to keep things tidy and I wanted to do so, but it seems that the variables are specific to the thread they are created on.

 

Thanks.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059801974
Share on other sites

MadthatModsareDisabled

Hello guys,

 

I have been actively hard at work innovating new features into my up and coming trainer. It was originally called Super Mega Trainer, but I realized somebody has used that name and I'll be forced to modify it before a public release.

 

Recently, I purchased an OEM version of Windows 7. Now while I contest that the graphics, adaptability, and ease of use are now more accessible, I cannot for the life of me get my trainer to become active in the GTA environment. I have utilized the same procedures for modding such as dsound.dll, FileCheckfix, etc with the latest editions that are available and have still failed.

 

I am also using the new native calls implemented by Aru, such as { return NativeInvoke::Invoke<NATIVE_IS_NETWORK_PLAYER_ACTIVE, ScriptVoid(xx, xx, xx) etc. Yet still I cannot launch my embedded trainer after the game has finished loading. One note of mention, my trainer was successful when I was using Vista. Now I have read somewhere that Vista is creating new memory conflicts with mods. Is there a solution or a work around to enable a mod using Script Hook features to become active in the game?

 

I address numerous amount of concepts here because I want to understand what has happened since the birth of Vista to it's predecessor, Windows 7. Has anyone here (notable mention to Aru and sjaak327) been able to defeat this new learning curve? confused.gif

 

Obviously by my title name you know I am a strong believer in keeping mods active. Because of the help of SneakyJanit0r I was able to accomplish this. Yet I pull for everyone else here as well when I continue to share my information among a vast audience. I am an engineer by choice and welcome others to walk the same programming path of learning how to mod, etc. So my bottom line question is what are we doing to bang heads with the game manufacturers to keep mods alive? Now I am aware that sjaak327 has defeated this shift with his Simple Native Trainer, which seems to work in Windows 7. How can we band together to create a Script Hook that can create more entertaining mods, keep noobs at bay, and keep open source mods a forever reality?

 

The only thing I noticed was when I examined the asilog log my trainer has not loaded successfully. Here's the line when it scanned my file.

 

ASI loaded : C:\Program Files (x86)\Rockstar Games\Grand Theft Auto IV\SampleCustomFiber.asi, Address 0x00000000

 

Therefore the 0's indicate that it has failed to occupy a hash address. I know this happened before, but I can't for the life of me understand what I am not doing. I even received a successful launch message when I first ran dsound.dll and know its active since it shows memory addresses for all the directX calls.

 

 

 

So in closing, I'm hoping that we can unite again under the weight of a new dynamic windows environment and protection schemes to keep mods active in the GTA IV (on all platforms) world. Thanks for listening.

 

Oh and my game name is StevorNtheHouse. smile.gif

 

PS: A peek at my Youtube channel.

 

 

 

This is when I had it running Windows Vista with patch 5.

Edited by MadthatModsareDisabled
Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059807775
Share on other sites

I went ahead and figured out what the codes are for the Xbox360 controller:

 

 

(goes in Scripting.h)

 

enum ePadButton   {               BUTTON_BACK = 0xD,               BUTTON_START = 0xC, BUTTON_X = 0xE, BUTTON_Y = 0xF, BUTTON_A = 0x10, BUTTON_B = 0x11, BUTTON_DPAD_UP = 0x8, BUTTON_DPAD_DOWN = 0x9, BUTTON_DPAD_LEFT = 0xA, BUTTON_DPAD_RIGHT = 0xB, BUTTON_TRIGGER_LEFT = 0x5, BUTTON_TRIGGER_RIGHT = 0x7, BUTTON_BUMPER_LEFT = 0x4, BUTTON_BUMPER_RIGHT = 0x6, BUTTON_STICK_LEFT = 0x12, BUTTON_STICK_RIGHT = 0x13     };

 

 

I don't know about the Guide button though.

Link to comment
https://gtaforums.com/topic/390582-c-script-hook/page/44/#findComment-1059813764
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
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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