Closed ArranTuna closed 5 years ago
I think this also happens when driving too fast. Near players with grove street skins will also talk. Happen to me in MTASA v1.5.6-release-14370, can't confirm tho.
mickdermack said:
Ok, here's a variant using a hook which also prevents the girlfriend from complaining about a burning car, which I forgot in the last patch. Feedback, as always, appreciated.
Index: MTA10/multiplayer_sa/CMultiplayerSA.cpp
===================================================================
--- MTA10/multiplayer_sa/CMultiplayerSA.cpp (revision 6796)
+++ MTA10/multiplayer_sa/CMultiplayerSA.cpp (working copy)
@@ -288,6 +288,9 @@
#define HOOKPOS_CTaskSimplyGangDriveBy__ProcessPed 0x62D5A7
DWORD RETURN_CTaskSimplyGangDriveBy__ProcessPed = 0x62D5AC;
+#define HOOKPOS_CPed__Say 0x5EFFE0
+DWORD RETURN_CPed__Say = 0x5EFFE7;
+
CPed* pContextSwitchedPed = 0;
CVector vecCenterOfWorld;
FLOAT fFalseHeading;
@@ -500,6 +503,8 @@
void HOOK_CTaskSimpleGangDriveBy__ProcessPed();
+void HOOK_CPed__Say();
+
CMultiplayerSA::CMultiplayerSA()
{
// Unprotect all of the GTASA code at once and leave it that way
@@ -705,6 +710,9 @@
// CTaskSimpleGangDriveBy::ProcessPed hook for disabling certain animations
HookInstall(HOOKPOS_CTaskSimplyGangDriveBy__ProcessPed, (DWORD) HOOK_CTaskSimpleGangDriveBy__ProcessPed, 5);
+ // CPed::Say hook for disabling certain hardcoded lines.
+ HookInstall(HOOKPOS_CPed__Say, (DWORD) HOOK_CPed__Say, 7);
+
// Disable GTA setting g_bGotFocus to false when we minimize
MemSet ( (void *)ADDR_GotFocus, 0x90, pGameInterface->GetGameVersion () == VERSION_EU_10 ? 6 : 10 );
@@ -6584,3 +6592,65 @@
}
}
+
+int _cdecl IsAllowedToSay( int iId )
+{
+ int aBlocked[] = {
+ // Girlfriend complaining about collision
+ 0x1D,
+ // ... about running over peds
+ 0x24,
+ // ... about burning car
+ 0x21,
+ // ... about standing still
+ 0x27,
+ 0x29,
+ // ... about going too slow
+ 0x20,
+
+ // Grove street guys complaining about standing still
+ 0x1E,
+ // ... about going too fast
+ 0x1F,
+ };
+
+ for ( int i = 0; i < sizeof( aBlocked ) / sizeof( aBlocked[0] ); i++ )
+ {
+ if ( iId == aBlocked[i] )
+ {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+void _declspec(naked) HOOK_CPed__Say()
+{
+ _asm
+ {
+ // Push our caller-save-registers
+ push eax;
+ push ecx;
+ push edx;
+ // Push the ID
+ push dword ptr [esp+0x10];
+ call IsAllowedToSay;
+ add esp, 4;
+ test al, al;
+ // Pop our caller-save-registers
+ pop edx;
+ pop ecx;
+ pop eax;
+ // If allowed continue, else return.
+ jnz cont;
+ retn 0x18;
+
+cont:
+ // Replaced code
+ mov eax, dword ptr [esp+4];
+ test ax, ax;
+ jmp RETURN_CPed__Say;
+ }
+
+}
Above patch can be downloaded as a .patch file via mega.nz
I agree with @Cazomino05:
I don't know what to say about this really, it seems we are arbitrarily drawing a line what sounds to keep and get rid of
setPedVoice should be used if you want to get rid of this.
Therefore, /close
Describe the bug If you driveby using some Grove st skins, it can play GTA speech, like:
Same applies to CJ girlfriend skins sat in a car.
Screenshots https://www.youtube.com/watch?v=kNCpIWo5UbI
Additional context From https://bugs.mtasa.com/view.php?id=8448