void cheat_handle_coordmaster()
{
static int time=0;
if(cheat_state->_generic.coordmaster == 1) {
if(GetTickCount()-set.coord_time > time) {
if (*(int *)0xBA6774 != 0)
{
float mapPos[3];
for ( int i = 0; i < (0xAF * 0x28); i += 0x28 )
{
if ( *(short *)(0xBA873D + i) == 4611 )
{
GTAfunc_TogglePlayerControllable(1);
GTAfunc_LockActor(1);
float *pos = (float *)( 0xBA86F8 + 0x28 + i );
gta_interior_id_set( 0 );
mapPos[0] = *pos;
mapPos[1] = *( pos + 1 );
mapPos[2] = pGameInterface->GetWorld()->FindGroundZForPosition( mapPos[0], mapPos[1] ) + 2.0f;
float cpos[3] = {pPedSelf->GetPosition()->fX,pPedSelf->GetPosition()->fY,pPedSelf->GetPosition()->fZ};
char opa=0;
if(cpos[0] > mapPos[0]) {
if(cpos[0]-mapPos[0] > set.coord_distance) cpos[0] -= set.coord_distance;
else {
cpos[0] = mapPos[0];
opa++;
}
} else {
if(mapPos[0]-cpos[0] > set.coord_distance) cpos[0] += set.coord_distance;
else {
cpos[0] = mapPos[0];
opa++;
}
}
if(cpos[1] > mapPos[1]) {
if(cpos[1]-mapPos[1] > set.coord_distance) cpos[1] -= set.coord_distance;
else {
cpos[1] = mapPos[1];
opa++;
}
} else {
if(mapPos[1]-cpos[1] > set.coord_distance) cpos[1] += set.coord_distance;
else {
cpos[1] = mapPos[1];
opa++;
}
}
if(opa == 2) {
cpos[2] = mapPos[2];
cheat_state->_generic.coordmaster = 0;
GTAfunc_TogglePlayerControllable(0);
GTAfunc_LockActor(0);
}
else cpos[2] = pGameInterface->GetWorld()->FindGroundZForPosition( cpos[0], cpos[1] )-20;
cheat_teleport(cpos,0);
}
}
} else {
addMessageToChatWindow("Поставьте метку на карте!");
cheat_state->_generic.coordmaster = 0;
}
time = GetTickCount();
}
}
return;
}