Portugal
Пользователь
- Регистрация
- 2 Мар 2018
- Сообщения
- 257
- Симпатии
- 5
- Предупреждения
- 60
- Пол
- Мужской
Некорректное название темы
Привет народ , нужна помошь.
Отсюда вынуть код гравитации и звука на разминке
И вставить в этот плагин + если есть возможность сделать чтоб в конце разминки проигрывался не один звук а один из 3
Отсюда вынуть код гравитации и звука на разминке
Код:
#include <amxmodx>
#include <reapi>
const WARMUP_TIME = 60;
static const g_szSound[] = "wrsnz/wrsnz.wav";
const TASK = 100;
new g_hookEventCurWeapon, HookChain:g_hookRoundRestart, HookChain:g_hookSpawn, HookChain:g_hookKilled;
new gCount;
public plugin_precache()
{
precache_sound(g_szSound);
}
public plugin_init()
{
register_plugin("Knife_RR", "0.1", "unnamed");
disable_event((g_hookEventCurWeapon = register_event("CurWeapon", "switchweapon", "be", "1=1", "2!29")));
g_hookRoundRestart = RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Pre", false);
DisableHookChain((g_hookSpawn = RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true)));
DisableHookChain((g_hookKilled = RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true)));
}
public CSGameRules_RestartRound_Pre()
{
if(get_member_game(m_bCompleteReset))
{
gCount = WARMUP_TIME;
EnableHookChain(g_hookSpawn);
EnableHookChain(g_hookKilled);
DisableHookChain(g_hookRoundRestart);
enable_event(g_hookEventCurWeapon);
server_cmd("sv_gravity 350");
if(task_exists(TASK)) remove_task(TASK);
set_task(1.0, "DisableRR", TASK, .flags = "a", .repeat = WARMUP_TIME);
}
}
public CBasePlayer_Spawn_Post(const this)
{
if(is_user_connected(this))
{
set_entvar(this, var_health, 65.0);
}
}
public CBasePlayer_Killed_Post(const this)
{
set_task(1.0, "respawn_player", this);
}
public switchweapon(id)
{
engclient_cmd(id, "weapon_knife");
}
public respawn_player(id)
{
if(is_user_connected(id) && !is_user_alive(id) && TEAM_TERRORIST <= get_member(id, m_iTeam) <= TEAM_CT)
{
rg_round_respawn(id);
}
}
public DisableRR()
{
if(--gCount > 0)
client_print(0, print_center, "The battle will begin in: %d sec", gCount);
else client_print(0, print_center, "Warm up is over!");
switch(gCount)
{
case 1: client_cmd(0, "spk sound/%s", g_szSound);
case 0:
{
DisableHookChain(g_hookSpawn);
DisableHookChain(g_hookKilled);
disable_event(g_hookEventCurWeapon);
set_cvar_num("sv_restart", 2);
server_cmd("sv_gravity 850");
}
}
}
И вставить в этот плагин + если есть возможность сделать чтоб в конце разминки проигрывался не один звук а один из 3
Код:
/* ===============================================================================
* Knife warmup 0.1 [28.03.2016]
* Благодарности:
* - Sanlerus: реализация отлова выбора класса
* - s1lent: реализация и возможность использования 'Regamedll_CS', 'RoundControl'
* - Safety1st: способы реализации некоторых функций из 'Uncommon Knife Warmup'
* ============================================================================ */
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <hamsandwich>
//#include <roundcontrol> // раскомментируйте эту строку, если на сервере не используется Regamedll_CS
#pragma semicolon 1
#define bit_set(%0,%1) (%1 |= (1<<%0))
#define bit_clear(%0,%1) (%1 &= ~(1<<%0))
#define bit_valid(%0,%1) (%1 & (1<<%0))
#define USE_PAUSE // раскомментируйте эту строку, если желаете, чтобы плагин прекратил работу после выполнения задачи
#if AMXX_VERSION_NUM < 183
const MAX_PLAYERS = 30; // максимальное кол-во игроков на сервере, заменить своим (по умолчанию 32)
#endif
const WARMUP_TIME = 70; // кол-во времени в секундах, отведённое на разминку (по умолчанию 90)
const Float:RESPAWN_DELAY = 0.75; // кол-во времени в секундах, отведённое на задержку перед респауном (по умолчанию 0.75)
const Float:SHOW_MSG_DELAY = 0.8; // кол-во времени в секундах, отведённое на задержку перед отправкой HUD-сообщения (по умолчанию 0.5)
const Float:WARMUP_HEALTH = 65.0; // кол-во ед. здоровья, устанавливаемое игроку при спауне во время разминки (по умолчанию 35.0)
const HW_CROSS_AMMO_WPNLIST = (1<<0);
const HW_TIMER = (1<<4);
const HW_MONEY = (1<<5);
new const KILL_SOUNDS[][] = {
"misc/sheep.wav", "misc/killChicken.wav", "misc/cow.wav"
};
enum {
WS_WAITING = 1,
WS_BEGIN,
WS_IN_PROGRESS,
WS_ENDED
}
new HamHook:g_pHamSpawn, HamHook:g_pHamAddPlayerItem, HamHook:g_pHamGiveAmmo, HamHook:g_pHamUse, HamHook:g_pHamKilled;
#if defined _roundcontrol_included
new RoundControlHook:g_pCheckWinHook;
#else
new g_pRoundInfinite, g_szRoundInfinite[10];
#endif
new g_pRestartRound, g_pHideWeaponMsgId, g_pStatusIconMsgId, g_pHudSyncObj1, g_pHudSyncObj2, g_pThinkEnt, g_iConnectedBitsum, g_iAliveBitsum, g_iMessageBitsum, g_iFrags[MAX_PLAYERS + 1],
g_iWarmupState = WS_WAITING, g_pHideWeapon, g_iTimerCount;
public plugin_precache() {
for(new i; i < sizeof KILL_SOUNDS; i++) {
precache_sound(KILL_SOUNDS[i]);
}
}
public plugin_init() {
register_plugin("Knife warmup", "0.1", "Subb98");
register_clcmd("joinclass", "CmdJoinClass");
const JOIN_CLASS_MENU_KEYS = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5;
register_menucmd(register_menuid("Terrorist_Select"), JOIN_CLASS_MENU_KEYS, "CmdJoinClass");
register_menucmd(register_menuid("CT_Select"), JOIN_CLASS_MENU_KEYS, "CmdJoinClass");
register_event("HLTV", "EventHLTV", "a", "1=0", "2=0");
register_logevent("EventGameCommencing", 2, "1=Game_Commencing");
register_logevent("EventRoundStart", 2, "1=Round_Start");
register_logevent("EventRoundEnd", 2, "1=Round_End");
new const ENT_CLASSNAME[] = "player";
DisableHamForward(g_pHamSpawn = RegisterHam(Ham_Spawn, ENT_CLASSNAME, "HamSpawnPlayerPost", 1));
DisableHamForward(g_pHamAddPlayerItem = RegisterHam(Ham_AddPlayerItem, ENT_CLASSNAME, "HamAddPlayerItemPre"));
DisableHamForward(g_pHamGiveAmmo = RegisterHam(Ham_GiveAmmo, ENT_CLASSNAME, "HamGiveAmmoPre"));
DisableHamForward(g_pHamUse = RegisterHam(Ham_Use, "hostage_entity", "HamUseHostagePre"));
DisableHamForward(g_pHamKilled = RegisterHam(Ham_Killed, ENT_CLASSNAME, "HamKilledPlayerPost", 1));
#if !defined _roundcontrol_included
g_pRoundInfinite = get_cvar_pointer("mp_round_infinite");
#endif
g_pRestartRound = get_cvar_pointer("sv_restartround");
g_pHideWeaponMsgId = get_user_msgid("HideWeapon");
g_pStatusIconMsgId = get_user_msgid("StatusIcon");
g_pHudSyncObj1 = CreateHudSyncObj();
g_pHudSyncObj2 = CreateHudSyncObj();
CreateThinkEntity();
}
#if !defined _roundcontrol_included
public plugin_cfg() {
if(g_pRoundInfinite) {
get_pcvar_string(g_pRoundInfinite, g_szRoundInfinite, charsmax(g_szRoundInfinite));
}
}
#endif
public client_putinserver(id) {
ResetValues(id);
if(!is_user_bot(id) && !is_user_hltv(id)) {
bit_set(id, g_iConnectedBitsum);
}
}
public client_disconnected(id) {
ResetValues(id);
remove_task(id);
}
public CmdJoinClass(const id) {
if(g_iWarmupState == WS_IN_PROGRESS) {
set_task(RESPAWN_DELAY, "TaskRespawn", id);
}
}
public EventHLTV() {
switch(g_iWarmupState) {
case WS_BEGIN: {
g_iWarmupState = WS_IN_PROGRESS;
g_iMessageBitsum = 0;
EnableHamForward(g_pHamSpawn);
EnableHamForward(g_pHamAddPlayerItem);
EnableHamForward(g_pHamGiveAmmo);
EnableHamForward(g_pHamUse);
EnableHamForward(g_pHamKilled);
g_pHideWeapon = register_message(g_pHideWeaponMsgId, "MessageHideWeapon");
#if defined _roundcontrol_included
g_pCheckWinHook = SetBlockControl(RC_CheckWinConditions);
#else
if(g_pRoundInfinite) {
set_pcvar_num(g_pRoundInfinite, 1);
}
#endif
set_msg_block(g_pStatusIconMsgId, BLOCK_SET);
}
case WS_ENDED: {
entity_set_float(g_pThinkEnt, EV_FL_nextthink, get_gametime() + SHOW_MSG_DELAY);
}
}
}
public EventGameCommencing() {
if(g_iWarmupState == WS_WAITING) {
g_iWarmupState = WS_BEGIN;
}
}
public EventRoundStart() {
if(g_iWarmupState == WS_IN_PROGRESS) {
entity_set_float(g_pThinkEnt, EV_FL_nextthink, get_gametime() + 1.0);
}
}
public EventRoundEnd() {
if(g_iWarmupState == WS_IN_PROGRESS) {
g_iWarmupState = WS_ENDED;
DisableHamForward(g_pHamSpawn);
DisableHamForward(g_pHamAddPlayerItem);
DisableHamForward(g_pHamGiveAmmo);
DisableHamForward(g_pHamUse);
DisableHamForward(g_pHamKilled);
unregister_message(g_pHideWeaponMsgId, g_pHideWeapon);
#if defined _roundcontrol_included
RemoveBlockControl(RC_CheckWinConditions, g_pCheckWinHook);
#else
if(g_pRoundInfinite) {
set_pcvar_string(g_pRoundInfinite, g_szRoundInfinite);
}
#endif
set_msg_block(g_pStatusIconMsgId, BLOCK_NOT);
set_pcvar_float(g_pRestartRound, 1.0);
}
}
public MessageHideWeapon() {
const ARG_FLAGS = 1;
set_msg_arg_int(ARG_FLAGS, ARG_BYTE, get_msg_arg_int(ARG_FLAGS) | HW_CROSS_AMMO_WPNLIST | HW_TIMER | HW_MONEY);
}
public HamSpawnPlayerPost(const id) {
if(is_user_alive(id)) {
bit_set(id, g_iAliveBitsum);
if(!bit_valid(id, g_iMessageBitsum)) {
set_task(SHOW_MSG_DELAY, "TaskWarmupStartMsg", id);
}
entity_set_float(id, EV_FL_health, WARMUP_HEALTH);
engclient_cmd(id, "weapon_knife");
message_begin(MSG_ONE, g_pHideWeaponMsgId, _, id);
write_byte(HW_CROSS_AMMO_WPNLIST | HW_TIMER | HW_MONEY);
message_end();
}
}
public HamAddPlayerItemPre(const id, const pEnt) {
if(cs_get_weapon_id(pEnt) != CSW_KNIFE) {
entity_set_int(pEnt, EV_INT_flags, entity_get_int(pEnt, EV_INT_flags ) | FL_KILLME);
SetHamReturnInteger(0);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public HamGiveAmmoPre() {
const NO_AMMO_STOP_PROCESSING = -1;
SetHamReturnInteger(NO_AMMO_STOP_PROCESSING);
return HAM_SUPERCEDE;
}
public HamUseHostagePre() {
return HAM_SUPERCEDE;
}
public HamKilledPlayerPost(const id, const pKiller) {
bit_clear(id, g_iAliveBitsum);
if(bit_valid(pKiller, g_iAliveBitsum)) {
if(g_iFrags[pKiller] == sizeof KILL_SOUNDS) {
g_iFrags[pKiller] = 0;
}
emit_sound(pKiller, CHAN_VOICE, KILL_SOUNDS[g_iFrags[pKiller]], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
g_iFrags[pKiller]++;
}
set_task(RESPAWN_DELAY, "TaskRespawn", id);
}
public FwdThink(const pEnt) {
switch(g_iWarmupState) {
case WS_IN_PROGRESS: {
static iDiff, iMin;
iDiff = WARMUP_TIME - g_iTimerCount++, iMin = 0;
GetMinutes(iDiff, iMin);
set_hudmessage(255, 255, 255, _, 0.96, _, _, 1.0, 0.0, 0.01, -1);
ShowSyncHudMsg(0, g_pHudSyncObj1, "Iki warmup pabaigos: %d:%d", iMin, iDiff);
if(iDiff || iMin) {
entity_set_float(pEnt, EV_FL_nextthink, get_gametime() + 1.0);
} else {
EventRoundEnd();
}
}
case WS_ENDED: {
g_iWarmupState = WS_WAITING;
g_iTimerCount = 0;
set_hudmessage(255, 255, 255, _, 0.25, _, _, 5.0, _, _, -1);
ShowSyncHudMsg(0, g_pHudSyncObj2, "Žaidimas prasideda!^nGL HF!");
#if defined USE_PAUSE
pause("d");
#endif
}
}
}
public TaskRespawn(const id) {
if(bit_valid(id, g_iConnectedBitsum) && !bit_valid(id, g_iAliveBitsum) && cs_get_user_team(id) != CS_TEAM_SPECTATOR) {
ExecuteHamB(Ham_CS_RoundRespawn, id);
}
}
public TaskWarmupStartMsg(const id) {
if(bit_valid(id, g_iAliveBitsum)) {
set_hudmessage(255, 255, 255, _, 0.25, _, _, 5.0, _, _, -1);
ShowSyncHudMsg(id, g_pHudSyncObj2, "Pasiruošk!^n[WARMUP] - Prasideda!");
bit_set(id, g_iMessageBitsum);
}
}
CreateThinkEntity() {
new const ENT_CLASSNAME[] = "_warmup_think_ent";
if((g_pThinkEnt = create_entity("info_target"))) {
entity_set_string(g_pThinkEnt, EV_SZ_classname, ENT_CLASSNAME);
register_think(ENT_CLASSNAME, "FwdThink");
} else {
set_fail_state("Failed to create think entity");
}
}
ResetValues(const id) {
bit_clear(id, g_iConnectedBitsum);
bit_clear(id, g_iAliveBitsum);
bit_clear(id, g_iMessageBitsum);
g_iFrags[id] = 0;
}
GetMinutes(&iSec, &iMin) {
const SECONDS_IN_MINUTE = 60;
iMin = iSec / SECONDS_IN_MINUTE, iSec %= SECONDS_IN_MINUTE;
}
Последнее редактирование модератором: