[C++ mod_sa] Play_Sound

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
cheat_samp.cpp
Code:
typedef int(__thiscall *tPlaySound)(void* _this, int sound_id, float x, float y, float z);
tPlaySound SAMP_PlaySound;
void Play_Sound(int sound_id, float x, float y, float z)
{
    SAMP_PlaySound = reinterpret_cast<tPlaySound>((PVOID)(g_dwSAMP_Addr + 0xA20E0));
    SAMP_PlaySound(*(PVOID **)(g_dwSAMP_Addr + 0x2ACA3C), sound_id, x, y, z);
}
cheat_samp.h
Code:
void Play_Sound(int sound_id, float x, float y, float z);
USAGE:
Play_Sound(1057, 0, 0, 0);

0xA20E0 - 0.3DL
0x2ACA3C - 0.3DL SAMP_MISC_INFO
Thanks you pnx!
 
Last edited:

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
.. or you could skip searching/scanning for samp offsets and resort to native gta:sa functions.
The function to play audio is at gta_sa.exe + 507340
Function type is stdcall, first parmeter is int16 (soundid) and the second is a RwV3d pointer for the coordinates (which is a simple 3 float vector like CVector in mod_sa).
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
.. or you could skip searching/scanning for samp offsets and resort to native gta:sa functions.
The function to play audio is at gta_sa.exe + 507340
Function type is stdcall, first parmeter is int16 (soundid) and the second is a RwV3d pointer for the coordinates (which is a simple 3 float vector like CVector in mod_sa).
what I've published is a breakthrough that doesn't exist on the internet, really. I want to help others develop and I care about it. Together, we can share useful things to create something fantastic! If you shared your project glance_mod code, thousands of players would be grateful))
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
ok, 1 st published WORKING PERFECTLY snippet for mod_sa project.
 
Top