diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce2765a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.smx +plugins/*.smx \ No newline at end of file diff --git a/Facti13_vote/FV.sp b/Facti13_vote/FV.sp new file mode 100644 index 0000000..ccf6306 --- /dev/null +++ b/Facti13_vote/FV.sp @@ -0,0 +1,64 @@ +#include +#include "modules/extra.sp" + +#define _root_debug + +#define _mute +#if defined _mute +#include "modules/mute.sp" +#endif + +#define _kick +#if defined _kick +#include "modules/kick.sp" +#endif + + +#if defined _vipblock +#include "modules/vipblock.sp" +#endif + +public void OnPluginStart(){ + #if defined _mute + MuteVoteOn(); + #endif + #if defined _kick + KickVoteOn() + #endif + #if defined _vipblock + VIPBlockVoteOn(); + #endif +} + +public void OnPluginEnd(){ + #if defined _mute + MuteVoteOff(); + #endif + #if defined _kick + KickVoteOff() + #endif + #if defined _vipblock + VIPBlockVoteOff(); + #endif +} + +public void OnClientPostAdminCheck(int client){ + #if defined _mute + MuteCheckState(client); + #endif + #if defined _vipblock + VIPBlockCheckCookie(client); + #endif +} + +public void OnClientDisconnect(int client){ + #if defined _mute + MuteClearPlayerVotes(client); + #endif + #if defined _kick + KickClearPlayerVotes(client); + #endif + #if defined _vipblock + VIPBlockClearPlayerVotes(client, false); + #endif +} \ No newline at end of file diff --git a/Facti13_vote/modules/extra.sp b/Facti13_vote/modules/extra.sp new file mode 100644 index 0000000..0639bd7 --- /dev/null +++ b/Facti13_vote/modules/extra.sp @@ -0,0 +1,91 @@ +#include +#define TF2_MAXPLAYERS 101 +#define _one_person + +#define VOTE_NO "###no###" +#define VOTE_YES "###yes###" + +g_CurrentVoteTarget = 0; + +/*stock DisplayVote(int client, int target, &Callback, const char[] phrare, const char[] menu_phrare, bool random = true){ + g_CurrentVoteTarget = GetClientUserId(target); + + PrintToChatAll(phrare, client, target); + PrintCenterTextAll(phrare, client, target); + + Handle VoteMenuProcessing = new Menu(Callback, MENU_ACTIONS_ALL); + SetMenuTitle(VoteMenuProcessing, menu_phrare); + if(random){ + int range_a = 6, range_b = 10; + int yes = GetRandomInt(range_a, range_b); + for(int i = range_a; i < range_b; i++){ + if(i == yes) AddMenuItem(VoteMenuProcessing, VOTE_YES, "ДА"); + else AddMenuItem(VoteMenuProcessing, VOTE_NO, "НЕТ НЕ НАДО"); + } + } else { + AddMenuItem(VoteMenuProcessing, VOTE_YES, "ДА"); + AddMenuItem(VoteMenuProcessing, VOTE_NO, "НЕТ НЕ НАДО"); + } + + SetMenuExitButton(VoteMenuProcessing, false); + VoteMenuToAll(VoteMenuProcessing, 20); +} +*/ + +bool TestVoteDelay(int client){ + int delay = CheckVoteDelay(); + + if (delay > 0) + { + if (delay > 60) + { + ReplyToCommand(client, "Чтоб начать новое голосование нужно подождать %i минут!", (delay / 60)); + } + else + { + ReplyToCommand(client, "Чтоб начать новое голосование нужно подождать %i секунд!", delay); + } + + return false; + } + + return true; +} + +stock ClearPlayerVotes(int client, int[][] votes){ + for(int sub_client = 0; sub_client < TF2_MAXPLAYERS; sub_client++){ + votes[client][sub_client] = 0; + votes[sub_client][client] = 0; + } +} + +stock int ReturnVoteCount(int client, int[][] votes){ + int count = 0; + for(int i = 1; i <= TF2_MAXPLAYERS; i++){ + if(votes[client][i]) count++; + } + return count; +} + +stock int CalcNeedCount(float count){ + float current_player_count = float(GetClientCount()); + return RoundToCeil(current_player_count * count); +} + +stock bool IsValidClient(int client){ + + if(client > 4096){ + client = EntRefToEntIndex(client); + } + + if(client < 1 || client > MaxClients) return false; + + if(!IsClientInGame(client)) return false; + + if(IsFakeClient(client)) return false; + + if(GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false; + + return true; + +} \ No newline at end of file diff --git a/Facti13_vote/modules/kick.sp b/Facti13_vote/modules/kick.sp new file mode 100644 index 0000000..d285f2c --- /dev/null +++ b/Facti13_vote/modules/kick.sp @@ -0,0 +1,104 @@ +#include + +float g_kick_need_count = 0.3; + +int g_kick_player_votes[TF2_MAXPLAYERS][TF2_MAXPLAYERS]; +Handle g_kick_timer = INVALID_HANDLE; +char g_kick_votecmd[32] = "sm_votekick"; + +#define KICK_VOTE_COMPLETE "Игрок %N был кикнут по итогу подсчетов голосов!" +#define KICK_VOTE_VOTED "Игрок %N проголосовал за кик игрока %N. Проголосовать за: !votekick в чат или через меню." + +stock bool KickCheckVotes(int client){ + if(ReturnVoteCount(client, g_kick_player_votes) >= CalcNeedCount(g_kick_need_count)){ + KickPlayer(client); + return true; + } else { + return false; + } +} + +stock KickClearPlayerVotes(int client){ + ClearPlayerVotes(client, g_kick_player_votes); +} + +stock KickPlayer(int client){ + PrintCenterTextAll(KICK_VOTE_COMPLETE, client); + PrintToChatAll(KICK_VOTE_COMPLETE, client); + KickClient(client, "votekick"); +} + +stock KickVoteOn(){ + if(g_kick_timer != INVALID_HANDLE) KillTimer(g_kick_timer); + else g_kick_timer = CreateTimer(5.0, CallbackKickTimer, _, TIMER_REPEAT); + RegConsoleCmd(g_kick_votecmd, CommandKickVote, "Vote for kick player on server"); + PrintToServer("[FV] [VoteKick] support enable"); +} + +stock KickVoteOff(){ + if(g_kick_timer != INVALID_HANDLE) KillTimer(g_kick_timer); +} + +stock DisplayKickMenu(int client){ + Handle KickMenu = CreateMenu(CallbackKickBuildMenu); + SetMenuTitle(KickMenu, "Кикнуть игрока:"); + char menu_line[64]; + char player_uid[32]; + for(int player = 1; player <= MaxClients; player++){ + if(IsValidClient(player)){ + //if(player == client) continue; + if(CheckCommandAccess(player, "", ADMFLAG_BAN)) continue; + Format(player_uid, sizeof(player_uid), "%i", GetClientUserId(player)); + + if(g_kick_player_votes[player][client] == 0) { + Format(menu_line, sizeof(menu_line), "%N [%i/%i]", player, ReturnVoteCount(player, g_kick_player_votes), CalcNeedCount(g_kick_need_count)); + AddMenuItem(KickMenu, player_uid, menu_line); + } else { + Format(menu_line, sizeof(menu_line), "%N [Ты проголосовал]", player); + AddMenuItem(KickMenu, player_uid, menu_line, ITEMDRAW_DISABLED); + } + } + } + if(GetMenuItemCount(KickMenu) == 0){ + PrintCenterText(client, "Незакого голосовать, ты один на сервере"); + return; + } + DisplayMenu(KickMenu, client, 0); + return; +} + +stock CallbackKickBuildMenu(Handle KickMenu, MenuAction action, int client, int pos){ + switch(action){ + case MenuAction_Select:{ + char player_uid[32]; + GetMenuItem(KickMenu, pos, player_uid, sizeof(player_uid)); + int player = GetClientOfUserId(StringToInt(player_uid)); + if(player == 0){ + PrintCenterText(client, "Увы игрок вышел!"); + return; + } + + g_kick_player_votes[player][client] = 1; + if(!KickCheckVotes(player)) PrintCenterTextAll(KICK_VOTE_VOTED, client, player); + + } + case MenuAction_End: delete KickMenu; + } + return; +} + +stock Action CallbackKickTimer(Handle timer){ + for(int client = 1; client <= MaxClients; client++){ + if(IsValidClient(client)) KickCheckVotes(client); + } +} + +public Action CommandKickVote(int client, int args){ + if (client == 0) + { + ReplyToCommand(client, "Cannot use command from RCON."); + return Plugin_Handled; + } + DisplayKickMenu(client); + return Plugin_Handled; +} \ No newline at end of file diff --git a/Facti13_vote/modules/mute.sp b/Facti13_vote/modules/mute.sp new file mode 100644 index 0000000..b62393d --- /dev/null +++ b/Facti13_vote/modules/mute.sp @@ -0,0 +1,124 @@ +#include +#include + +//#include "extra.sp" + +int g_mute_player_votes[TF2_MAXPLAYERS][TF2_MAXPLAYERS]; +bool g_mute_player_voted[TF2_MAXPLAYERS]; +float g_mute_need_count = 0.3; +Handle g_mute_timer = INVALID_HANDLE; +char g_mute_votecmd[32] = "sm_votemute"; + +#define MUTE_VOTE_COMPLETE "Игрок %N был выключен микрофон по итогу подсчетов голосов!" +#define MUTE_VOTE_VOTED "Игрок %N проголосовал за выключение микрофона игрока %N. Проголосовать за: !votemute в чат или через меню." + +stock MuteCheckState(int client){ + if(GetClientListeningFlags(client) == VOICE_MUTED) g_mute_player_voted[client] = true; +} + +stock bool MuteCheckVotes(int client){ + if(ReturnVoteCount(client, g_mute_player_votes) >= CalcNeedCount(g_mute_need_count)){ + MutePlayer(client); + return true; + } else { + return false; + } +} + +stock MuteClearPlayerVotes(int client){ + g_mute_player_voted[client] = false; + ClearPlayerVotes(client, g_mute_player_votes); +} + +stock MutePlayer(int client){ + PrintCenterTextAll(MUTE_VOTE_COMPLETE, client); + PrintToChatAll(MUTE_VOTE_COMPLETE, client); + MuteClearPlayerVotes(client); + g_mute_player_voted[client] = true; + if(CommandExists("sm_fsb_mute")){ + ServerCommand("sm_fsb_mute #%i 900 vote", GetClientUserId(client)); + } else { + SetClientListeningFlags(client, VOICE_MUTED); + } +} + +stock MuteVoteOn(){ + if(g_mute_timer != INVALID_HANDLE) KillTimer(g_mute_timer); + else g_mute_timer = CreateTimer(5.0, CallbackMuteTimer, _, TIMER_REPEAT); + RegConsoleCmd(g_mute_votecmd, CommandMuteVote, "Vote for mute player on server"); + PrintToServer("[FV] [VoteMute] support enable"); + for(int client = 1; client <= MaxClients; client++){ + if(IsValidClient(client)) MuteCheckState(client); + } +} + +stock MuteVoteOff(){ + if(g_mute_timer != INVALID_HANDLE) KillTimer(g_mute_timer); +} + +stock DisplayMuteMenu(int client){ + Handle MuteMenu = CreateMenu(CallbackMuteBuildMenu); + SetMenuTitle(MuteMenu, "Выключить микрофон у:"); + char menu_line[64]; + char player_uid[32]; + for(int player = 1; player <= MaxClients; player++){ + if(IsValidClient(player)){ + //if(player == client) continue; + if(CheckCommandAccess(player, "", ADMFLAG_BAN)) continue; + Format(player_uid, sizeof(player_uid), "%i", GetClientUserId(player)); + if(g_mute_player_voted[player]){ + Format(menu_line, sizeof(menu_line), "%N [Выключен микрофон]", player); + AddMenuItem(MuteMenu, player_uid, menu_line, ITEMDRAW_DISABLED); + } + else if(g_mute_player_votes[player][client] == 0) { + Format(menu_line, sizeof(menu_line), "%N [%i/%i]", player, ReturnVoteCount(player, g_mute_player_votes), CalcNeedCount(g_mute_need_count)); + AddMenuItem(MuteMenu, player_uid, menu_line); + } else { + Format(menu_line, sizeof(menu_line), "%N [Ты проголосовал]", player); + AddMenuItem(MuteMenu, player_uid, menu_line, ITEMDRAW_DISABLED); + } + } + } + if(GetMenuItemCount(MuteMenu) == 0){ + PrintCenterText(client, "Незакого голосовать, ты один на сервере"); + return; + } + DisplayMenu(MuteMenu, client, 0); + return; +} + +stock CallbackMuteBuildMenu(Handle MuteMenu, MenuAction action, int client, int pos){ + switch(action){ + case MenuAction_Select:{ + char player_uid[32]; + GetMenuItem(MuteMenu, pos, player_uid, sizeof(player_uid)); + int player = GetClientOfUserId(StringToInt(player_uid)); + if(player == 0){ + PrintCenterText(client, "Увы игрок вышел!"); + return; + } + + g_mute_player_votes[player][client] = 1; + if(!MuteCheckVotes(player)) PrintCenterTextAll(MUTE_VOTE_VOTED, client, player); + + } + case MenuAction_End: delete MuteMenu; + } + return; +} + +stock Action CallbackMuteTimer(Handle timer){ + for(int client = 1; client <= MaxClients; client++){ + if(IsValidClient(client)) MuteCheckVotes(client); + } +} + +public Action CommandMuteVote(int client, int args){ + if (client == 0) + { + ReplyToCommand(client, "Cannot use command from RCON."); + return Plugin_Handled; + } + DisplayMuteMenu(client); + return Plugin_Handled; +} \ No newline at end of file diff --git a/Facti13_vote/modules/vipblock.sp b/Facti13_vote/modules/vipblock.sp new file mode 100644 index 0000000..4b56060 --- /dev/null +++ b/Facti13_vote/modules/vipblock.sp @@ -0,0 +1,208 @@ +#include +#include +#include "extra.sp" + +#define VIP_COMMANDS_COUNT 4 +char g_vipblock_commands[VIP_COMMANDS_COUNT][32] = {"sm_rof", "sm_aia", "sm_sethealth", "sm_speedme"}; +char g_vipblock_commands_disable[VIP_COMMANDS_COUNT][32] = {"sm_rof #%i 1", "sm_aia #%i 0", "sm_sethealth %i 0", "sm_speed %i 360"}; + +int g_vipblock_player_votes[TF2_MAXPLAYERS][TF2_MAXPLAYERS]; +float g_vipblock_need_count = 0.3; +int g_vipblock_player_settime[TF2_MAXPLAYERS]; +int g_vipblock_blocktime = 900; +Handle g_vipblock_timer = INVALID_HANDLE; +char g_vipblock_votecmd[32] = "sm_votevip"; +Handle g_vipblock_cookie = INVALID_HANDLE; + +#define VIPBLOCK_VOTE_COMPLETE "У игрок %N был ограничен по итогу подсчетов голосов!" +#define VIPBLOCK_VOTE_VOTED "Игрок %N проголосовал за блокировку VIP у игрока %N. Проголосовать за: !voteblock в чат или через меню." +#define VIPBLOCK_TIMEOUT "Блокировка ВИП команд снята!" + + +stock bool VIPBlockCheckTime(int client){ + if(g_vipblock_player_settime[client] && GetTime() - g_vipblock_player_settime[client] > g_vipblock_blocktime){ + VIPBlockClearPlayerVotes(client); + PrintCenterText(client, VIPBLOCK_TIMEOUT); + return true; + } else return false; +} + +stock bool VIPBlockCheckVotes(int client){ + if(ReturnVoteCount(client, g_vipblock_player_votes) >= CalcNeedCount(g_vipblock_need_count)){ + VIPBlockPlayer(client); + return true; + } else { + return false; + } +} + +stock VIPBlockClearPlayerVotes(int client, bool save_cookie = true){ + g_vipblock_player_settime[client] = 0; + ClearPlayerVotes(client, g_vipblock_player_votes); + if(save_cookie) VIPBlockSaveCookie(client); +} + +stock VIPBlockCmdsDisable(int client){ + int uid = GetClientUserId(client); + if(uid){ + for(int i = 0; i < VIP_COMMANDS_COUNT;i++){ + ServerCommand(g_vipblock_commands_disable[i], uid); + } + } +} + +stock VIPBlockPlayer(int client){ + PrintCenterTextAll(VIPBLOCK_VOTE_COMPLETE, client); + PrintToChatAll(VIPBLOCK_VOTE_COMPLETE, client); + VIPBlockClearPlayerVotes(client); + g_vipblock_player_settime[client] = GetTime(); + VIPBlockSaveCookie(client); + VIPBlockCmdsDisable(client); +} + +stock VIPBlockVoteOn(){ + if(g_vipblock_timer != INVALID_HANDLE) KillTimer(g_vipblock_timer); + else g_vipblock_timer = CreateTimer(5.0, CallbackVIPBlockTimer, _, TIMER_REPEAT); + RegConsoleCmd(g_vipblock_votecmd, CommandVIPBlockVote, "Vote for votevipblock player on server"); + RegConsoleCmd("sm_voteblock", CommandVIPBlockVote, "Vote for votevipblock player on server"); + RegAdminCmd("sm_voteblock_enable", CommandVIPBlockEnable, ADMFLAG_ROOT); + g_vipblock_cookie = RegClientCookie("fv_vipblock_settime", "", CookieAccess_Private); + VIPBlockListener(true); + PrintToServer("[FV] [VIPBlock] support enable"); + for(int client = 1; client <= MaxClients; client++){ + if(IsValidClient(client) && AreClientCookiesCached(client)) VIPBlockCheckCookie(client); + } +} + +stock VIPBlockListener(bool add = true){ + for(int i = 0; i < VIP_COMMANDS_COUNT; i++){ + if(add) AddCommandListener(VIPBlockCommandListener, g_vipblock_commands[i]); + else RemoveCommandListener(VIPBlockCommandListener, g_vipblock_commands[i]); + } +} + +public Action VIPBlockCommandListener(int client, const char[] command, int args){ + if(g_vipblock_player_settime[client] == 0) return Plugin_Handled; + if(VIPBlockCheckTime(client)){ + PrintCenterText(client, "С тебя сняли ограничение на использование VIP команд!"); + return Plugin_Handled; + } else { + PrintCenterText(client, "Тебе ограничен доступ к VIP командам по результатам голосования! Ограничение пропадет через %i секунд.", g_vipblock_blocktime - (GetTime() - g_vipblock_player_settime[client])); + return Plugin_Stop; + } +} + +stock VIPBlockCheckCookie(int client){ + VIPBlockClearPlayerVotes(client, false); + char cookie[256]; + GetClientCookie(client, g_vipblock_cookie, cookie, sizeof(cookie)); + if(strlen(cookie) > 0){ + int settime = StringToInt(cookie); + g_vipblock_player_settime[client] = settime; + PrintToServer("[FV] [VIPBlock] %N set %i", client, g_vipblock_player_settime[client]); + } +} + +stock VIPBlockSaveCookie(int client){ + char cookie[256]; + if(g_vipblock_player_settime[client]) Format(cookie, sizeof(cookie), "%i", g_vipblock_player_settime[client]); + else Format(cookie, sizeof(cookie), "0"); + SetClientCookie(client, g_vipblock_cookie, cookie); + if(g_vipblock_player_settime[client]) PrintToServer("[FV] [VIPBlock] %N set %i", client, g_vipblock_player_settime[client]); +} + +stock VIPBlockVoteOff(){ + VIPBlockListener(false); + if(g_vipblock_timer != INVALID_HANDLE) KillTimer(g_vipblock_timer); +} + +stock DisplayVIPBlockMenu(int client){ + Handle VIPBlockMenu = CreateMenu(CallbackVIPBlockBuildMenu); + SetMenuTitle(VIPBlockMenu, "Выключить VIP у:"); + char menu_line[64]; + char player_uid[32]; + for(int player = 1; player <= MaxClients; player++){ + if(IsValidClient(player)){ + //if(player == client) continue; + if(CheckCommandAccess(player, "", ADMFLAG_BAN)) continue; + + if(!CheckCommandAccess(player, "", ADMFLAG_RESERVATION)) continue; + + Format(player_uid, sizeof(player_uid), "%i", GetClientUserId(player)); + if(g_vipblock_player_settime[player]){ + Format(menu_line, sizeof(menu_line), "%N [Выключен VIP]", player); + AddMenuItem(VIPBlockMenu, player_uid, menu_line, ITEMDRAW_DISABLED); + } + else if(g_vipblock_player_votes[player][client] == 0) { + Format(menu_line, sizeof(menu_line), "%N [%i/%i]", player, ReturnVoteCount(player, g_vipblock_player_votes), CalcNeedCount(g_vipblock_need_count)); + AddMenuItem(VIPBlockMenu, player_uid, menu_line); + } else { + Format(menu_line, sizeof(menu_line), "%N [Ты проголосовал]", player); + AddMenuItem(VIPBlockMenu, player_uid, menu_line, ITEMDRAW_DISABLED); + } + } + } + if(GetMenuItemCount(VIPBlockMenu) == 0){ + PrintCenterText(client, "Незакого голосовать, нет випов на сервере."); + return; + } + DisplayMenu(VIPBlockMenu, client, 0); + return; +} + +stock CallbackVIPBlockBuildMenu(Handle VIPBlockMenu, MenuAction action, int client, int pos){ + switch(action){ + case MenuAction_Select:{ + char player_uid[32]; + GetMenuItem(VIPBlockMenu, pos, player_uid, sizeof(player_uid)); + int player = GetClientOfUserId(StringToInt(player_uid)); + if(player == 0){ + PrintCenterText(client, "Увы игрок вышел!"); + return; + } + + g_vipblock_player_votes[player][client] = 1; + + if(!VIPBlockCheckVotes(player)) PrintCenterTextAll(VIPBLOCK_VOTE_VOTED, client, player); + + } + case MenuAction_End: delete VIPBlockMenu; + } + return; +} + +stock Action CallbackVIPBlockTimer(Handle timer){ + for(int client = 1; client <= MaxClients; client++){ + if(IsValidClient(client)){ + VIPBlockCheckVotes(client); + VIPBlockCheckTime(client); + } + } +} + +public Action CommandVIPBlockVote(int client, int args){ + if (client == 0) + { + ReplyToCommand(client, "Cannot use command from RCON."); + return Plugin_Handled; + } + DisplayVIPBlockMenu(client); + return Plugin_Handled; +} + +public Action CommandVIPBlockEnable(int client, int args){ + char text[256], arg[64]; + GetCmdArgString(text, sizeof(text)); + BreakString(text, arg, sizeof(arg)); + + int target = FindTarget(client, arg, _, false); + if(target == -1) return Plugin_Handled; + + if(g_vipblock_player_settime[target]){ + ReplyToCommand(client, "Already setted!"); + } else { + VIPBlockPlayer(target); + ReplyToCommand(client, "Setted!"); + } + return Plugin_Handled; +} \ No newline at end of file diff --git a/HexTags/hextags.sp b/HexTags/hextags.sp index a308acd..890a7d8 100644 --- a/HexTags/hextags.sp +++ b/HexTags/hextags.sp @@ -136,8 +136,8 @@ public void OnPluginStart() //Reg Cmds RegAdminCmd("sm_reloadtags", Cmd_ReloadTags, ADMFLAG_GENERIC, "Reload HexTags plugin config"); RegAdminCmd("sm_toggletags", Cmd_ToggleTags, ADMFLAG_GENERIC, "Toggle the visibility of your tags"); - RegConsoleCmd("sm_tagslist", Cmd_TagsList, "Select your tag!"); - RegConsoleCmd("sm_getteam", Cmd_GetTeam, "Get current team name"); + //RegConsoleCmd("sm_tagslist", Cmd_TagsList, "Select your tag!"); + //RegConsoleCmd("sm_getteam", Cmd_GetTeam, "Get current team name"); //Event hooks if (!HookEventEx("round_end", Event_RoundEnd)) diff --git a/PissMod/materials/sprites/halo01.vmt b/PissMod/materials/sprites/halo01.vmt new file mode 100644 index 0000000..5f31ea5 --- /dev/null +++ b/PissMod/materials/sprites/halo01.vmt @@ -0,0 +1,6 @@ +"Sprite" +{ + "$spriteorientation" "vp_parallel" + "$spriteorigin" "[ 0.50 0.50 ]" + "$basetexture" "sprites/halo01" +} diff --git a/PissMod/materials/sprites/halo01.vtf b/PissMod/materials/sprites/halo01.vtf new file mode 100644 index 0000000..d533242 Binary files /dev/null and b/PissMod/materials/sprites/halo01.vtf differ diff --git a/PissMod/materials/sprites/xbeam2.vmt b/PissMod/materials/sprites/xbeam2.vmt new file mode 100644 index 0000000..1c48500 --- /dev/null +++ b/PissMod/materials/sprites/xbeam2.vmt @@ -0,0 +1,6 @@ +"Sprite" +{ + "$spriteorientation" "vp_parallel" + "$spriteorigin" "[ 0.50 0.50 ]" + "$basetexture" "sprites/xbeam2" +} diff --git a/PissMod/materials/sprites/xbeam2.vtf b/PissMod/materials/sprites/xbeam2.vtf new file mode 100644 index 0000000..6e9e290 Binary files /dev/null and b/PissMod/materials/sprites/xbeam2.vtf differ diff --git a/PissMod/piss_mod.sp b/PissMod/piss_mod.sp new file mode 100644 index 0000000..0bef7db --- /dev/null +++ b/PissMod/piss_mod.sp @@ -0,0 +1,307 @@ +#include +#include +#include + +bool piss_on_only_client = true; +bool piss_disable_move = false; +int piss_tick_counter = 1; //default 4 +float piss_time = 9.0; +float piss_distance = 100.0; + +int piss_check_count = 4; +int piss_check_need_count = 2; + + +int g_TickCounter = 0; +bool g_bPiss[MAXPLAYERS + 1] = { false, ... }; +bool g_bCanPiss[MAXPLAYERS + 1] = { true, ... }; + +int g_PissTarget[MAXPLAYERS + 1] = {0, ...}; +int g_PissCount[MAXPLAYERS + 1] = {0, ...}; +int g_PissStart[MAXPLAYERS + 1] = {0, ...}; + +int BeamSprite; +int HaloSprite; + +Handle g_PEnabled = INVALID_HANDLE; +//int gVelocityOffset; + +public Plugin:myinfo = +{ + name = "Piss Mod", + author = "gsd", + description = "Original code https://forums.alliedmods.net/showthread.php?t=295055", + version = "1.1", + url = "" +} + +public OnPluginStart(){ + RegConsoleCmd("piss", Piss_In); + g_PEnabled = CreateConVar("sm_piss_enabled", "1"); + AddFileToDownloadsTable("materials/sprites/xbeam2.vmt"); + AddFileToDownloadsTable("materials/sprites/halo01.vmt"); + HookEvent("player_death", Event_PlayerDeath); + //gVelocityOffset = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]"); +} + +public OnPluginEnd(){ + for(int client = 1; client <= MaxClients; client++){ + Piss_Out_Handler(client, true); + } +} + +public OnMapStart(){ + BeamSprite = PrecacheModel("materials/sprites/xbeam2.vmt"); + HaloSprite = PrecacheModel("materials/sprites/halo01.vmt"); +} + +public OnClientConnected(int client){ + g_bCanPiss[client] = true; + g_bPiss[client] = false; + g_PissTarget[client] = 0; + g_PissCount[client] = 0; + g_PissStart[client] = 0; +} + +public OnClientDisconnect(int client){ + Piss_Out_Handler(client, true); +} + +public OnGameFrame() +{ + if(g_TickCounter == piss_tick_counter) + { + for(int client = 1; client <=MaxClients; ++client) + { + if(IsClientInGame(client) && IsPlayerAlive(client)) + { + if(g_bPiss[client]) + { + PissBeam(client); + } + } + } + g_TickCounter=0; + } + else + { + g_TickCounter++; + } +} + +public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast){ + int client = GetClientOfUserId(GetEventInt(event, "userid")); + if(g_bPiss[client]) Piss_Out_Handler(client, true); +} + +stock bool CheckPissDistance(int client, int target){ + new Float:rposition[3]; + new Float:cposition[3]; + GetEntPropVector(target, Prop_Send, "m_vecOrigin", rposition); + + GetClientAbsOrigin(client, cposition); + decl Float:DistanceG; + DistanceG = GetVectorDistance(rposition,cposition); + + if(DistanceG <= piss_distance) return true; + else return false; +} + +public Action:Piss_In(client, args) +{ + //PrintToServer("%N:%i", client, g_bCanPiss[client]); + if(!GetConVarBool(g_PEnabled)){ + PrintCenterText(client, "У тебя простатит..."); + return Plugin_Continue; + } + + if(!g_bCanPiss[client]){ + return Plugin_Continue; + } + /* + if ((g_AdmFlag > 0) && !CheckCommandAccess(client, "sm_piss", g_AdmFlag, true)) + { + PrintToChat(client, "\x04You do not have access"); + return Plugin_Handled; + } +*/ +/* + if(veces[client] > GetConVarInt(g_veces)) + { + PrintToChat(client, "\x04Times for round excedded"); + return Plugin_Handled; + } +*/ + //for(new i=1;i<=MaxClients;++i) + if(true) + { + //if(g_PKiller[i] == client) + if(true) + { + int ent = GetClientAimTarget(client, piss_on_only_client); + //PrintToServer("%N|%i|%i", client, ent, IsValidEdict(ent)); + if(IsValidEdict(ent)) + { + g_PissTarget[client] = ent; + /*if ((g_AdmFlag2 > 0) && !CheckCommandAccess(client, "sm_piss2", g_AdmFlag2, true)) + { + PrintToChat(client, "\x04You do not have access"); + return Plugin_Handled; + }*/ + + //if(DistanceG <= piss_distance) + if(CheckPissDistance(client, GetClientAimTarget(client, piss_on_only_client))) + { +/* if(rposition[0] > cposition[0]-50 && rposition[0] < cposition[0]+50) + { + if(rposition[1] > cposition[1]-50 && rposition[1] < cposition[1]+50) + { + if(rposition[2] > cposition[2]-5 && rposition[2] < cposition[2]+5) + { */ + PissBeam(client); + + g_bPiss[client] = true; + g_PissStart[client] = GetTime(); + if(piss_disable_move) SetEntityMoveType(client, MOVETYPE_NONE); + /* DISABLE SOUND + new String:sound[64]; + GetConVarString(g_PeeSound, sound, sizeof(sound)); + EmitAmbientSound(sound, pos); + */ + //CreateTimer(0.8, EmitSoundPee, client, TIMER_REPEAT); + + float append = piss_time / piss_check_count; + + for(float start = 0.0; start < piss_time; start++){ + start--; + start = start + append; + + CreateTimer(start, Piss_Effect, client); + //PrintToServer("Create Timer: %i", start); + } + + if(ent >= 1 && ent <= MaxClients) PrintCenterText(client, "Ты начал ссать на %N...", ent); + CreateTimer(piss_time, Piss_Out, client); + //veces[client]++; + g_bCanPiss[client] = false; + //Quitararmas(client); + //break; +/* } + } */ + } + } else { + PrintCenterText(client, "Нет цели для окатывания мочёй!\nЗабиндь кнопку через консоль чтоб удобнее ловить цели!\nbind R piss") + } + } + } + + return Plugin_Handled; +} + +stock PissBeam(int client, int entity = -1, bool logging = false, bool magnet_piss = false){ + float pos[3], end[3], ang[3], ppos[3], aang[3]; + + GetClientEyePosition(client, pos); + GetClientEyeAngles(client, ang); + pos[2] -= 23.0; + ang[0] = 40.0; + TR_TraceRayFilter(pos, ang, MASK_PLAYERSOLID, RayType_Infinite, DontHitSelf, client); + + if(magnet_piss){ + float tpos[3]; + GetEntPropVector(g_PissTarget[client], Prop_Send, "m_vecOrigin", tpos); + GetClientAbsOrigin(client, ppos); + if(GetVectorDistance(ppos, tpos) <= piss_distance) end = tpos; + else TR_GetEndPosition(end); + } else { + TR_GetEndPosition(end); + } + //if(entity == -1) TR_GetEndPosition(end); + //else GetEntPropVector(entity, Prop_Send, "m_vecOrigin", end); + + TE_SetupBeamRingPoint(end, 5.0, 10.0, BeamSprite, HaloSprite, 0, 15, 0.5, 5.0, 1.0, {255, 255, 0, 255}, 10, 0); + TE_SendToAll(); + + GetClientEyePosition(client, ppos); + + //ppos[0]+=10.0; + ppos[2]-=30.0; + + GetClientAbsAngles(client, aang); + + if(aang[1] > 0) + { + ppos[0]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), aang[1])); + ppos[1]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(FloatSub(aang[1], 90.0)))); + } + else + { + ppos[0]+=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(aang[1]))); + ppos[1]-=FloatSub(10.0, FloatMul(FloatDiv(10.0, 90.0), FloatAbs(FloatSub(FloatAbs(aang[1]), 90.0)))); + } + + aang[0]=0.0; + aang[1]+=180.0; + aang[2]=0.0; + + TE_SetupBeamPoints(end, ppos, BeamSprite, HaloSprite, 0, 30, 0.1, 1.0, 1.0, 0, 10.0, {255, 255, 0, 255}, 10); + TE_SendToAll(); + if(logging) PrintCenterText(client, "%f %f %f | %f %f %f\n%f %f %f | %f %f %f", + pos[0], pos[1], pos[2], end[0], end[1], end[2], + ppos[0], ppos[1], ppos[2], aang[0], aang[1], aang[2]); +} + +public Action:Piss_Effect(Handle:timer, any:client){ + if(g_PissTarget[client] >= 1 && g_PissTarget[client] <= MaxClients){ + if(g_PissTarget[client] == GetClientAimTarget(client, piss_on_only_client)){ + if(CheckPissDistance(client, g_PissTarget[client])){ + g_PissCount[client]++; + PrintCenterText(client, "%N хлебнул твоей урины...", g_PissTarget[client]); + PrintCenterText(g_PissTarget[client], "Ты хлебнул урины от %N...", client); + } + } + } + //PrintToServer("%N count: %i", client, g_PissCount[client]); +} + +stock Piss_Out_Handler(int client, bool force = false){ + if (!force) if(!IsClientInGame(client) || !IsPlayerAlive(client)) return; + + g_bPiss[client] = false; + g_bCanPiss[client] = false; + + //PrintToServer("%N %i>=%i", client, g_PissCount[client], piss_check_need_count); + if(!force && g_PissCount[client] > piss_check_need_count){ + g_PissCount[client] = 0; + if(g_PissTarget[client] >= 1 && g_PissTarget[client] <= MaxClients){ + if(IsClientInGame(g_PissTarget[client]) && IsPlayerAlive(g_PissTarget[client])){ + TF2_AddCondition(g_PissTarget[client], TFCond_Jarated, 5.0); + PrintCenterText(g_PissTarget[client], "Тебя обоссал %N", client); + } + } + g_PissTarget[client] = -1; + } + + if(!force) if(piss_disable_move) SetEntityMoveType(client, MOVETYPE_ISOMETRIC); + CreateTimer(1.0, CanPiss, client); +} + +public Action:Piss_Out(Handle:timer, any:client) +{ + Piss_Out_Handler(client); + return; +} + +public bool:DontHitSelf(entity, mask, any:data) +{ + if(entity == data) + return false; + return true; +} + +public Action:CanPiss(Handle:timer, any:client) +{ + g_bCanPiss[client] = true; + + return Plugin_Continue; +} \ No newline at end of file diff --git a/Rate_of_Fire/tf2_rof.sp b/Rate_of_Fire/tf2_rof.sp new file mode 100644 index 0000000..d9bdbd4 --- /dev/null +++ b/Rate_of_Fire/tf2_rof.sp @@ -0,0 +1,251 @@ +#pragma semicolon 1 +#include +#include + +#define PLUGIN_VERSION "1.2" + +new OffAW = -1; +new Float:LastCharge[MAXPLAYERS+1]; +new Float:Multi[MAXPLAYERS+1]; +new bool:SpeedEnabled[MAXPLAYERS+1]; +new bool:InAttack[MAXPLAYERS+1]; +new Handle:g_hcvarSniperScope = INVALID_HANDLE; +new Handle:g_hcvarHuntsman = INVALID_HANDLE; + + +public Plugin:myinfo = +{ + name = "[TF2] Rate of Fire", + author = "EHG", + description = "Modify weapon rate of fire", + version = PLUGIN_VERSION, + url = "" +} + + +public OnPluginStart() +{ + //LoadTranslations("common.phrases"); + OffAW = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon"); + + CreateConVar("sm_tf2_rof_version", PLUGIN_VERSION, "TF2 Rate of Fire version", FCVAR_PLUGIN|FCVAR_DONTRECORD|FCVAR_REPLICATED|FCVAR_NOTIFY); + g_hcvarSniperScope = CreateConVar("sm_tf2_rof_scope", "0", "Set if rof should effect sniper scope", 0, true, 0.0, true, 1.0); + g_hcvarHuntsman = CreateConVar("sm_tf2_rof_huntsman", "1", "Set if rof should effect huntsman", 0, true, 0.0, true, 1.0); + + RegAdminCmd("sm_rofl", Command_Rof, 0, "Set Rate of Fire"); + RegAdminCmd("rof", Command_Rof, 0, "Set Rate of Fire"); + + + for (new i = 0; i <= MaxClients; i++) OnClientPostAdminCheck(i); +} + + +public OnClientPostAdminCheck(client) +{ + Multi[client] = 1.0; + SpeedEnabled[client] = false; + InAttack[client] = false; + LastCharge[client] = 0.0; +} + + +public Action:Command_Rof(client, args) +{ + decl String:arg[65]; + decl String:arg2[20]; + new Float:amount; + new bool:HasTarget = false; + + if (CheckCommandAccess(client, "sm_rof_access_target", ADMFLAG_ROOT)) + { + if (args < 2) + { + ReplyToCommand(client, "[SM] Usage: sm_rof <#userid|name> <1.0 - 10.0>"); + return Plugin_Handled; + } + + GetCmdArg(1, arg, sizeof(arg)); + GetCmdArg(2, arg2, sizeof(arg2)); + + amount = StringToFloat(arg2); + + HasTarget = true; + } + else if (CheckCommandAccess(client, "sm_rof_access", ADMFLAG_GENERIC)) + { + if(Multi[client] == 1.0) amount = 2.0; + else amount = 1.0; + } + else + { + ReplyToCommand(client, "[SM] You do not have access to this command."); + return Plugin_Handled; + } + + + if (amount < 1 || amount > 10) + { + ReplyToCommand(client, "[SM] Invalid Amount"); + return Plugin_Handled; + } + + + decl String:target_name[MAX_TARGET_LENGTH]; + + if (HasTarget) + { + decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + + if ((target_count = ProcessTargetString( + arg, + client, + target_list, + MAXPLAYERS, + COMMAND_FILTER_CONNECTED, + target_name, + sizeof(target_name), + tn_is_ml)) <= 0) + { + ReplyToTargetError(client, target_count); + return Plugin_Handled; + } + + + for (new i = 0; i < target_count; i++) + { + if (amount == 1) + { + SpeedEnabled[target_list[i]] = false; + Multi[target_list[i]] = amount; + } + else + { + SpeedEnabled[target_list[i]] = true; + Multi[target_list[i]] = amount; + } + } + + if (amount == 1) + { + ReplyToCommand(client, "[SM] ROF disabled for %s", target_name); + } + else + { + ReplyToCommand(client, "[SM] ROF set to: %s for %s", arg2, target_name); + } + } + else + { + if (amount == 1) + { + SpeedEnabled[client] = false; + Multi[client] = amount; + ReplyToCommand(client, "[SM] ROF disabled"); + } + else + { + SpeedEnabled[client] = true; + Multi[client] = amount; + ReplyToCommand(client, "[SM] ROF set to: %s", arg); + } + } + + + return Plugin_Handled; +} + +public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon) +{ + if (SpeedEnabled[client] && Multi[client] != 1.0) + { + if (buttons & IN_ATTACK2) + { + new ent = GetEntDataEnt2(client, OffAW); + if(ent != -1) + { + new String:weap[50]; + GetEdictClassname(ent, weap, sizeof(weap)); + if(strcmp(weap, "tf_weapon_sniperrifle") == 0 && GetConVarInt(g_hcvarSniperScope) == 0) + { + InAttack[client] = false; + return Plugin_Continue; + } + + if (strcmp(weap, "tf_weapon_particle_cannon") == 0) + { + new Float:charge = GetEntPropFloat(ent, Prop_Send, "m_flChargeBeginTime"); + new Float:chargemod = charge-4.0; + if (charge != 0 && LastCharge[client] != chargemod) + { + LastCharge[client] = chargemod; + SetEntPropFloat(ent, Prop_Send, "m_flChargeBeginTime", chargemod); + } + } + } + } + + if (buttons & IN_ATTACK || buttons & IN_ATTACK2) + { + new ent = GetEntDataEnt2(client, OffAW); + if(ent != -1) + { + new String:weap[50]; + GetEdictClassname(ent, weap, sizeof(weap)); + if(strcmp(weap, "tf_weapon_compound_bow") == 0 && GetConVarInt(g_hcvarHuntsman) == 0) + { + InAttack[client] = false; + return Plugin_Continue; + } + } + InAttack[client] = true; + } + else + { + InAttack[client] = false; + } + } + return Plugin_Continue; +} + +public OnGameFrame() +{ + for(new i=1; i<=MaxClients; i++) + { + if (SpeedEnabled[i] && InAttack[i]) + { + if(IsClientInGame(i) && IsPlayerAlive(i)) + { + ModRateOfFire(i, Multi[i]); + } + } + } +} + +stock ModRateOfFire(client, Float:Amount) +{ + new ent = GetEntDataEnt2(client, OffAW); + if (ent != -1) + { + new Float:m_flNextPrimaryAttack = GetEntPropFloat(ent, Prop_Send, "m_flNextPrimaryAttack"); + new Float:m_flNextSecondaryAttack = GetEntPropFloat(ent, Prop_Send, "m_flNextSecondaryAttack"); + if (Amount > 12) + { + SetEntPropFloat(ent, Prop_Send, "m_flPlaybackRate", 12.0); + } + else + { + SetEntPropFloat(ent, Prop_Send, "m_flPlaybackRate", Amount); + } + + new Float:GameTime = GetGameTime(); + + new Float:PeTime = (m_flNextPrimaryAttack - GameTime) - ((Amount - 1.0) / 50); + new Float:SeTime = (m_flNextSecondaryAttack - GameTime) - ((Amount - 1.0) / 50); + new Float:FinalP = PeTime+GameTime; + new Float:FinalS = SeTime+GameTime; + + + SetEntPropFloat(ent, Prop_Send, "m_flNextPrimaryAttack", FinalP); + SetEntPropFloat(ent, Prop_Send, "m_flNextSecondaryAttack", FinalS); + } +} diff --git a/RtdUltimate/rtd_ultimate.sp b/RtdUltimate/rtd_ultimate.sp index 976bbae..110b44d 100644 --- a/RtdUltimate/rtd_ultimate.sp +++ b/RtdUltimate/rtd_ultimate.sp @@ -56,7 +56,8 @@ public OnPluginStart(){ g_cmd_timeout = CreateConVar("sm_rtd_timeout", "120", "Amount of time in seconds a player roll the ULTIMATE DICE FACTI 13", FCVAR_NOTIFY, true, 0.0); g_cmd_timeout_vip = CreateConVar("sm_rtd_timeout_vip", "180", "Amount of time in seconds a vip player roll the ULTIMATE DICE FACTI 13", FCVAR_NOTIFY, true, 0.0); - RegAdminCmd("sm_rtd", User_roll, ADMFLAG_RESERVATION, "Roll the ULTIMATE DICE"); + RegConsoleCmd("rtd", User_roll); + //RegAdminCmd("sm_rrtd", User_roll, ADMFLAG_RESERVATION, "Roll the ULTIMATE DICE"); RegAdminCmd("sm_rtd_use", Admin_roll, ADMFLAG_ROOT, "Roll the ULTIMATE DICE to user"); RegAdminCmd("sm_rtd_addcond", Command_AddCondition, ADMFLAG_GENERIC, "Add a condition to the target(s), Usage: sm_rtd_addcond \"target\" \"condition number\" \"duration\""); @@ -422,7 +423,7 @@ public Action:User_roll(client, args){ return Plugin_Handled; } - PrintToChat(client, "{black}Крутим колесо фартуны......"); + PrintToChat(client, "Крутим колесо фартуны......"); SQL_TQuery(g_Database, SQL_SetEffect, g_SQL_RANDOM, UID(client)); return Plugin_Handled; } diff --git a/plugins/hextags.smx b/plugins/hextags.smx index 6b0237e..a7bbc1e 100644 Binary files a/plugins/hextags.smx and b/plugins/hextags.smx differ diff --git a/plugins/rtd_ultimate.smx b/plugins/rtd_ultimate.smx index 94bfc18..73bd8aa 100644 Binary files a/plugins/rtd_ultimate.smx and b/plugins/rtd_ultimate.smx differ