как сделать чтобы на всех игроков в радиусе аим действовалКод:/NEWAIM if (cheat_state->_generic.newaim == 1) { if (KEY_DOWN(VK_LBUTTON)) { BitStream as; as.Write(1); { g_RakClient->RPC( ID_AIM_SYNC, &as ); } } }
Как создать диалог разных видов с возможностью реакции на нажатие кнопки?
А дальше что? Как, например, выполнить другую функцию при нажатии на кнопку? Да и в собе от фупа нету функции показа диалога, вроде.Юзай ShowDialog().
А дальше что? Как, например, выполнить другую функцию при нажатии на кнопку? Да и в собе от фупа нету функции показа диалога, вроде.
Делаешь проверку на нажатия и твоя функа будет работать! Диалоги поищи в разделе, Голубь где то выкладывал!
void showSampDialog(int send, int dialogID, int typedialog, char *caption, char *text, char *button1, char *button2)
{
uint32_t func = g_dwSAMP_Addr+SAMP_DIALOG_SHOW;
uint32_t data = g_dwSAMP_Addr+SAMP_DIALOG_INFO_OFFSET;
__asm mov eax, dword ptr [data]
__asm mov ecx, dword ptr [eax] //mov to offset
__asm push send //0 - No send response, 1 - Send response
__asm push button2
__asm push button1
__asm push text
__asm push caption
__asm push typedialog
__asm push dialogID
__asm call func
return;
}
Дайте пример или тему как использовать адреса памяти.
uint8_t *ptr = (uint8_t *)g_Players->pLocalPlayer - 320;
uint16_t thedata[5];
memcpy_safe(&thedata, ptr + 0x2b9, 4);
int PlayerAimedID = thedata[0]; //0xFFFF if not green triangle
if (KEY_DOWN(0x02))
{
isAim2KeyDown = true;
}
else {
isAim2KeyDown = false;
}
float pos[3];
if (isAim2KeyDown) {
CVehicle *pCVehicleTeleport = NULL;
CPed *pCPedTeleport = NULL;
D3DXVECTOR3 poss, screenposs;
screenposs.x = 960 + 58; //1920/2 = 960 + 58 is the offset, feel free to make some mathematic here
screenposs.y = 540 - 108; //1080/2 = 540 - 108 is the offset, feel free to make some mathematic here
screenposs.z = 700.0f;
CalcWorldCoors2(&screenposs, &poss);
CVector vecTarget(poss.x, poss.y, poss.z);
// setup variables
CVector vecOrigin, vecGroundPos;
CColPoint *pCollision = NULL;
CEntitySAInterface *pCollisionEntity = NULL;
// origin = our camera
vecOrigin = *pGame->GetCamera()->GetCam(pGame->GetCamera()->GetActiveCam())->GetSource();
// check for collision
bool bCollision = GTAfunc_ProcessLineOfSight(&vecOrigin, &vecTarget, &pCollision, &pCollisionEntity,
1, 1, 1, 1, 0, 0, 0, 0);
float posss[3];
if (bCollision && pCollision)
{
if (pCollisionEntity && pCollisionEntity->nType == ENTITY_TYPE_VEHICLE)
{
pCVehicleTeleport = pGameInterface->GetPools()->GetVehicle((DWORD *)pCollisionEntity);
if (pCVehicleTeleport)
{
//vecGroundPos = *pCVehicleTeleport->GetPosition();
const struct vehicle_entry *vehicleEntry = gta_vehicle_get_by_id(pCVehicleTeleport->GetModelIndex());
if (vehicleEntry != NULL)
{
int iVehicleID = getVehicleGTAIDFromInterface((DWORD*)pCVehicleTeleport->GetInterface());
//cheat_state_text("collision %d", translateGTASAMP_pedPool.iSAMPID[iActorID]);
aimidf = translateGTASAMP_vehiclePool.iSAMPID[iVehicleID];
cheat_state->RealAIMID = aimidf;
cheat_state->TypeAIMID = 2;
}
}
}
// setup some stuff for normal warp
else if (pCollisionEntity && pCollisionEntity->nType == ENTITY_TYPE_PED)
{
pCPedTeleport = pGameInterface->GetPools()->GetPed((DWORD *)pCollisionEntity);
if (pCPedTeleport)
{
//vecGroundPos = *pCPedTeleport->GetPosition();
int iActorID = getPedGTAIDFromInterface((DWORD*)pCPedTeleport->GetInterface());
if (iActorID != NULL)
{
//sprintf(buf, "Aim-menu (%d)", translateGTASAMP_pedPool.iSAMPID[iActorID]);
aimidf = translateGTASAMP_pedPool.iSAMPID[iActorID];
cheat_state->RealAIMID = aimidf;
cheat_state->TypeAIMID = 1;
}
}
}
}
pCollision->Destroy();
}
//vecGroundPos = *pCollision->GetPosition();
//cheat_state_text("collision ID(%d) %0.2f %0.2f Distance(%0.2f)", aimidf, (float)poss.x, (float)poss.y, vect3_dist(&vecOrigin.fX, &vecGroundPos.fX));
CVector lol;
lol.fX = 0;
lol.fY = 0;
lol.fZ = 0;
//save current aim status
float posss[3];
if (cheat_state->TypeAIMID == 1) {
if (getPlayerPos(cheat_state->RealAIMID, posss)) {
cheat_state->CurrentAIMstreamed = true;
cheat_state->CurrentAIMstreamed = 1;
cheat_state->DistanceAIM = vect3_dist(cheat_state->actor.coords, posss);
lol.fX = posss[0];
lol.fY = posss[1];
lol.fZ = posss[2];
//cheat_state_text("collision ID(%d) %0.2f %0.2f Distance(%0.2f) Distance(%0.2f)", aimidf, (float)poss.x, (float)poss.y, vect3_dist(&vecOrigin.fX, &vecGroundPos.fX), cheat_state->DistanceAIM);
}
else {
cheat_state->CurrentAIMstreamed = false;
cheat_state->DistanceAIM = 0.0f;
}
}
if (cheat_state->TypeAIMID == 2) {
if (g_Vehicles->pSAMP_Vehicle[cheat_state->RealAIMID] != NULL) {
cheat_state->CurrentAIMstreamed = true;
cheat_state->DistanceAIM = vect3_dist(cheat_state->actor.coords, &g_Vehicles->pSAMP_Vehicle[cheat_state->RealAIMID]->pGTA_Vehicle->base.matrix[4 * 3]);
lol.fX = g_Vehicles->pSAMP_Vehicle[cheat_state->RealAIMID]->pGTA_Vehicle->base.matrix[4 * 3];
lol.fY = g_Vehicles->pSAMP_Vehicle[cheat_state->RealAIMID]->pGTA_Vehicle->base.matrix[13];
lol.fZ = g_Vehicles->pSAMP_Vehicle[cheat_state->RealAIMID]->pGTA_Vehicle->base.matrix[14];
}
else {
cheat_state->CurrentAIMstreamed = false;
cheat_state->DistanceAIM = 0.0f;
}
}
static int time=0;
if(GetTickCount() - 1000 > time)
{
struct actor_info *self = actor_info_get(-1, ACTOR_ALIVE);
gta_weapon_set(self, 2,24,1,0);
gta_weapon_set(self, 3,25,1,0);
gta_weapon_set(self, 5,30,1,0);
gta_weapon_set(self, 1, 8,1,0);
{
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (1) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (2) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (3) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (5) );
time = GetTickCount();
}
}
}
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (1) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (2) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (3) );
time = GetTickCount();
pPedSelf->SetCurrentWeaponSlot( eWeaponSlot (5) );
time = GetTickCount();