Участник
Пользователь
- Сообщения
- 213
- Реакции
- 71
- Помог
- 2 раз(а)
Неверный раздел форума
- Ошибка
-
I would like the plugin to function for all players and administrators without necessitating the utilization of the HOOK.ini file.
- ОС
- Windows
- Amx Mod X
-
AMX Mod X 1.9.0.5271 (http://www.amxmodx.org)
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.10.0.760-dev
Build date: 13:06:48 Jun 23 2021 (2629)
- ReGamedll
-
ReGameDLL version: 5.20.0.516-dev
- Версия Metamod
-
Metamod-r build: 17:47:54 Aug 24 2018
- Список метамодулей
-
N/A
- Список плагинов
-
N/A
- Автор плагина
- StudenT
- Версия плагина
- 1.0
- Исходный код
-
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define PLUGIN "Hook"
#define VERSION "1.0"
#define AUTHOR "StudenT"
new hookorigin[32][3], Sprite, g_Load[81], szPlayerHook[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("+hook", "HookOn")
register_clcmd("-hook", "HookOff")
}
public plugin_cfg()
{
get_configsdir(g_Load, charsmax(g_Load))
formatex(g_Load, charsmax(g_Load), "%s/Hook.ini", g_Load)
}
public plugin_precache()
{
precache_sound("Hook/Hook.wav")
Sprite = precache_model("sprites/Hook/Hook.spr")
}
public client_disconnect(id)
remove_hook(id)
public client_connect(id)
{
remove_hook(id)
set_task(1.0, "Check", id)
}
public client_infochanged(id)
{
szPlayerHook[id] = false
set_task(1.0, "Check", id)
}
public Check(id)
{
new szName[32], szSteamID[35], szIP[32]
new szParseText[64], szParseName[35]
new szLine, szNum
get_user_name(id, szName, charsmax(szName))
get_user_authid(id, szSteamID, charsmax(szSteamID))
get_user_ip(id, szIP, 31,1)
for(szLine=0;read_file(g_Load, szLine, szParseText, charsmax(szParseText), szNum);szLine++)
{
if(szNum > 0 && szParseText[0] != ';')
{
parse(szParseText, szParseName, charsmax(szParseName))
if(equal(szName, szParseName) || equal(szSteamID, szParseName) || equal(szIP, szParseName))
{
szPlayerHook[id] = true
break
}
}
}
}
public HookOn(id)
{
if(szPlayerHook[id])
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
get_user_origin(id,hookorigin[id-1],3)
if(callfunc_begin("detect_cheat","prokreedz.amxx") == 1)
{
callfunc_push_int(id)
callfunc_push_str("Hook")
callfunc_end()
}
emit_sound(id, CHAN_STATIC, "Hook/Hook.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(0.1, "hook_task", id, "", 0, "ab")
hook_task(id)
}
return PLUGIN_HANDLED
}
public HookOff(id)
{
remove_hook(id)
return PLUGIN_HANDLED
}
public hook_task(id)
{
if(!is_user_alive(id))
remove_hook(id)
remove_beam(id)
draw_hook(id)
new origin[3], Float:velocity[3]
get_user_origin(id,origin)
new distance = get_distance(hookorigin[id-1],origin)
if(distance > 25)
{
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (2.0 * 300 / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (2.0 * 300 / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (2.0 * 300 / distance)
entity_set_vector(id,EV_VEC_velocity,velocity)
}
else
{
entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})
remove_hook(id)
}
}
public draw_hook(id)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(1) // TE_BEAMENTPOINT
write_short(id) // entid
write_coord(hookorigin[id-1][0]) // origin
write_coord(hookorigin[id-1][1]) // origin
write_coord(hookorigin[id-1][2]) // origin
write_short(Sprite) // sprite index
write_byte(0) // start frame
write_byte(0) // framerate
write_byte(100) // life
write_byte(10) // width
write_byte(0) // noise
write_byte(255) // r
write_byte(255) // g
write_byte(255) // b
write_byte(150) // brightness
write_byte(0) // speed
message_end()
}
public remove_hook(id)
{
if(task_exists(id))
remove_task(id)
remove_beam(id)
}
public remove_beam(id)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(99) // TE_KILLBEAM
write_short(id)
message_end()
}
Instead of adding the player's nickname, IP address, or SteamID to the HOOK.ini file, which grants them hook authorization, I would like the plugin to function for all players on the server without requiring this information.