 |
|

08.05.2013, 23:20
|
|
Постоянный
Регистрация: 19.03.2013
Сообщений: 586
С нами:
6920791
Репутация:
113
|
|
Всем привет, и это урок по добавлению в sobeit CarShot aka CarDrive
В samp.cpp
Код:
Код:
if (cheat_state->_generic.cardrive == 1)
{
struct actor_info *self = actor_info_get(-1, ACTOR_ALIVE);
struct vehicle_info *info = vehicle_info_get( -1, 0 );
if (info != NULL)
{
self->fCurrentRotation = -pGame->GetCamera()->GetCameraRotation();
self->fTargetRotation = self->fCurrentRotation;
info->base.matrix[4] = sinf(-self->fCurrentRotation);
info->base.matrix[5] = cosf(-self->fCurrentRotation);
if (KEY_DOWN('W')) ///W для езды вперед
{
info->speed[0] = sinf(-self->fCurrentRotation) * 0.8; ///0.8 скорость
info->speed[1] = cosf(-self->fCurrentRotation) * 0.8;
}
if (KEY_DOWN('S'))///S для езды назад
{
info->speed[0] = sinf(-self->fCurrentRotation) * -0.5;
info->speed[1] = cosf(-self->fCurrentRotation) * -0.5;
}
if (KEY_DOWN(0x20))//Space для взлета
{
info->speed[2] += 0.05;
}
if (KEY_DOWN(0xA2))///LCtrl для приземления
{
info->speed[2] -= 0.05;
}
if (KEY_DOWN(0xA0))//LShift для торможения
{
info->speed[0] = 0.0;
info->speed[1] = 0.0;
}
}
}
В cheat_generic.cpp
Код:
Код:
void cheat_handle_cardrive()
{
traceLastFunc( "cheat_handle_cardrive()" );
if (cheat_state->_generic.cardrive == 1)
{
return;
}
}
В cheat.h ко всем generic
Код:
Теперь в cheat_vehicle.cpp
Находим
Код:
Код:
void cheat_handle_vehicle_unflip ( struct vehicle_info *info, float time_diff )
Удаляем весь это-т void и ставим место него вот это-т код
Код:
Код:
void cheat_handle_vehicle_unflip ( struct vehicle_info *info, float time_diff )
{
traceLastFunc( "cheat_handle_vehicle_unflip()" );
if ( KEY_DOWN(set.key_unflip) || cheat_state->_generic.cardrive == 1 && cheat_state->state == CHEAT_STATE_VEHICLE )
{
struct vehicle_info *info = vehicle_info_get( VEHICLE_SELF, NULL );
struct actor_info *self = actor_info_get(ACTOR_SELF, ACTOR_ALIVE);
self->fCurrentRotation = -pGame->GetCamera()->GetCameraRotation();
self->fTargetRotation = self->fCurrentRotation;
traceLastFunc( "cheat_handle_vehicle_unflip()" );
float fTimeStep = *(float *)0xB7CB5C;
CVehicle *cveh = getSelfCVehicle();
CVector cvehGrav;
CMatrix cvehMatrix;
cveh->GetGravity( &cvehGrav );
cveh->GetMatrix( &cvehMatrix );
CVector rotationAxis = cheat_vehicle_getPositionUnder( cveh );
cvehGrav.Normalize();
rotationAxis.Normalize();
float theta = acos( rotationAxis.DotProduct(&cvehGrav) );
if ( !near_zero(theta) )
{
rotationAxis.CrossProduct( &cvehGrav );
rotationAxis.Normalize();
rotationAxis.ZeroNearZero();
cvehMatrix = cvehMatrix.Rotate( &rotationAxis, -theta );
}
theta = M_PI / ( 75.0f / fTimeStep );
CVector slowTurnAxis = cvehMatrix.vUp;
slowTurnAxis.Normalize();
slowTurnAxis.ZeroNearZero();
cvehMatrix = cvehMatrix.Rotate( &cvehMatrix.vUp, theta );
cveh->SetMatrix( &cvehMatrix );
CVector vZero ( 0.0f, 0.0f, 0.0f );
cveh->SetTurnSpeed( &vZero );
info->base.matrix[4] = sinf(-self->fCurrentRotation);
info->base.matrix[5] = cosf(-self->fCurrentRotation);
}
}
Теперь в new_menu.cpp
Код:
Код:
TwAddVarRW(twBar_SPNewCheats, "Car Drive", TW_TYPE_BOOLCPP, &cheat_state->_generic.cardrive, " label='Car Drive' group='WithCar' ");
С вами был Jesus, огромное спасибо FYP, EnD1ZeR,Cico, Могайка, MISTER_GONWIKСпециально для сайта BlastHack.Net
При копировании указывать источникBlastHack.Net
|
|
|

09.05.2013, 00:17
|
|
Участник форума
Регистрация: 20.03.2013
Сообщений: 188
С нами:
6919241
Репутация:
93
|
|
Давай еще 
|
|
|

09.05.2013, 01:22
|
|
Постоянный
Регистрация: 19.03.2013
Сообщений: 586
С нами:
6920791
Репутация:
113
|
|
Сообщение от includelow
Давай еще
жди скоро будут новые уроки
|
|
|

09.05.2013, 02:13
|
|
Участник форума
Регистрация: 19.03.2013
Сообщений: 188
С нами:
6921707
Репутация:
0
|
|
збс, продолжай!
|
|
|

09.05.2013, 08:19
|
|
Познающий
Регистрация: 31.03.2013
Сообщений: 92
С нами:
6903095
Репутация:
0
|
|
if (KEY_DOWN('S'))///S для езды вперед
мне кажется ты ошибся
|
|
|

09.05.2013, 08:30
|
|
Постоянный
Регистрация: 19.03.2013
Сообщений: 586
С нами:
6920791
Репутация:
113
|
|
Сообщение от Skel
if (KEY_DOWN('S'))///S для езды вперед
мне кажется ты ошибся
да действительно описался, исправил
|
|
|

09.05.2013, 09:59
|
|
Познающий
Регистрация: 18.03.2013
Сообщений: 54
С нами:
6921812
Репутация:
73
|
|
Классно классно!!!!!!!1!11!1!!1
|
|
|

09.05.2013, 10:12
|
|
Познающий
Регистрация: 31.03.2013
Сообщений: 84
С нами:
6903092
Репутация:
58
|
|
чо он такой балшой у меня он поменше и управляетса тока мышкой:trollface:
|
|
|

09.05.2013, 10:34
|
|
Участник форума
Регистрация: 29.04.2013
Сообщений: 141
С нами:
6861401
Репутация:
0
|
|
Класс однозначно +
|
|
|

09.05.2013, 10:44
|
|
Участник форума
Регистрация: 29.04.2013
Сообщений: 141
С нами:
6861401
Репутация:
0
|
|
а как + дать? xD
self->fCurrentRotation = -pGame->GetCamera()->GetCameraRotation();
self->fTargetRotation = self->fCurrentRotation;
Вот эта часть кода звучит так ?
Проверяем куда смотрит камера и разворачиваем машину в сторону куда смотрит камера так?
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|