Заказать игровой сервер Контакты (заказать плагин/исправить ошибки/другое) Поиск

[ вход ]
[ последние сообщения ]

  • Страница 1 из 1
  • 1
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Гравитация объекта (Props gravity)
Гравитация объекта
arm587 Дата: Суббота, 09.03.2013, 12:10:58 | Сообщение # 1
Сообщений: 4
Репутация: 1 [ +/- ]
Вот хочу сделать плагин для гравитации объектов. Написал код на sourcepawn, но работает только с игроками . С объектами гравитация не меняется. Буду очень благодарен за помощь
Код
#include <sourcemod>  
#include <sdktools>  
#include <sdkhooks>  
new Float:ePos[3];
new bool:mac[1024]={0, ...};
new index=0;
public OnPluginStart()  
{    
          RegConsoleCmd( "isr", delet);
   RegConsoleCmd( "iss", creatent);
}  

public Action:creatent(client, args)
{    
    GetClientAbsOrigin(client, ePos);
    ePos[2] += 55.0;
    ePos[1] +=75.0;  ;
    index = CreateEntityByName("prop_physics_override");  
      if (index < 1)  
      {  
         PrintToChatAll("ERROR");  
         return Plugin_Continue;  
      }  
   DispatchKeyValue(index, "model", "models/props/metal_box.mdl");
   DispatchKeyValue(index, "solid", "2");  
   //DispatchKeyValue(index, "massScale", "1.00");
   AcceptEntityInput(index, "TurnOn");
   //DispatchKeyValue(index, "spawnflags", "1");  
   DispatchSpawn(index);
     SDKHook(index, SDKHook_StartTouch, OnStartTouch); // Hook touch event  
  PrintToChat(client,"CUB posx=%f posy=%f posz=%f index=%d", ePos[0], ePos[1], ePos[2], index);
     return Plugin_Handled;  
}
public OnStartTouch(mar, other_index)

{   
    if(mac[other_index] == false) { PrintToChatAll("ok%d",other_index); }
    mac[other_index] =true;
     
     
}   
public Action:delet(client, args)
{
AcceptEntityInput(index, "KILL");
return Plugin_Handled;
}

public OnMapStart()
{  
     PrecacheModel("models/props/metal_box.mdl");
  //---------------------------- CUB
  AddFileToDownloadsTable("materials/models/props/metal_box.vmt");
  AddFileToDownloadsTable("materials/models/props/metal_box.vtf");
  AddFileToDownloadsTable("materials/models/props/metal_box_exponent.vtf");
  AddFileToDownloadsTable("materials/models/props/metal_box_normal.vtf");
  AddFileToDownloadsTable("models/props/metal_box.dx80.vtx");
  AddFileToDownloadsTable("models/props/metal_box.dx90.vtx");
  AddFileToDownloadsTable("models/props/metal_box.mdl");
  AddFileToDownloadsTable("models/props/metal_box.phy");
  AddFileToDownloadsTable("models/props/metal_box.sw.vtx");
  AddFileToDownloadsTable("models/props/metal_box.vtx");
  AddFileToDownloadsTable("models/props/metal_box.vvd");
}

public OnGameFrame() {
             if(index>0)
      SetEntPropFloat(index, Prop_Data, "m_flGravity", 1.7);    
}
 
iEx Дата: Суббота, 09.03.2013, 12:15:16 | Сообщение # 2
Сообщений: 304
Репутация: 23 [ +/- ]
ммм,мне тоже интересно..,не меняло у меня...
 
NANO_VIRUS Дата: Воскресенье, 17.03.2013, 13:50:38 | Сообщение # 3
Сообщений: 41
Репутация: 0 [ +/- ]
Я тоже измучился с этой проблемой, тут видно какая та функция контролирует гравитацию объекта что-то типо static int, можно заметить если ввести sv_gravity 0 меняется гравитация тока у людей а после смены карты у всех объектов даже на клиенте, и если на карте стоит trigger_vphysics_motion то она тоже меняет гравитацию, но я в ней ковырялся так нечего и не нашел и ее не получается создать в игре. Ковырялся также и в env_entity_dissolver там тоже самое меняется m_flGravity, но так и не понял видно что-то еще надо сделать)). Можно еще сделать иллюзию с помощью trigger_push но это уже будет не то.


Сообщение отредактировал NANO_VIRUS - Воскресенье, 17.03.2013, 13:56:32
 
iEx Дата: Воскресенье, 17.03.2013, 15:44:35 | Сообщение # 4
Сообщений: 304
Репутация: 23 [ +/- ]
ммм,можно порыть плагин entcontrol,как помню там есть изменение гравитации
Код
stock Float:Entity_Gravity(ent, bool:isUpOrDown)
{
  // Get the gravity
  new Float:gravity = GetEntPropFloat(ent, Prop_Data, "m_flGravity");

  if (isUpOrDown)
   gravity += 0.1;
  else
   gravity -= 0.1;

  SetEntPropFloat(ent, Prop_Data, "m_flGravity", gravity);
   
  return (gravity);
}
 
arm587 Дата: Воскресенье, 24.03.2013, 18:50:30 | Сообщение # 5
Сообщений: 4
Репутация: 1 [ +/- ]
Цитата (๖ۣۜErrOR๖ۣۜLaND)
ммм,можно порыть плагин entcontrol,как помню там есть изменение гравитации

Спасибо, уже решил проблему.
 
Meow_1337 Дата: Вторник, 26.03.2013, 12:40:07 | Сообщение # 6
Сообщений: 207
Репутация: 11 [ +/- ]
arm587, кинь решение проблемы.

Добавлено (26.03.2013, 12:40:07)
---------------------------------------------
Не будь жадиной.

 
arm587 Дата: Вторник, 26.03.2013, 16:39:43 | Сообщение # 7
Сообщений: 4
Репутация: 1 [ +/- ]
Цитата (Meow_1337)
кинь решение проблемы.

Ну я сделал так
Код
//create ent and set in other function  index=0
public OnGameFrame() {
              if(IsValidEntity(index) && index !=0)
              TeleportEntity(index, NULL_VECTOR, NULL_VECTOR, veloc);    

}


где veloc - Коэффициент пропорциональности G[vector]
но не рекомендуется если таких объектов много.


Сообщение отредактировал arm587 - Вторник, 26.03.2013, 16:50:41
 
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Гравитация объекта (Props gravity)
  • Страница 1 из 1
  • 1
Поиск: