BlackHead1673 
 
 
Дата: Понедельник, 06.11.2023, 13:38:22 | Сообщение # 1   
  
 
Сообщений: 18
 
Репутация: 0  [ +/-  ]
 
 
Всем привет Прошу помочь с кодом :)
Код
public void OnPostThinkPost(int client){     if(IsValidClient(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2 && IsValidEntity(iModel[client]) && iModel[client] > 0){         static bool inuse[MAXPLAYERS+1];         if(!inuse[client] && GetClientButtons(client)&IN_USE){              inuse[client] = true;             int aim = GetAimTarget(client, 100.0);             if(aim > 0){                 char modelname[128]; GetEntPropString(aim, Prop_Data, "m_ModelName", modelname, 128);                 SetEntityModel(iModel[client], modelname);                 SetEntityModel(client, modelname);                 CheckSizeProp(client, aim);                   }         }         else if(inuse[client] && !(GetClientButtons(client)&IN_USE)) inuse[client] = false;         float pos[3]; GetClientAbsOrigin(client, pos);         float ang[3]; GetClientEyeAngles(client, ang); ang[0] = ang[2] = 0.0;         for(int x; x<3; x++)             pos[x] += PPos[x][client];         TeleportEntity(iModel[client], pos, ang, NULL_VECTOR);     } } stock void CheckSizeProp(int client, int aim){     float min[3]; GetEntPropVector(aim, Prop_Send, "m_vecMins", min);     float max[3]; GetEntPropVector(aim, Prop_Send, "m_vecMaxs", max);          PPos[0][client] = PPos[1][client] = PPos[2][client] = 0.0;     for(int i = 0; i < 2; i++){         if(((-min[i]) - max[i]) < -0.5){             PPos[i][client] = 0.0;             if(-min[i] < max[i])                 PPos[i][client] = -(((-min[i]) + max[i]) / 2);             else if(-min[i] > max[i])                 PPos[i][client] = ((-min[i]) + max[i]) / 2;         }     }     if(min[2] < -0.5){         PPos[2][client] = (-min[2]);     }     float pos[3]; GetClientAbsOrigin(client, pos);     for(int x; x<3; x++)         pos[x] += PPos[x][client];         TeleportEntity(iModel[client], pos, view_as<float>({0.0, 0.0, 0.0}), NULL_VECTOR);     float center[3];     float ent_pos[3]; GetEntPropVector(iModel[client], Prop_Send, "m_vecOrigin", ent_pos);     for(int x = 0; x < 2; x++)         center[x] = ((min[x] + max[x]) * 0.5) + ent_pos[x];      PrintToChat(client, "%.1f %.1f %.1f\n%.1f %.1f %.1f\n_________", center[0], center[1], center[2], pos[0], pos[1], pos[2]);     for(int x; x < 2; x++)         if(pos[x] != center[x])             PPos[x][client] += center[x] - pos[x]; }
 Суть в кода том, что когда игрок жмет Е на проп, он ставит себе модель выбранного пропа Проблема в том, что некоторые пропы имеют нулевую точку не там где надо, и из-за этого проп может врящаться не по оси игрока, а по своей где-то в стороне от игрока Я думал что можно попробовать найти центр пропа и соотнести с позицией игрока Потому как мне найти цетрр пропа относительно его размеров в мире?  
 
Гости не могут скачивать файлы