Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
jtfHeightFinder
作成日
6 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
461 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
552 行
すべてコピー
404 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
491 行
すべてコピー
#pragma semicolon 1
#pragma semicolon 1
#include <sourcemod>
#include <sourcemod>
#include <sdktools>
#include <sdktools>
#include <sdkhooks>
#include <sdkhooks>
コピー
コピー済み
コピー
コピー済み
#define PLUGIN_VERSION "1.0.
1
"
#define PLUGIN_VERSION "1.0.
2
"
#define SPRITE_BEAM "materials/sprites/laser.vmt"
#define SPRITE_BEAM "materials/sprites/laser.vmt"
コピー
コピー済み
コピー
コピー済み
bool
PL_
Enabled;
bool
g_b
Enabled;
bool
BM_ENABLED
[MAXPLAYERS + 1];
bool
g_bBrushMode
[MAXPLAYERS + 1];
bool
CJ_ENABLED
[MAXPLAYERS + 1];
bool
g_bCheckJump
[MAXPLAYERS + 1];
コピー
コピー済み
コピー
コピー済み
int
Offset_for_entity_effect
= -1;
int
g_iEffectOffset
= -1;
int
BrushEntity
Index
[MAXPLAYERS + 1]
[1]
; //Array of brush entities (trigger_teleport, func_nogrenades)
int
g_i
BrushEntity
[MAXPLAYERS + 1]
; //Array of brush entities (trigger_teleport, func_nogrenades)
int
sprite
;
int
g_iSpritePrecache
;
int
halo
;
int
g_iHaloPrecache
;
コピー
コピー済み
コピー
コピー済み
float
FL_VelClient
[MAXPLAYERS + 1][3];
float
g_fVelocity
[MAXPLAYERS + 1][3];
コピー
コピー済み
コピー
コピー済み
ConVar g_
pluginEnabled
;
ConVar g_
cvarEnabled
;
コピー
コピー済み
コピー
コピー済み
Handle
HudDisplay
;
Handle
g_hHudSync
;
コピー
コピー済み
コピー
コピー済み
public Plugin
:
myinfo =
public Plugin
myinfo =
{
{
name = "Height Finder",
name = "Height Finder",
author = "Master Cake",
author = "Master Cake",
description = "This plugin finds height",
description = "This plugin finds height",
version = PLUGIN_VERSION,
version = PLUGIN_VERSION,
url = ""
url = ""
};
};
コピー
コピー済み
コピー
コピー済み
public
OnPluginStart()
public
void
OnPluginStart()
{
{
コピー
コピー済み
コピー
コピー済み
CreateConVar("hfind_version", PLUGIN_VERSION, "Height Finder Version",
FCVAR_REPLICATED |
FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);
CreateConVar("hfind_version", PLUGIN_VERSION, "Height Finder Version",
FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY);
コピー
コピー済み
コピー
コピー済み
g_
pluginEnabled
= CreateConVar("hfind_enabled", "1", "Enable Height Finder\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0);
g_
cvarEnabled
= CreateConVar("hfind_enabled", "1", "Enable Height Finder\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0);
PL_
Enabled = GetConVarBool(g_
pluginEnabled
);
g_b
Enabled = GetConVarBool(g_
cvarEnabled
);
コピー
コピー済み
コピー
コピー済み
HookConVarChange(g_
pluginEnabled
, ConsoleVarChange);
HookConVarChange(g_
cvarEnabled
, ConsoleVarChange);
コピー
コピー済み
コピー
コピー済み
Offset_for_entity_effect
= FindSendPropInfo("CBaseEntity", "m_fEffects"); //Find offset to "m_fEffects" property
g_iEffectOffset
= FindSendPropInfo("CBaseEntity", "m_fEffects"); //Find offset to "m_fEffects" property
if (
Offset_for_entity_effect
== -1)
if (
g_iEffectOffset
== -1)
{
SetFailState("m_fEffects property not found!");
SetFailState("m_fEffects property not found!");
コピー
コピー済み
コピー
コピー済み
}
コピー
コピー済み
コピー
コピー済み
RegConsoleCmd("sm_findh",
HC_Command
, "Command to enable Height Finder");
RegConsoleCmd("sm_findh",
cmdFindHeight
, "Command to enable Height Finder");
RegConsoleCmd("sm_checkjump",
CJ_Command
, "Command to enable jump checker");
RegConsoleCmd("sm_checkjump",
cmdCheckJump
, "Command to enable jump checker");
コピー
コピー済み
コピー
コピー済み
RegAdminCmd("sm_brushmode",
BM_Command
, ADMFLAG_GENERIC, "Command to enable/disable brush mode");
RegAdminCmd("sm_brushmode",
cmdBrushMode
, ADMFLAG_GENERIC, "Command to enable/disable brush mode");
RegAdminCmd("sm_nogrenades",
NG_Command
, ADMFLAG_GENERIC, "Command to show func_nogrenades brush entities");
RegAdminCmd("sm_nogrenades",
cmdEnableNoGrenade
, ADMFLAG_GENERIC, "Command to show func_nogrenades brush entities");
RegAdminCmd("sm_stopnogrenades",
SNG_Command
, ADMFLAG_GENERIC, "Command to stop showing func_nogrenades brush entities");
RegAdminCmd("sm_stopnogrenades",
cmdDisableNoGrenade
, ADMFLAG_GENERIC, "Command to stop showing func_nogrenades brush entities");
RegAdminCmd("sm_teletriggers",
TT_Command
, ADMFLAG_GENERIC, "Command to show trigger_teleport brush entities");
RegAdminCmd("sm_teletriggers",
cmdEnableTeleTrigger
, ADMFLAG_GENERIC, "Command to show trigger_teleport brush entities");
RegAdminCmd("sm_stopteletriggers",
STT_Command
, ADMFLAG_GENERIC, "Command to stop showing trigger_teleport brush entities");
RegAdminCmd("sm_stopteletriggers",
cmdDisableTeleTrigger
, ADMFLAG_GENERIC, "Command to stop showing trigger_teleport brush entities");
RegAdminCmd("sm_removent",
RENT_Command
, ADMFLAG_GENERIC, "Command to remove trigger_teleport and func_nogrenades brush entities");
RegAdminCmd("sm_removent",
cmdRemoveEntities
, ADMFLAG_GENERIC, "Command to remove trigger_teleport and func_nogrenades brush entities");
RegAdminCmd("sm_getentindex",
GEI_Command
, ADMFLAG_GENERIC, "Command to get trigger_teleport and func_nogrenades index");
RegAdminCmd("sm_getentindex",
cmdGetEntityIndex
, ADMFLAG_GENERIC, "Command to get trigger_teleport and func_nogrenades index");
RegAdminCmd("sm_movent
up", MEU_Command, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities up");
RegAdminCmd("sm_movent
", cmdMoveEnt
, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities
");
RegAdminCmd("sm_moventdown", MED_Command
, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities
down
");
AutoExecConfig(true, "hfind");
AutoExecConfig(true, "hfind");
コピー
コピー済み
コピー
コピー済み
HudDisplay
= CreateHudSynchronizer();
g_hHudSync
= CreateHudSynchronizer();
}
}
コピー
コピー済み
コピー
コピー済み
public
OnMapStart()
public
void
OnMapStart()
{
{
コピー
コピー済み
コピー
コピー済み
sprite
= PrecacheModel(SPRITE_BEAM);
g_iSpritePrecache
= PrecacheModel(SPRITE_BEAM);
halo
= PrecacheModel(SPRITE_BEAM);
g_iHaloPrecache
= PrecacheModel(SPRITE_BEAM);
}
}
コピー
コピー済み
コピー
コピー済み
public
ConsoleVarChange(
Handle:C
Var
, const
String:
oldValue
[]
, const
String:
newValue
[]
)
public
void
ConsoleVarChange(
Con
Var
cvar
, const
char[]
oldValue
, const
char[]
newValue
)
{
{
コピー
コピー済み
コピー
コピー済み
if(CVar == g_pluginEnabled)
g_bEnabled
= GetConVarBool(
cvar);
{
PL_Enabled
= GetConVarBool(
g_pluginEnabled);
}
}
}
コピー
コピー済み
コピー
コピー済み
public
OnClientPutInServer(
myC
lient)
public
void
OnClientPutInServer(
int c
lient)
{
{
コピー
コピー済み
コピー
コピー済み
BM_ENABLED[myC
lient] = false;
g_bBrushMode[c
lient] = false;
CJ_ENABLED[myClient
] = false;
g_bCheckJump[client
] = false;
BrushEntity
Index[myC
lient]
[0]
= -1;
g_i
BrushEntity
[c
lient]
= -1;
}
}
public int MenuHandler_func(Menu menu, MenuAction action, int param1, int param2)
public int MenuHandler_func(Menu menu, MenuAction action, int param1, int param2)
{
{
if (action == MenuAction_End)
if (action == MenuAction_End)
コピー
コピー済み
コピー
コピー済み
{
{
delete menu;
delete menu;
}
}
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:CJ_Command(myC
lient,
args)
public Action
cmdCheckJump(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled
|| !IsValidClient(myC
lient)
)
if
(g_b
Enabled
&& c
lient)
return Plugin_Continue;
if (!CJ_ENABLED[myClient])
{
{
コピー
コピー済み
コピー
コピー済み
CJ_ENABLED[myClient
] =
true;
g_bCheckJump[client
] =
!g_bCheckJump[client];
ReplyToCommand(
myC
lient, "[SM] Jump Check
Enabled!");
ReplyToCommand(
c
lient, "[SM] Jump Check
%s!", g_bCheckJump[client] ? "Enabled" : "
Disabled
");
return Plugin_Continue;
}
}
if (CJ_ENABLED[myClient])
{
CJ_ENABLED[myClient] = false;
ReplyToCommand(myClient, "[SM] Jump Check
Disabled
!
");
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:BM_Command(myC
lient,
args)
public Action
cmdBrushMode(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled
|| !IsValidClient(myC
lient)
)
if
(g_b
Enabled
&& c
lient)
return Plugin_Continue;
if (!BM_ENABLED[myClient])
{
{
コピー
コピー済み
コピー
コピー済み
BM_ENABLED[myC
lient] =
true;
g_bBrushMode[c
lient] =
!g_bBrushMode[client];
ReplyToCommand(
myC
lient, "[SM] Brush Mode
Enabled!");
ReplyToCommand(
c
lient, "[SM] Brush Mode
%s!", g_bBrushMode[client] ? "Enabled" : "
Disabled
");
return Plugin_Continue;
}
}
if (BM_ENABLED[myClient])
{
BM_ENABLED[myClient] = false;
ReplyToCommand(myClient, "[SM] Brush Mode
Disabled
!
");
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:RENT_Command(myC
lient,
args)
public Action
cmdRemoveEntities(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
コピー
コピー済み
コピー
コピー済み
int EntityCount = GetEntityCount();
char
c
lassName[
32
];
char
myC
lassName[
50
];
for (int
i
= MaxClients + 1;
i
<=
2048
; ++
i
)
for (int
myEntity
= MaxClients + 1;
myEntity
<=
EntityCount
; ++
myEntity
)
{
{
コピー
コピー済み
コピー
コピー済み
if (IsValidEntity(
myEntity
))
if (IsValidEntity(
i
))
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
myEntity, myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
i, c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "trigger_teleport") || StrEqual(
myC
lassName, "func_nogrenades"))
if (StrEqual(
c
lassName, "trigger_teleport") || StrEqual(
c
lassName, "func_nogrenades"))
{
{
コピー
コピー済み
コピー
コピー済み
RemoveEntity(
myEntity
);
RemoveEntity(
i
);
}
}
}
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:STT_Command(myC
lient,
args)
public Action
cmdDisableTeleTrigger(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
コピー
コピー済み
コピー
コピー済み
int EntityCouunt = GetEntityCount();
char
c
lassName[
32
];
char
myC
lassName[
50
];
for (int
i
= MaxClients + 1;
i
<=
2048
; ++
i
)
for (int
myEntity
= MaxClients + 1;
myEntity
<=
EntityCouunt
; ++
myEntity
)
{
{
コピー
コピー済み
コピー
コピー済み
if (IsValidEntity(
myEntity
))
if (IsValidEntity(
i
))
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
myEntity, myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
i, c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "trigger_teleport"))
if (StrEqual(
c
lassName, "trigger_teleport"))
{
{
コピー
コピー済み
コピー
コピー済み
StopShowBrushEntity(
myEntity
);
StopShowBrushEntity(
i
);
}
}
}
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:TT_Command(myC
lient,
args)
public Action
cmdEnableTeleTrigger(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
コピー
コピー済み
コピー
コピー済み
int EntityCouunt = GetEntityCount();
char
c
lassName[
32
];
char
myC
lassName[
50
];
for (int
i
= MaxClients + 1;
i
<=
2048
; ++
i
)
for (int
myEntity
= MaxClients + 1;
myEntity
<=
EntityCouunt
; ++
myEntity
)
{
{
コピー
コピー済み
コピー
コピー済み
if (IsValidEntity(
myEntity
))
if (IsValidEntity(
i
))
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
myEntity, myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
i, c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "trigger_teleport"))
if (StrEqual(
c
lassName, "trigger_teleport"))
{
{
コピー
コピー済み
コピー
コピー済み
ShowBrushEntity(
myEntity
);
ShowBrushEntity(
i
);
}
}
}
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:NG_Command(myC
lient,
args)
public Action
cmdEnableNoGrenade(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
コピー
コピー済み
コピー
コピー済み
int EntityCouunt = GetEntityCount();
char
c
lassName[
32
];
char
myC
lassName[
50
];
for (int
i
= MaxClients + 1;
i
<=
2048
; ++
i
)
for (int
myEntity
= MaxClients + 1;
myEntity
<=
EntityCouunt
; ++
myEntity
)
{
{
コピー
コピー済み
コピー
コピー済み
if (IsValidEntity(
myEntity
))
if (IsValidEntity(
i
))
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
myEntity, myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
i, c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "func_nogrenades"))
if (StrEqual(
c
lassName, "func_nogrenades"))
{
{
コピー
コピー済み
コピー
コピー済み
ShowBrushEntity(
myEntity
);
ShowBrushEntity(
i
);
}
}
}
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:SNG_Command(myC
lient,
args)
public Action
cmdDisableNoGrenade(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
コピー
コピー済み
コピー
コピー済み
int EntityCouunt = GetEntityCount();
char
c
lassName[
32
];
char
myC
lassName[
50
];
for (int
i
= MaxClients + 1;
i
<=
2048
; ++
i
)
for (int
myEntity
= MaxClients + 1;
myEntity
<=
EntityCouunt
; ++
myEntity
)
{
{
コピー
コピー済み
コピー
コピー済み
if (IsValidEntity(
myEntity
))
if (IsValidEntity(
i
))
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
myEntity, myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
i, c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "func_nogrenades"))
if (StrEqual(
c
lassName, "func_nogrenades"))
{
{
コピー
コピー済み
コピー
コピー済み
StopShowBrushEntity(
myEntity
);
StopShowBrushEntity(
i
);
}
}
}
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:MED_Command(myC
lient,
args)
public Action
cmdMoveEnt(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_
Continue;
{
return Plugin_
Handled;
}
if (args != 2)
if (args != 2)
{
{
コピー
コピー済み
コピー
コピー済み
ReplyToCommand(
myC
lient, "Usage: sm_movent
down
<index> <num of units>");
ReplyToCommand(
c
lient, "Usage: sm_movent
up
<index> <num of units>");
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
char
myArgs1
[32];
char
arg1
[32];
GetCmdArg(1,
myArgs1
, sizeof(
myArgs1
));
GetCmdArg(1,
arg1
, sizeof(
arg1
));
int
EntIndex
= StringToInt(
myArgs1
);
if (!IsValidEntity(
EntIndex))
int
entity
= StringToInt(
arg1
);
if (!IsValidEntity(
entity))
{
return Plugin_Handled;
return Plugin_Handled;
コピー
コピー済み
コピー
コピー済み
char
myArgs2
[32];
}
GetCmdArg(2,
myArgs2
, sizeof(
myArgs2
));
int
num
= StringToInt(
myArgs2
);
char
arg2
[32];
if (
num
> 999
)
GetCmdArg(2,
arg2
, sizeof(
arg2
));
int
distance
= StringToInt(
arg2
);
if (
!distance || distance
> 999
|| distance < -999
)
{
{
コピー
コピー済み
コピー
コピー済み
ReplyToCommand(
myC
lient, "Invalid value");
ReplyToCommand(
c
lient, "Invalid value");
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
else
char className[32];
GetEntityClassname(entity, className, sizeof(className));
if (StrEqual(className, "func_nogrenades") || StrEqual(className, "trigger_teleport"))
{
{
コピー
コピー済み
コピー
コピー済み
float
EntPos
[3];
float
origin
[3];
char typent[32];
GetEntPropVector(
entity
, Prop_Send, "m_vecOrigin",
origin
);
GetEntityClassname(EntIndex, typent, sizeof(typent));
if (StrEqual(typent, "func_nogrenades") || StrEqual(typent, "trigger_teleport"))
origin[2] += distance;
{
GetEntPropVector(
EntIndex
, Prop_Send, "m_vecOrigin",
EntPos
);
TeleportEntity(entity, origin
, NULL_VECTOR, NULL_VECTOR);
if (num == 0)
{
EntPos[2] += num;
}
else
{
EntPos[2] -= num;
}
TeleportEntity(EntIndex, EntPos
, NULL_VECTOR, NULL_VECTOR);
}
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:MEU_Command(myC
lient,
args)
public Action
cmdGetEntityIndex(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient
)
|| !
BM_ENABLED[myC
lient])
if
(!g_b
Enabled || !
c
lient
|| !
g_bBrushMode[c
lient])
return Plugin_Continue;
if (args != 2)
{
ReplyToCommand(myClient, "Usage: sm_moventup <index> <num of units>");
return Plugin_Handled;
}
char myArgs1[32];
GetCmdArg(1, myArgs1, sizeof(myArgs1));
int EntIndex = StringToInt(myArgs1);
if (!IsValidEntity(EntIndex))
return Plugin_Handled;
char myArgs2[32];
GetCmdArg(2, myArgs2, sizeof(myArgs2));
int num = StringToInt(myArgs2);
if (num > 999)
{
{
コピー
コピー済み
コピー
コピー済み
ReplyToCommand(myClient, "Invalid value");
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
else
float eyeOrigin[3];
GetClientEyePosition(client, eyeOrigin);
float eyeAngle[3];
GetClientEyeAngles(client, eyeAngle);
Handle tr = TR_TraceRayFilterEx(eyeOrigin, eyeAngle, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
if (TR_DidHit(tr))
{
{
コピー
コピー済み
コピー
コピー済み
float
EntPos
[3];
float
endPoint
[3];
char typent[32];
TR_GetEndPosition(endPoint, tr
);
GetEntityClassname(EntIndex, typent, sizeof(typent)
);
TR_EnumerateEntities(eyeOrigin, endPoint, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, client);
if (StrEqual(typent, "func_nogrenades") || StrEqual(typent, "trigger_teleport"))
if (g_iBrushEntity[client] != -1)
{
{
コピー
コピー済み
コピー
コピー済み
GetEntPropVector(
Ent
Index
, Prop_Send, "m_vecOrigin", EntPos);
ReplyToCommand(client, "
Ent
ity
Index
: %i", g_iBrushEntity[client]);
if (num == 0)
{
EntPos[2] += num;
}
else
{
EntPos[2] += num; //Anyway LOL
}
TeleportEntity(EntIndex, EntPos, NULL_VECTOR, NULL_VECTOR);
}
}
}
}
コピー
コピー済み
コピー
コピー済み
delete tr;
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:GEI_Command(myC
lient,
args)
public Action
cmdFindHeight(int c
lient,
int
args)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myC
lient)
|| !BM_ENABLED[myClient])
if
(!g_b
Enabled || !
c
lient)
return Plugin_Continue;
float FL_TargetPos[3];
float FL_PlayerPos[3];
float FL_PlayerAng[3];
GetClientEyePosition(myClient, FL_PlayerPos);
GetClientEyeAngles(myClient, FL_PlayerAng);
Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
if(TR_DidHit(myTrace))
{
{
コピー
コピー済み
コピー
コピー済み
TR_GetEndPosition(FL_TargetPos, myTrace);
return Plugin_Handled;
TR_EnumerateEntities(FL_PlayerPos, FL_TargetPos, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, myClient);
if (BrushEntityIndex[myClient][0] != -1)
ReplyToCommand(myClient, "Entity Index: %i", BrushEntityIndex[myClient][0]);
}
}
コピー
コピー済み
コピー
コピー済み
delete myTrace;
return Plugin_Handled;
}
public Action:HC_Command(myClient, args)
{
if(!PL_Enabled || !IsValidClient(myClient))
return Plugin_Continue;
Menu menu = new Menu(MenuHandler_func);
Menu menu = new Menu(MenuHandler_func);
menu.SetTitle("Height Finder");
menu.SetTitle("Height Finder");
コピー
コピー済み
コピー
コピー済み
static float FL_TargetPos[3];
float eyeOrigin
[3];
static float FL_PlayerPos[3];
GetClientEyePosition(
c
lient,
eyeOrigin);
static float FL_PlayerAbsPos[3];
static float FL_PlayerTempPos[3];
static float FL_PlayerAng[3];
static float FL_TargetVec
[3];
GetClientEyePosition(
myC
lient,
FL_PlayerPos);
GetClientAbsOrigin(myClient, FL_PlayerAbsPos); //Abs Origin
GetClientEyeAngles(myClient, FL_PlayerAng);
Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
コピー
コピー済み
コピー
コピー済み
if
(TR_DidHit(myTrace))
float playerOrigin[3];
GetClientAbsOrigin(client, playerOrigin); //Abs Origin
float eyeAngle[3];
GetClientEyeAngles(client, eyeAngle);
Handle myTrace = TR_TraceRayFilterEx(eyeOrigin, eyeAngle, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
float endPoint[3];
if
(TR_DidHit(myTrace))
{
{
コピー
コピー済み
コピー
コピー済み
TR_GetEndPosition(
FL_TargetPos
, myTrace);
TR_GetEndPosition(
endPoint
, myTrace);
TR_EnumerateEntities(
FL_PlayerPos, FL_TargetPos
, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger,
myC
lient);
TR_EnumerateEntities(
eyeOrigin, endPoint
, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger,
c
lient);
}
}
コピー
コピー済み
コピー
コピー済み
delete myTrace;
delete myTrace;
コピー
コピー済み
コピー
コピー済み
char
distance[32];
char
buffer[32];
char detent[32];
char typent[32];
SubtractVectors(FL_TargetPos, FL_PlayerAbsPos, FL_TargetVec); //Distance to the ground
Format(distance, sizeof(distance), "Target height: %1.3f", FL_TargetVec[2]);
if (BrushEntityIndex[myClient][0] != -1)
Format(detent, sizeof(detent), "Brush entity: YES");
else
Format(detent, sizeof(detent), "Brush entity: NO");
コピー
コピー済み
コピー
コピー済み
menu.AddItem("th", distance, ITEMDRAW_DISABLED);
float difference[3];
menu.AddItem("be", detent, ITEMDRAW_DISABLED);
SubtractVectors(endPoint, playerOrigin, difference); //Distance to the ground
コピー
コピー済み
コピー
コピー済み
if (
BrushEntity
Index[myC
lient]
[0]
!= -1)
FormatEx(buffer, sizeof(buffer), "Target height: %1.3f", difference[2]);
menu.AddItem("", buffer, ITEMDRAW_DISABLED);
FormatEx(buffer, sizeof(buffer), "Brush entity: %s", g_iBrushEntity[client] != -1 ? "YES" : "NO");
menu.AddItem("", buffer, ITEMDRAW_DISABLED);
if (g_i
BrushEntity
[c
lient]
!= -1)
{
{
コピー
コピー済み
コピー
コピー済み
GetEntityClassname(
BrushEntity
Index[myC
lient]
[0], typent
, sizeof(
typent
));
GetEntityClassname(
g_i
BrushEntity
[c
lient]
, buffer
, sizeof(
buffer
));
if (StrEqual(
typent
, "func_nogrenades"))
Format(
typent
, sizeof(
typent
), "First detected: Nogrenade");
if (StrEqual(
buffer
, "func_nogrenades"))
if (StrEqual(
typent
, "trigger_teleport"))
{
Format(
typent
, sizeof(
typent
), "First detected: Teleport");
Format(
buffer
, sizeof(
buffer
), "First detected: Nogrenade");
}
else
if (StrEqual(
buffer
, "trigger_teleport"))
{
Format(
buffer
, sizeof(
buffer
), "First detected: Teleport");
}
}
}
else
else
{
{
コピー
コピー済み
コピー
コピー済み
Format(
typent
, sizeof(
typent
), "First detected: ---");
Format(
buffer
, sizeof(
buffer
), "First detected: ---");
}
}
コピー
コピー済み
コピー
コピー済み
menu.AddItem("fd", typent, ITEMDRAW_DISABLED);
menu.Display(myClient, 30);
コピー
コピー済み
コピー
コピー済み
int color[4]; color[0] = 255; color[1] = 255; color[2] = 255; color[3] = 255;
menu.AddItem("", buffer, ITEMDRAW_DISABLED);
TE_SetupBeamPoints(FL_PlayerAbsPos, FL_TargetPos, sprite, halo
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
color
, 0);
menu.Display(client, 30);
TE_SendToClient(
myC
lient, 0.1);
FL_PlayerTempPos
=
FL_PlayerAbsPos
;
TE_SetupBeamPoints(playerOrigin, endPoint, g_iSpritePrecache, g_iHaloPrecache
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
{255, 255, 255, 255}
, 0);
FL_PlayerTempPos
[2] =
FL_TargetPos
[2];
TE_SendToClient(
c
lient, 0.1);
TE_SetupBeamPoints(
FL_TargetPos, FL_PlayerTempPos, sprite, halo
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
color
, 0);
TE_SendToClient(
myC
lient, 0.1);
float temp[3];
TE_SetupBeamPoints(
FL_PlayerTempPos, FL_PlayerAbsPos, sprite, halo
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
color
, 0);
temp[0]
=
playerOrigin[0]
;
TE_SendToClient(
myC
lient, 0.1);
temp[1] = playerOrigin[1];
temp
[2] =
endPoint
[2];
TE_SetupBeamPoints(
endPoint, temp, g_iSpritePrecache, g_iHaloPrecache
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
{255, 255, 255, 255}
, 0);
TE_SendToClient(
c
lient, 0.1);
TE_SetupBeamPoints(
temp, playerOrigin, g_iSpritePrecache, g_iHaloPrecache
, 0, 0, 7.0, 5.0, 5.0, 1, 0.0,
{255, 255, 255, 255}
, 0);
TE_SendToClient(
c
lient, 0.1);
return Plugin_Handled;
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
public Action
:
OnPlayerRunCmd(
myC
lient,
&myB
uttons
, &myImpulse, Float:myVel[3], Float:myAng[3], &myWeapon
)
public Action
OnPlayerRunCmd(
int c
lient,
int &b
uttons
)
{
{
コピー
コピー済み
コピー
コピー済み
if
(!PL_
Enabled || !
IsValidClient(myClient))
if
(!g_b
Enabled || !
g_bCheckJump[client])
{
return Plugin_Continue;
return Plugin_Continue;
コピー
コピー済み
コピー
コピー済み
}
コピー
コピー済み
コピー
コピー済み
if (
CJ_ENABLED[myClient]
)
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", g_fVelocity[client]);
if (
g_fVelocity[client][2] <= 0.0
)
{
{
コピー
コピー済み
コピー
コピー済み
GetEntPropVector(myClient, Prop_Data, "m_vecAbsVelocity", FL_VelClient[myClient]);
return Plugin_Continue;
if (FL_VelClient[myClient][2] > 0.0)
}
{
static float FL_TargetPos[3];
static float FL_PlayerPos[3];
static float FL_PlayerAng[3]; FL_PlayerAng[0] = 90.0; FL_PlayerAng[1] = 0.0; FL_PlayerAng[2] = 0.0;
static float FL_TargetVec[3];
GetClientAbsOrigin(myClient, FL_PlayerPos);
Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
コピー
コピー済み
コピー
コピー済み
if(TR_DidHit(myTrace))
float playerOrigin[3];
{
GetClientAbsOrigin(client, playerOrigin);
TR_GetEndPosition(FL_TargetPos, myTrace);
}
delete myTrace;
コピー
コピー済み
コピー
コピー済み
SubtractVectors(
FL_PlayerPos, FL_TargetPos, FL_TargetVec
); //Distance to the ground
Handle tr = TR_TraceRayFilterEx(playerOrigin, view_as<float>({90.0, 0.0, 0.0}), MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity);
ClearSyncHud(myClient, HudDisplay);
float endPoint[3];
SetHudTextParams(0.65, 0.55, 5.0, 255, 255, 255, 255, 0, 0.1, 0.1, 0.1);
if (TR_DidHit(tr))
ShowSyncHudText(
myC
lient,
HudDisplay
, "Your max height: %1.3f",
FL_TargetVec
[2]);
{
return Plugin_Continue;
TR_GetEndPosition(endPoint, tr);
}
float difference[3];
SubtractVectors(
playerOrigin, endPoint, difference
); //Distance to the ground
SetHudTextParams(0.65, 0.55, 5.0, 255, 255, 255, 255, 0, 0.1, 0.1, 0.1);
ShowSyncHudText(
c
lient,
g_hHudSync
, "Your max height: %1.3f",
difference
[2]);
}
}
コピー
コピー済み
コピー
コピー済み
delete tr;
return Plugin_Continue;
return Plugin_Continue;
}
}
コピー
コピー済み
コピー
コピー済み
public bool TraceFilterEntity(int
myE
ntity, int m
yM
ask)
public bool TraceFilterEntity(int
e
ntity, int m
ask)
{
{
コピー
コピー済み
コピー
コピー済み
return
(myE
ntity
== 0
||
myE
ntity > MaxClients
); //0 - server console
return
!e
ntity
||
e
ntity > MaxClients
;
}
}
コピー
コピー済み
コピー
コピー済み
public bool DetectTrigger(int
myE
ntity, int
myC
lient)
public bool DetectTrigger(int
e
ntity, int
c
lient)
{
{
コピー
コピー済み
コピー
コピー済み
char
myC
lassName[
50
];
char
c
lassName[
32
];
GetEntityClassname(
myE
ntity,
myC
lassName, sizeof(
myC
lassName));
GetEntityClassname(
e
ntity,
c
lassName, sizeof(
c
lassName));
if (StrEqual(
myC
lassName, "trigger_teleport") || StrEqual(
myC
lassName, "func_nogrenades"))
if (StrEqual(
c
lassName, "trigger_teleport") || StrEqual(
c
lassName, "func_nogrenades"))
{
{
コピー
コピー済み
コピー
コピー済み
BrushEntity
Index[myC
lient]
[0]
=
myE
ntity;
g_i
BrushEntity
[c
lient]
=
e
ntity;
return false;
return false;
}
}
コピー
コピー済み
コピー
コピー済み
else
{
g_i
BrushEntity
[c
lient]
= -1;
BrushEntity
Index[myC
lient]
[0]
= -1;
return true;
return true;
}
}
}
コピー
コピー済み
コピー
コピー済み
public Action Func_SetTransmit(int entity, int
myC
lient)
public Action Func_SetTransmit(int entity, int
c
lient)
{
{
コピー
コピー済み
コピー
コピー済み
if (!
BM_ENABLED[myC
lient])
if (!
g_bBrushMode[c
lient])
{
{
コピー
コピー済み
コピー
コピー済み
return Plugin_Handled;
//Disable trigger_teleport transmit to the client (if plugin is disabled for current player in array)
//Disable trigger_teleport transmit to the client (if plugin is disabled for current player in array)
return Plugin_Handled;
}
}
コピー
コピー済み
コピー
コピー済み
return Plugin_Continue;
return Plugin_Continue;
}
}
/////////////////////////////// <-- STOCKS --> ////////////////////////////////////////////////
/////////////////////////////// <-- STOCKS --> ////////////////////////////////////////////////
コピー
コピー済み
コピー
コピー済み
/**
#define EF_NODRAW 0x020
* Checks client validity
* @param myEntity Entity index.
* @param Replay Logical bool parameter.
*/
stock bool:IsValidClient(myClient, bool:Replay = true)
{
if(myClient <= 0 || myClient > MaxClients || !IsClientInGame(myClient))
return false;
if(Replay && (IsClientSourceTV(myClient) || IsClientReplay(myClient) || IsClientObserver(myClient)))
return false;
return true;
}
/**
/**
* Sets transmit state to the edict and flag (shows brush entity - func_nogrenades, trigger_teleport)
* Sets transmit state to the edict and flag (shows brush entity - func_nogrenades, trigger_teleport)
コピー
コピー済み
コピー
コピー済み
* @param
myE
ntity Entity index.
* @param
e
ntity Entity index.
*/
*/
コピー
コピー済み
コピー
コピー済み
stock
void ShowBrushEntity(int
myE
ntity)
void ShowBrushEntity(int
e
ntity)
{
{
コピー
コピー済み
コピー
コピー済み
if (
IsValidEdict(
myE
ntity))
if (
!
IsValidEdict(
e
ntity))
{
{
コピー
コピー済み
コピー
コピー済み
int EffectFlags = GetEntData(myEntity, Offset_for_entity_effect);
return;
int EdictFlags = GetEdictFlags(myEntity);
if (myEntity != -1)
{
EffectFlags &= ~32; //EF_NODRAW flag (0x020)
EdictFlags &= ~FL_EDICT_DONTSEND; //Transmit State - Don't ever transmit.
SetEntData(myEntity, Offset_for_entity_effect, EffectFlags);
ChangeEdictState(myEntity, Offset_for_entity_effect);
SetEdictFlags(myEntity, EdictFlags);
}
}
}
コピー
コピー済み
コピー
コピー済み
SDKHook(
myE
ntity, SDKHook_SetTransmit, Func_SetTransmit);
SetEntData(entity, g_iEffectOffset, GetEntData(entity, g_iEffectOffset) & ~EF_NODRAW);
SetEdictFlags(entity, GetEdictFlags(entity) & ~FL_EDICT_DONTSEND);
ChangeEdictState(entity, g_iEffectOffset);
SDKHook(
e
ntity, SDKHook_SetTransmit, Func_SetTransmit);
}
}
/**
/**
* Sets transmit state to the edict and flag (stops showing brush entities - func_nogrenades, trigger_teleport)
* Sets transmit state to the edict and flag (stops showing brush entities - func_nogrenades, trigger_teleport)
コピー
コピー済み
コピー
コピー済み
* @param
myE
ntity Entity index.
* @param
e
ntity Entity index.
*/
*/
コピー
コピー済み
コピー
コピー済み
stock
void StopShowBrushEntity(int
myE
ntity)
void StopShowBrushEntity(int
e
ntity)
{
{
コピー
コピー済み
コピー
コピー済み
if (
IsValidEdict(
myE
ntity))
if (
!
IsValidEdict(
e
ntity))
{
{
コピー
コピー済み
コピー
コピー済み
int EffectFlags = GetEntData(myEntity, Offset_for_entity_effect);
return;
int EdictFlags = GetEdictFlags(myEntity);
if (myEntity != -1)
{
EffectFlags |= 32; //EF_NODRAW flag (0x020)
EdictFlags |= FL_EDICT_DONTSEND; //Transmit State - Don't ever transmit.
SetEntData(myEntity, Offset_for_entity_effect, EffectFlags);
ChangeEdictState(myEntity, Offset_for_entity_effect);
SetEdictFlags(myEntity, EdictFlags);
}
}
}
コピー
コピー済み
コピー
コピー済み
SDKUnhook(
myE
ntity, SDKHook_SetTransmit, Func_SetTransmit);
SetEntData(entity, g_iEffectOffset, GetEntData(entity, g_iEffectOffset)|EF_NODRAW);
SetEdictFlags(entity, GetEdictFlags(entity)|FL_EDICT_DONTSEND);
ChangeEdictState(entity, g_iEffectOffset);
SDKUnhook(
e
ntity, SDKHook_SetTransmit, Func_SetTransmit);
}
}
保存された差分
原文
ファイルを開く
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <sdkhooks> #define PLUGIN_VERSION "1.0.1" #define SPRITE_BEAM "materials/sprites/laser.vmt" bool PL_Enabled; bool BM_ENABLED[MAXPLAYERS + 1]; bool CJ_ENABLED[MAXPLAYERS + 1]; int Offset_for_entity_effect = -1; int BrushEntityIndex[MAXPLAYERS + 1][1]; //Array of brush entities (trigger_teleport, func_nogrenades) int sprite; int halo; float FL_VelClient[MAXPLAYERS + 1][3]; ConVar g_pluginEnabled; Handle HudDisplay; public Plugin:myinfo = { name = "Height Finder", author = "Master Cake", description = "This plugin finds height", version = PLUGIN_VERSION, url = "" }; public OnPluginStart() { CreateConVar("hfind_version", PLUGIN_VERSION, "Height Finder Version", FCVAR_REPLICATED | FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY); g_pluginEnabled = CreateConVar("hfind_enabled", "1", "Enable Height Finder\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0); PL_Enabled = GetConVarBool(g_pluginEnabled); HookConVarChange(g_pluginEnabled, ConsoleVarChange); Offset_for_entity_effect = FindSendPropInfo("CBaseEntity", "m_fEffects"); //Find offset to "m_fEffects" property if (Offset_for_entity_effect == -1) SetFailState("m_fEffects property not found!"); RegConsoleCmd("sm_findh", HC_Command, "Command to enable Height Finder"); RegConsoleCmd("sm_checkjump", CJ_Command, "Command to enable jump checker"); RegAdminCmd("sm_brushmode", BM_Command, ADMFLAG_GENERIC, "Command to enable/disable brush mode"); RegAdminCmd("sm_nogrenades", NG_Command, ADMFLAG_GENERIC, "Command to show func_nogrenades brush entities"); RegAdminCmd("sm_stopnogrenades", SNG_Command, ADMFLAG_GENERIC, "Command to stop showing func_nogrenades brush entities"); RegAdminCmd("sm_teletriggers", TT_Command, ADMFLAG_GENERIC, "Command to show trigger_teleport brush entities"); RegAdminCmd("sm_stopteletriggers", STT_Command, ADMFLAG_GENERIC, "Command to stop showing trigger_teleport brush entities"); RegAdminCmd("sm_removent", RENT_Command, ADMFLAG_GENERIC, "Command to remove trigger_teleport and func_nogrenades brush entities"); RegAdminCmd("sm_getentindex", GEI_Command, ADMFLAG_GENERIC, "Command to get trigger_teleport and func_nogrenades index"); RegAdminCmd("sm_moventup", MEU_Command, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities up"); RegAdminCmd("sm_moventdown", MED_Command, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities down"); AutoExecConfig(true, "hfind"); HudDisplay = CreateHudSynchronizer(); } public OnMapStart() { sprite = PrecacheModel(SPRITE_BEAM); halo = PrecacheModel(SPRITE_BEAM); } public ConsoleVarChange(Handle:CVar, const String:oldValue[], const String:newValue[]) { if(CVar == g_pluginEnabled) { PL_Enabled = GetConVarBool(g_pluginEnabled); } } public OnClientPutInServer(myClient) { BM_ENABLED[myClient] = false; CJ_ENABLED[myClient] = false; BrushEntityIndex[myClient][0] = -1; } public int MenuHandler_func(Menu menu, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { delete menu; } } public Action:CJ_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient)) return Plugin_Continue; if (!CJ_ENABLED[myClient]) { CJ_ENABLED[myClient] = true; ReplyToCommand(myClient, "[SM] Jump Check Enabled!"); return Plugin_Continue; } if (CJ_ENABLED[myClient]) { CJ_ENABLED[myClient] = false; ReplyToCommand(myClient, "[SM] Jump Check Disabled!"); } return Plugin_Handled; } public Action:BM_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient)) return Plugin_Continue; if (!BM_ENABLED[myClient]) { BM_ENABLED[myClient] = true; ReplyToCommand(myClient, "[SM] Brush Mode Enabled!"); return Plugin_Continue; } if (BM_ENABLED[myClient]) { BM_ENABLED[myClient] = false; ReplyToCommand(myClient, "[SM] Brush Mode Disabled!"); } return Plugin_Handled; } public Action:RENT_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; int EntityCount = GetEntityCount(); char myClassName[50]; for (int myEntity = MaxClients + 1; myEntity <= EntityCount; ++myEntity) { if (IsValidEntity(myEntity)) { GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "trigger_teleport") || StrEqual(myClassName, "func_nogrenades")) { RemoveEntity(myEntity); } } } return Plugin_Handled; } public Action:STT_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; int EntityCouunt = GetEntityCount(); char myClassName[50]; for (int myEntity = MaxClients + 1; myEntity <= EntityCouunt; ++myEntity) { if (IsValidEntity(myEntity)) { GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "trigger_teleport")) { StopShowBrushEntity(myEntity); } } } return Plugin_Handled; } public Action:TT_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; int EntityCouunt = GetEntityCount(); char myClassName[50]; for (int myEntity = MaxClients + 1; myEntity <= EntityCouunt; ++myEntity) { if (IsValidEntity(myEntity)) { GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "trigger_teleport")) { ShowBrushEntity(myEntity); } } } return Plugin_Handled; } public Action:NG_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; int EntityCouunt = GetEntityCount(); char myClassName[50]; for (int myEntity = MaxClients + 1; myEntity <= EntityCouunt; ++myEntity) { if (IsValidEntity(myEntity)) { GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "func_nogrenades")) { ShowBrushEntity(myEntity); } } } return Plugin_Handled; } public Action:SNG_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; int EntityCouunt = GetEntityCount(); char myClassName[50]; for (int myEntity = MaxClients + 1; myEntity <= EntityCouunt; ++myEntity) { if (IsValidEntity(myEntity)) { GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "func_nogrenades")) { StopShowBrushEntity(myEntity); } } } return Plugin_Handled; } public Action:MED_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; if (args != 2) { ReplyToCommand(myClient, "Usage: sm_moventdown <index> <num of units>"); return Plugin_Handled; } char myArgs1[32]; GetCmdArg(1, myArgs1, sizeof(myArgs1)); int EntIndex = StringToInt(myArgs1); if (!IsValidEntity(EntIndex)) return Plugin_Handled; char myArgs2[32]; GetCmdArg(2, myArgs2, sizeof(myArgs2)); int num = StringToInt(myArgs2); if (num > 999) { ReplyToCommand(myClient, "Invalid value"); return Plugin_Handled; } else { float EntPos[3]; char typent[32]; GetEntityClassname(EntIndex, typent, sizeof(typent)); if (StrEqual(typent, "func_nogrenades") || StrEqual(typent, "trigger_teleport")) { GetEntPropVector(EntIndex, Prop_Send, "m_vecOrigin", EntPos); if (num == 0) { EntPos[2] += num; } else { EntPos[2] -= num; } TeleportEntity(EntIndex, EntPos, NULL_VECTOR, NULL_VECTOR); } } return Plugin_Handled; } public Action:MEU_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; if (args != 2) { ReplyToCommand(myClient, "Usage: sm_moventup <index> <num of units>"); return Plugin_Handled; } char myArgs1[32]; GetCmdArg(1, myArgs1, sizeof(myArgs1)); int EntIndex = StringToInt(myArgs1); if (!IsValidEntity(EntIndex)) return Plugin_Handled; char myArgs2[32]; GetCmdArg(2, myArgs2, sizeof(myArgs2)); int num = StringToInt(myArgs2); if (num > 999) { ReplyToCommand(myClient, "Invalid value"); return Plugin_Handled; } else { float EntPos[3]; char typent[32]; GetEntityClassname(EntIndex, typent, sizeof(typent)); if (StrEqual(typent, "func_nogrenades") || StrEqual(typent, "trigger_teleport")) { GetEntPropVector(EntIndex, Prop_Send, "m_vecOrigin", EntPos); if (num == 0) { EntPos[2] += num; } else { EntPos[2] += num; //Anyway LOL } TeleportEntity(EntIndex, EntPos, NULL_VECTOR, NULL_VECTOR); } } return Plugin_Handled; } public Action:GEI_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient) || !BM_ENABLED[myClient]) return Plugin_Continue; float FL_TargetPos[3]; float FL_PlayerPos[3]; float FL_PlayerAng[3]; GetClientEyePosition(myClient, FL_PlayerPos); GetClientEyeAngles(myClient, FL_PlayerAng); Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); if(TR_DidHit(myTrace)) { TR_GetEndPosition(FL_TargetPos, myTrace); TR_EnumerateEntities(FL_PlayerPos, FL_TargetPos, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, myClient); if (BrushEntityIndex[myClient][0] != -1) ReplyToCommand(myClient, "Entity Index: %i", BrushEntityIndex[myClient][0]); } delete myTrace; return Plugin_Handled; } public Action:HC_Command(myClient, args) { if(!PL_Enabled || !IsValidClient(myClient)) return Plugin_Continue; Menu menu = new Menu(MenuHandler_func); menu.SetTitle("Height Finder"); static float FL_TargetPos[3]; static float FL_PlayerPos[3]; static float FL_PlayerAbsPos[3]; static float FL_PlayerTempPos[3]; static float FL_PlayerAng[3]; static float FL_TargetVec[3]; GetClientEyePosition(myClient, FL_PlayerPos); GetClientAbsOrigin(myClient, FL_PlayerAbsPos); //Abs Origin GetClientEyeAngles(myClient, FL_PlayerAng); Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); if(TR_DidHit(myTrace)) { TR_GetEndPosition(FL_TargetPos, myTrace); TR_EnumerateEntities(FL_PlayerPos, FL_TargetPos, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, myClient); } delete myTrace; char distance[32]; char detent[32]; char typent[32]; SubtractVectors(FL_TargetPos, FL_PlayerAbsPos, FL_TargetVec); //Distance to the ground Format(distance, sizeof(distance), "Target height: %1.3f", FL_TargetVec[2]); if (BrushEntityIndex[myClient][0] != -1) Format(detent, sizeof(detent), "Brush entity: YES"); else Format(detent, sizeof(detent), "Brush entity: NO"); menu.AddItem("th", distance, ITEMDRAW_DISABLED); menu.AddItem("be", detent, ITEMDRAW_DISABLED); if (BrushEntityIndex[myClient][0] != -1) { GetEntityClassname(BrushEntityIndex[myClient][0], typent, sizeof(typent)); if (StrEqual(typent, "func_nogrenades")) Format(typent, sizeof(typent), "First detected: Nogrenade"); if (StrEqual(typent, "trigger_teleport")) Format(typent, sizeof(typent), "First detected: Teleport"); } else { Format(typent, sizeof(typent), "First detected: ---"); } menu.AddItem("fd", typent, ITEMDRAW_DISABLED); menu.Display(myClient, 30); int color[4]; color[0] = 255; color[1] = 255; color[2] = 255; color[3] = 255; TE_SetupBeamPoints(FL_PlayerAbsPos, FL_TargetPos, sprite, halo, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, color, 0); TE_SendToClient(myClient, 0.1); FL_PlayerTempPos = FL_PlayerAbsPos; FL_PlayerTempPos[2] = FL_TargetPos[2]; TE_SetupBeamPoints(FL_TargetPos, FL_PlayerTempPos, sprite, halo, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, color, 0); TE_SendToClient(myClient, 0.1); TE_SetupBeamPoints(FL_PlayerTempPos, FL_PlayerAbsPos, sprite, halo, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, color, 0); TE_SendToClient(myClient, 0.1); return Plugin_Handled; } public Action:OnPlayerRunCmd(myClient, &myButtons, &myImpulse, Float:myVel[3], Float:myAng[3], &myWeapon) { if(!PL_Enabled || !IsValidClient(myClient)) return Plugin_Continue; if (CJ_ENABLED[myClient]) { GetEntPropVector(myClient, Prop_Data, "m_vecAbsVelocity", FL_VelClient[myClient]); if (FL_VelClient[myClient][2] > 0.0) { static float FL_TargetPos[3]; static float FL_PlayerPos[3]; static float FL_PlayerAng[3]; FL_PlayerAng[0] = 90.0; FL_PlayerAng[1] = 0.0; FL_PlayerAng[2] = 0.0; static float FL_TargetVec[3]; GetClientAbsOrigin(myClient, FL_PlayerPos); Handle myTrace = TR_TraceRayFilterEx(FL_PlayerPos, FL_PlayerAng, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); if(TR_DidHit(myTrace)) { TR_GetEndPosition(FL_TargetPos, myTrace); } delete myTrace; SubtractVectors(FL_PlayerPos, FL_TargetPos, FL_TargetVec); //Distance to the ground ClearSyncHud(myClient, HudDisplay); SetHudTextParams(0.65, 0.55, 5.0, 255, 255, 255, 255, 0, 0.1, 0.1, 0.1); ShowSyncHudText(myClient, HudDisplay, "Your max height: %1.3f", FL_TargetVec[2]); return Plugin_Continue; } } return Plugin_Continue; } public bool TraceFilterEntity(int myEntity, int myMask) { return (myEntity == 0 || myEntity > MaxClients); //0 - server console } public bool DetectTrigger(int myEntity, int myClient) { char myClassName[50]; GetEntityClassname(myEntity, myClassName, sizeof(myClassName)); if (StrEqual(myClassName, "trigger_teleport") || StrEqual(myClassName, "func_nogrenades")) { BrushEntityIndex[myClient][0] = myEntity; return false; } else { BrushEntityIndex[myClient][0] = -1; return true; } } public Action Func_SetTransmit(int entity, int myClient) { if (!BM_ENABLED[myClient]) { return Plugin_Handled; //Disable trigger_teleport transmit to the client (if plugin is disabled for current player in array) } return Plugin_Continue; } /////////////////////////////// <-- STOCKS --> //////////////////////////////////////////////// /** * Checks client validity * @param myEntity Entity index. * @param Replay Logical bool parameter. */ stock bool:IsValidClient(myClient, bool:Replay = true) { if(myClient <= 0 || myClient > MaxClients || !IsClientInGame(myClient)) return false; if(Replay && (IsClientSourceTV(myClient) || IsClientReplay(myClient) || IsClientObserver(myClient))) return false; return true; } /** * Sets transmit state to the edict and flag (shows brush entity - func_nogrenades, trigger_teleport) * @param myEntity Entity index. */ stock void ShowBrushEntity(int myEntity) { if (IsValidEdict(myEntity)) { int EffectFlags = GetEntData(myEntity, Offset_for_entity_effect); int EdictFlags = GetEdictFlags(myEntity); if (myEntity != -1) { EffectFlags &= ~32; //EF_NODRAW flag (0x020) EdictFlags &= ~FL_EDICT_DONTSEND; //Transmit State - Don't ever transmit. SetEntData(myEntity, Offset_for_entity_effect, EffectFlags); ChangeEdictState(myEntity, Offset_for_entity_effect); SetEdictFlags(myEntity, EdictFlags); } } SDKHook(myEntity, SDKHook_SetTransmit, Func_SetTransmit); } /** * Sets transmit state to the edict and flag (stops showing brush entities - func_nogrenades, trigger_teleport) * @param myEntity Entity index. */ stock void StopShowBrushEntity(int myEntity) { if (IsValidEdict(myEntity)) { int EffectFlags = GetEntData(myEntity, Offset_for_entity_effect); int EdictFlags = GetEdictFlags(myEntity); if (myEntity != -1) { EffectFlags |= 32; //EF_NODRAW flag (0x020) EdictFlags |= FL_EDICT_DONTSEND; //Transmit State - Don't ever transmit. SetEntData(myEntity, Offset_for_entity_effect, EffectFlags); ChangeEdictState(myEntity, Offset_for_entity_effect); SetEdictFlags(myEntity, EdictFlags); } } SDKUnhook(myEntity, SDKHook_SetTransmit, Func_SetTransmit); }
変更されたテキスト
ファイルを開く
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #include <sdkhooks> #define PLUGIN_VERSION "1.0.2" #define SPRITE_BEAM "materials/sprites/laser.vmt" bool g_bEnabled; bool g_bBrushMode[MAXPLAYERS + 1]; bool g_bCheckJump[MAXPLAYERS + 1]; int g_iEffectOffset = -1; int g_iBrushEntity[MAXPLAYERS + 1]; //Array of brush entities (trigger_teleport, func_nogrenades) int g_iSpritePrecache; int g_iHaloPrecache; float g_fVelocity[MAXPLAYERS + 1][3]; ConVar g_cvarEnabled; Handle g_hHudSync; public Plugin myinfo = { name = "Height Finder", author = "Master Cake", description = "This plugin finds height", version = PLUGIN_VERSION, url = "" }; public void OnPluginStart() { CreateConVar("hfind_version", PLUGIN_VERSION, "Height Finder Version", FCVAR_SPONLY | FCVAR_DONTRECORD | FCVAR_NOTIFY); g_cvarEnabled = CreateConVar("hfind_enabled", "1", "Enable Height Finder\n0 = Disabled\n1 = Enabled", _, true, 0.0, true, 1.0); g_bEnabled = GetConVarBool(g_cvarEnabled); HookConVarChange(g_cvarEnabled, ConsoleVarChange); g_iEffectOffset = FindSendPropInfo("CBaseEntity", "m_fEffects"); //Find offset to "m_fEffects" property if (g_iEffectOffset == -1) { SetFailState("m_fEffects property not found!"); } RegConsoleCmd("sm_findh", cmdFindHeight, "Command to enable Height Finder"); RegConsoleCmd("sm_checkjump", cmdCheckJump, "Command to enable jump checker"); RegAdminCmd("sm_brushmode", cmdBrushMode, ADMFLAG_GENERIC, "Command to enable/disable brush mode"); RegAdminCmd("sm_nogrenades", cmdEnableNoGrenade, ADMFLAG_GENERIC, "Command to show func_nogrenades brush entities"); RegAdminCmd("sm_stopnogrenades", cmdDisableNoGrenade, ADMFLAG_GENERIC, "Command to stop showing func_nogrenades brush entities"); RegAdminCmd("sm_teletriggers", cmdEnableTeleTrigger, ADMFLAG_GENERIC, "Command to show trigger_teleport brush entities"); RegAdminCmd("sm_stopteletriggers", cmdDisableTeleTrigger, ADMFLAG_GENERIC, "Command to stop showing trigger_teleport brush entities"); RegAdminCmd("sm_removent", cmdRemoveEntities, ADMFLAG_GENERIC, "Command to remove trigger_teleport and func_nogrenades brush entities"); RegAdminCmd("sm_getentindex", cmdGetEntityIndex, ADMFLAG_GENERIC, "Command to get trigger_teleport and func_nogrenades index"); RegAdminCmd("sm_movent", cmdMoveEnt, ADMFLAG_GENERIC, "Command to move trigger_teleport and func_nogrenades brush entities"); AutoExecConfig(true, "hfind"); g_hHudSync = CreateHudSynchronizer(); } public void OnMapStart() { g_iSpritePrecache = PrecacheModel(SPRITE_BEAM); g_iHaloPrecache = PrecacheModel(SPRITE_BEAM); } public void ConsoleVarChange(ConVar cvar, const char[] oldValue, const char[] newValue) { g_bEnabled = GetConVarBool(cvar); } public void OnClientPutInServer(int client) { g_bBrushMode[client] = false; g_bCheckJump[client] = false; g_iBrushEntity[client] = -1; } public int MenuHandler_func(Menu menu, MenuAction action, int param1, int param2) { if (action == MenuAction_End) { delete menu; } } public Action cmdCheckJump(int client, int args) { if (g_bEnabled && client) { g_bCheckJump[client] = !g_bCheckJump[client]; ReplyToCommand(client, "[SM] Jump Check %s!", g_bCheckJump[client] ? "Enabled" : "Disabled"); } return Plugin_Handled; } public Action cmdBrushMode(int client, int args) { if (g_bEnabled && client) { g_bBrushMode[client] = !g_bBrushMode[client]; ReplyToCommand(client, "[SM] Brush Mode %s!", g_bBrushMode[client] ? "Enabled" : "Disabled"); } return Plugin_Handled; } public Action cmdRemoveEntities(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } char className[32]; for (int i = MaxClients + 1; i <= 2048; ++i) { if (IsValidEntity(i)) { GetEntityClassname(i, className, sizeof(className)); if (StrEqual(className, "trigger_teleport") || StrEqual(className, "func_nogrenades")) { RemoveEntity(i); } } } return Plugin_Handled; } public Action cmdDisableTeleTrigger(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } char className[32]; for (int i = MaxClients + 1; i <= 2048; ++i) { if (IsValidEntity(i)) { GetEntityClassname(i, className, sizeof(className)); if (StrEqual(className, "trigger_teleport")) { StopShowBrushEntity(i); } } } return Plugin_Handled; } public Action cmdEnableTeleTrigger(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } char className[32]; for (int i = MaxClients + 1; i <= 2048; ++i) { if (IsValidEntity(i)) { GetEntityClassname(i, className, sizeof(className)); if (StrEqual(className, "trigger_teleport")) { ShowBrushEntity(i); } } } return Plugin_Handled; } public Action cmdEnableNoGrenade(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } char className[32]; for (int i = MaxClients + 1; i <= 2048; ++i) { if (IsValidEntity(i)) { GetEntityClassname(i, className, sizeof(className)); if (StrEqual(className, "func_nogrenades")) { ShowBrushEntity(i); } } } return Plugin_Handled; } public Action cmdDisableNoGrenade(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } char className[32]; for (int i = MaxClients + 1; i <= 2048; ++i) { if (IsValidEntity(i)) { GetEntityClassname(i, className, sizeof(className)); if (StrEqual(className, "func_nogrenades")) { StopShowBrushEntity(i); } } } return Plugin_Handled; } public Action cmdMoveEnt(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } if (args != 2) { ReplyToCommand(client, "Usage: sm_moventup <index> <num of units>"); return Plugin_Handled; } char arg1[32]; GetCmdArg(1, arg1, sizeof(arg1)); int entity = StringToInt(arg1); if (!IsValidEntity(entity)) { return Plugin_Handled; } char arg2[32]; GetCmdArg(2, arg2, sizeof(arg2)); int distance = StringToInt(arg2); if (!distance || distance > 999 || distance < -999) { ReplyToCommand(client, "Invalid value"); return Plugin_Handled; } char className[32]; GetEntityClassname(entity, className, sizeof(className)); if (StrEqual(className, "func_nogrenades") || StrEqual(className, "trigger_teleport")) { float origin[3]; GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin); origin[2] += distance; TeleportEntity(entity, origin, NULL_VECTOR, NULL_VECTOR); } return Plugin_Handled; } public Action cmdGetEntityIndex(int client, int args) { if (!g_bEnabled || !client || !g_bBrushMode[client]) { return Plugin_Handled; } float eyeOrigin[3]; GetClientEyePosition(client, eyeOrigin); float eyeAngle[3]; GetClientEyeAngles(client, eyeAngle); Handle tr = TR_TraceRayFilterEx(eyeOrigin, eyeAngle, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); if (TR_DidHit(tr)) { float endPoint[3]; TR_GetEndPosition(endPoint, tr); TR_EnumerateEntities(eyeOrigin, endPoint, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, client); if (g_iBrushEntity[client] != -1) { ReplyToCommand(client, "Entity Index: %i", g_iBrushEntity[client]); } } delete tr; return Plugin_Handled; } public Action cmdFindHeight(int client, int args) { if (!g_bEnabled || !client) { return Plugin_Handled; } Menu menu = new Menu(MenuHandler_func); menu.SetTitle("Height Finder"); float eyeOrigin[3]; GetClientEyePosition(client, eyeOrigin); float playerOrigin[3]; GetClientAbsOrigin(client, playerOrigin); //Abs Origin float eyeAngle[3]; GetClientEyeAngles(client, eyeAngle); Handle myTrace = TR_TraceRayFilterEx(eyeOrigin, eyeAngle, MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); float endPoint[3]; if (TR_DidHit(myTrace)) { TR_GetEndPosition(endPoint, myTrace); TR_EnumerateEntities(eyeOrigin, endPoint, PARTITION_TRIGGER_EDICTS, RayType_EndPoint, DetectTrigger, client); } delete myTrace; char buffer[32]; float difference[3]; SubtractVectors(endPoint, playerOrigin, difference); //Distance to the ground FormatEx(buffer, sizeof(buffer), "Target height: %1.3f", difference[2]); menu.AddItem("", buffer, ITEMDRAW_DISABLED); FormatEx(buffer, sizeof(buffer), "Brush entity: %s", g_iBrushEntity[client] != -1 ? "YES" : "NO"); menu.AddItem("", buffer, ITEMDRAW_DISABLED); if (g_iBrushEntity[client] != -1) { GetEntityClassname(g_iBrushEntity[client], buffer, sizeof(buffer)); if (StrEqual(buffer, "func_nogrenades")) { Format(buffer, sizeof(buffer), "First detected: Nogrenade"); } else if (StrEqual(buffer, "trigger_teleport")) { Format(buffer, sizeof(buffer), "First detected: Teleport"); } } else { Format(buffer, sizeof(buffer), "First detected: ---"); } menu.AddItem("", buffer, ITEMDRAW_DISABLED); menu.Display(client, 30); TE_SetupBeamPoints(playerOrigin, endPoint, g_iSpritePrecache, g_iHaloPrecache, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, {255, 255, 255, 255}, 0); TE_SendToClient(client, 0.1); float temp[3]; temp[0] = playerOrigin[0]; temp[1] = playerOrigin[1]; temp[2] = endPoint[2]; TE_SetupBeamPoints(endPoint, temp, g_iSpritePrecache, g_iHaloPrecache, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, {255, 255, 255, 255}, 0); TE_SendToClient(client, 0.1); TE_SetupBeamPoints(temp, playerOrigin, g_iSpritePrecache, g_iHaloPrecache, 0, 0, 7.0, 5.0, 5.0, 1, 0.0, {255, 255, 255, 255}, 0); TE_SendToClient(client, 0.1); return Plugin_Handled; } public Action OnPlayerRunCmd(int client, int &buttons) { if (!g_bEnabled || !g_bCheckJump[client]) { return Plugin_Continue; } GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", g_fVelocity[client]); if (g_fVelocity[client][2] <= 0.0) { return Plugin_Continue; } float playerOrigin[3]; GetClientAbsOrigin(client, playerOrigin); Handle tr = TR_TraceRayFilterEx(playerOrigin, view_as<float>({90.0, 0.0, 0.0}), MASK_PLAYERSOLID, RayType_Infinite, TraceFilterEntity); float endPoint[3]; if (TR_DidHit(tr)) { TR_GetEndPosition(endPoint, tr); float difference[3]; SubtractVectors(playerOrigin, endPoint, difference); //Distance to the ground SetHudTextParams(0.65, 0.55, 5.0, 255, 255, 255, 255, 0, 0.1, 0.1, 0.1); ShowSyncHudText(client, g_hHudSync, "Your max height: %1.3f", difference[2]); } delete tr; return Plugin_Continue; } public bool TraceFilterEntity(int entity, int mask) { return !entity || entity > MaxClients; } public bool DetectTrigger(int entity, int client) { char className[32]; GetEntityClassname(entity, className, sizeof(className)); if (StrEqual(className, "trigger_teleport") || StrEqual(className, "func_nogrenades")) { g_iBrushEntity[client] = entity; return false; } g_iBrushEntity[client] = -1; return true; } public Action Func_SetTransmit(int entity, int client) { if (!g_bBrushMode[client]) { //Disable trigger_teleport transmit to the client (if plugin is disabled for current player in array) return Plugin_Handled; } return Plugin_Continue; } /////////////////////////////// <-- STOCKS --> //////////////////////////////////////////////// #define EF_NODRAW 0x020 /** * Sets transmit state to the edict and flag (shows brush entity - func_nogrenades, trigger_teleport) * @param entity Entity index. */ void ShowBrushEntity(int entity) { if (!IsValidEdict(entity)) { return; } SetEntData(entity, g_iEffectOffset, GetEntData(entity, g_iEffectOffset) & ~EF_NODRAW); SetEdictFlags(entity, GetEdictFlags(entity) & ~FL_EDICT_DONTSEND); ChangeEdictState(entity, g_iEffectOffset); SDKHook(entity, SDKHook_SetTransmit, Func_SetTransmit); } /** * Sets transmit state to the edict and flag (stops showing brush entities - func_nogrenades, trigger_teleport) * @param entity Entity index. */ void StopShowBrushEntity(int entity) { if (!IsValidEdict(entity)) { return; } SetEntData(entity, g_iEffectOffset, GetEntData(entity, g_iEffectOffset)|EF_NODRAW); SetEdictFlags(entity, GetEdictFlags(entity)|FL_EDICT_DONTSEND); ChangeEdictState(entity, g_iEffectOffset); SDKUnhook(entity, SDKHook_SetTransmit, Func_SetTransmit); }
違いを見つける