Немогу в исходнике найти код "Телепорт в ближайшое незанятое авто"
Нашёл код ТП каров к себе, но там ИД, это ИД в списке отображения а если нету такого ИД то вопще краш
Вот мой код:
Code
void cmd_tveh( char *param )
{
int vid = atoi(param);
struct actor_info *self = actor_info_get( ACTOR_SELF, ACTOR_ALIVE );
struct vehicle_info *info = vehicle_info_get(vid, VEHICLE_ALIVE | ((cheat_state->_generic.vehicles_freeze || !cheat_state->_generic.vehicles_warp_invert) ? 0 : VEHICLE_EMPTY) );
float pos[3];
if ( vect3_near_zero( &info->base.matrix[4 * 3]) )
{
cheat_state_text( "Vehicle does not exist." );
return;
}
if ( info != NULL && self != NULL )
{
if ( cheat_state->_generic.vehicles_warp_invert )
{
vect3_copy( &self->base.matrix[4 * 3], pos );
pos[0] += sinf( -self->fCurrentRotation ) * 5.0f;
pos[1] += cosf( -self->fCurrentRotation ) * 5.0f;
pos[2] += 0.5f;
cheat_vehicle_teleport( info, pos, gta_interior_id_get() );
matrix_identity( info->base.matrix );
vect3_copy( pos, &info->base.matrix[4 * 3] );
vect3_mult( info->speed, 0.0f, info->speed );
info->speed[2] = 0.05f;
vect3_mult( info->spin, 0.0f, info->spin );
}
else
{
vect3_copy( &info->base.matrix[4 * 3], pos );
pos[2] += 1.5f;
cheat_teleport( pos, info->base.interior_id );
}
}
else
{
if ( self == NULL )
{
cheat_state_text( "You are dead." );
}
else
{
if ( vehicle_info_get(vid, 0) == NULL )
cheat_state_text( "Vehicle not found." );
else if ( vehicle_info_get(vid, VEHICLE_ALIVE) == NULL )
cheat_state_text( "Vehicle is destroyed." );
}
}
return;
}
Как сделать ТП по ИД машины на сервере(который в /dl)