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

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

  • Страница 1 из 1
  • 1
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Приседание без кнопки
Приседание без кнопки
BarD Дата: Среда, 10.12.2014, 13:38:42 | Сообщение # 1
Сообщений: 943
Репутация: 137 [ +/- ]
Всем доброго времени суток! Допустим, игрок сел в трубу, в которой встать невозможно. Он не нажимает CTRL. Как проверить, находится он в сидячем положении или нет (без проверки кнопки)? Может оффсет какой-то есть?
 
Sallcom Дата: Среда, 10.12.2014, 15:13:28 | Сообщение # 2
Сообщений: 205
Репутация: 31 [ +/- ]
Скорее всего есть способ легче, но можно сравнивать расстояние между GetClientEyePosition и GetClientAbsOrigin.
 
TEIN Дата: Среда, 10.12.2014, 15:48:59 | Сообщение # 3
Сообщений: 563
Репутация: 78 [ +/- ]
создаешь переменную, ловищь нажатие кнопки, естественно, если нажал - переменную в true, потом проверяешь, если переменная в false - кнопка не зажата и т.д.
 
BarD Дата: Среда, 10.12.2014, 16:54:05 | Сообщение # 4
Сообщений: 943
Репутация: 137 [ +/- ]
Sallcom, способ рабочий, но в моём случае не подойдёт, т.к. событие OnTakeDamage от SdkHooks вызывается довольно часто, и это будет очень нагружать сервер.

TEIN, мне нужно проверить, сидит ли игрок, не нажимая кнопки приседания. Т.е. когда игрока что-то сверху блочит, и он не может встать и не нажимает при этом кнопки. Твой способ не подходит.

Есть другие мысли по этому поводу?
 
Sallcom Дата: Среда, 10.12.2014, 18:39:34 | Сообщение # 5
Сообщений: 205
Репутация: 31 [ +/- ]
Вот, самый простой способ:
Код

#include <sourcemod>

public OnPluginStart(){
      RegConsoleCmd("test", Command_Test);
}

public Action:Command_Test(client, args){
      PrintToChatAll("Игрок %N %s.", client, GetEntityFlags(client) & FL_DUCKING ? "сидит" : "стоит");

      return Plugin_Handled;
}


То есть GetEntityFlags(client) & FL_DUCKING
Не забудь про IsClientInGame, IsPlayerAlive и прочие проверки xD

Список флагов (entity_prop_stocks.inc):
Код

// Note: these are only for use with GetEntityFlags and SetEntityFlags
//         and may not match the game's actual, internal m_fFlags values.
// PLAYER SPECIFIC FLAGS FIRST BECAUSE WE USE ONLY A FEW BITS OF NETWORK PRECISION
#define FL_ONGROUND   (1 << 0)    /**< At rest / on the ground */
#define FL_DUCKING   (1 << 1)    /**< Player flag -- Player is fully crouched */
#define FL_WATERJUMP   (1 << 2)    /**< player jumping out of water */
#define FL_ONTRAIN   (1 << 3)    /**< Player is _controlling_ a train, so movement commands should be ignored on client during prediction. */
#define FL_INRAIN   (1 << 4)    /**< Indicates the entity is standing in rain */
#define FL_FROZEN   (1 << 5)    /**< Player is frozen for 3rd person camera */
#define FL_ATCONTROLS   (1 << 6)    /**< Player can't move, but keeps key inputs for controlling another entity */
#define FL_CLIENT   (1 << 7)    /**< Is a player */
#define FL_FAKECLIENT   (1 << 8)    /**< Fake client, simulated server side; don't send network messages to them */

// NOTE if you move things up, make sure to change this value
#define PLAYER_FLAG_BITS  9

// NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though
#define FL_INWATER   (1 << 9)    /**< In water */
#define FL_FLY    (1 << 10)    /**< Changes the SV_Movestep() behavior to not need to be on ground */
#define FL_SWIM    (1 << 11)    /**< Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) */
#define FL_CONVEYOR   (1 << 12)
#define FL_NPC    (1 << 13)
#define FL_GODMODE   (1 << 14)
#define FL_NOTARGET   (1 << 15)
#define FL_AIMTARGET   (1 << 16)    /**< set if the crosshair needs to aim onto the entity */
#define FL_PARTIALGROUND  (1 << 17)    /**< not all corners are valid */
#define FL_STATICPROP   (1 << 18)    /**< Eetsa static prop!   */
#define FL_GRAPHED   (1 << 19)    /**< worldgraph has this ent listed as something that blocks a connection */
#define FL_GRENADE   (1 << 20)
#define FL_STEPMOVEMENT   (1 << 21)    /**< Changes the SV_Movestep() behavior to not do any processing */
#define FL_DONTTOUCH   (1 << 22)    /**< Doesn't generate touch functions, generates Untouch() for anything it was touching when this flag was set */
#define FL_BASEVELOCITY   (1 << 23)    /**< Base velocity has been applied this frame (used to convert base velocity into momentum) */
#define FL_WORLDBRUSH   (1 << 24)    /**< Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) */
#define FL_OBJECT   (1 << 25)    /**< Terrible name. This is an object that NPCs should see. Missiles, for example. */
#define FL_KILLME   (1 << 26)    /**< This entity is marked for death -- will be freed by game DLL */
#define FL_ONFIRE   (1 << 27)    /**< You know... */
#define FL_DISSOLVING   (1 << 28)    /**< We're dissolving! */
#define FL_TRANSRAGDOLL   (1 << 29)    /**< In the process of turning into a client side ragdoll. */
#define FL_UNBLOCKABLE_BY_PLAYER    (1 << 30)    /**< pusher that can't be blocked by the player */
#define FL_FREEZING    (1 << 31)    /**< We're becoming frozen! */
#define FL_EP2V_UNKNOWN1  (1 << 31)    /**< Unknown */


Сообщение отредактировал Sallcom - Среда, 10.12.2014, 19:21:25
 
BarD Дата: Четверг, 11.12.2014, 02:22:27 | Сообщение # 6
Сообщений: 943
Репутация: 137 [ +/- ]
Вот, то, что нужно! Спасибо огромное!
 
Форум » SourceMod >> CS:Source >> CSGO » Обсуждение » Приседание без кнопки
  • Страница 1 из 1
  • 1
Поиск: