Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 16 июн 2024, 11:08

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 31 ]  На страницу 1, 2, 3, 4  След.
Автор Сообщение
 Заголовок сообщения: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 20 мар 2012, 06:32 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
Hello

Spawnmine
Is someone able to create a spawn mine protection with amxmodx?
on spawn 2 seconds protection for weapon_tripmine and done.
this way the mine explodes hurting others around it. but not the spawned player.
bringing tripmines back into the game and a new fair dimension of using them on spawnpoint.

Server Crash fix
I wont say how you can do the server crash.
what would be needed is a amxmodx plugin that does not let you drop your last weapon.
so you must have at least 1 weapon in your hand, not 0.

greetz vamp


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 20 мар 2012, 06:40 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
vamp писал(а):
so you must have at least 1 weapon in your hand, not 0.
Код:
public client_command(plrid)
{
   // Get client command.
   new cmd[5];
   read_argv(0, cmd, sizeof(cmd) - 1);
   // Check if command is drop.
   if (equali(cmd, "drop"))
   {
      // Get player's weapons count.
      new num;
      new weapons[32];
      get_user_weapons(plrid, weapons, num);
      // Deny command if user has only 1 weapon
      if (num == 1)
      {
         return PLUGIN_HANDLED;
      }
   }
   return PLUGIN_CONTINUE;
}


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 20 мар 2012, 09:06 
Не в сети
Зарегистрирован:
06 авг 2010, 10:25
Последнее посещение:
20 янв 2021, 16:32
Сообщения: 695
Откуда: Uzbekistan
vamp писал(а):
Hello
does not let you drop your last weapon.
in HLDS this is feature by default?
My HLDS ver 48/1.1.2.1 4554 does not allow players to drop last weapons


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 20 мар 2012, 17:35 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
true thus fixing a bug, in AG this is still possible however.
thank you Lev


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 20 мар 2012, 18:13 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
Here is an example of specific weapon spawn protection for cs.
but I cant get it to work for hldm/AG to create spawn mine protection.
Код:
  /*
    -    Plugin: Weapon-Specific Spawn Protection
    -    Version: 1.0
    -    Author: H3avY Ra1n
    -
    -    Description
    -    -----------
    -        This plugin allows you to protect a player from a certain
    -        weapon for the first X seconds after he spawns.
    -
    -        A .ini file is created where you can place the weapon names that you want
    -        to be blocked.
    -
    -    CVARs
    -    -----
    -        wssp_protect_time <seconds>
    -            + How long after a player spawns he is no longer protected
    -                from the specified weapons
    -            + Default: 5
    -
    -
    -    Changelog
    -    ---------
    -        October 12, 2011   
    -            - v1.0 -
    -                + Initial Release
    -            - v1.0.1 -
    -                + Turn off plugin if no weapons registered
    -                + Don't try to read from file if plugin's first run
    -                + Changed from boolean and tasks to get_gametime()
    -        October 14, 2011
    -            - v1.1 -
    -                + Optimized Ham_TakeDamage call and Ham_TraceAttack call_think        + Credits to ConnorMcLeod for the optimisation.
    -    Credits
    -    -------
    -        Vamppa
    -            + Original Idea
    -            + Thread: http://forums.alliedmods.net/showthread.php?p=1573613
    -        ConnorMcLeod
    -            + Plugin Optimisations
    -
    */
   
    /* Includes */
   
        #include < amxmodx >
        #include < amxmisc >
        #include < hamsandwich >

    /* Defines */
   
        #define MAX_PLAYERS 32
        #define DMG_HEGRENADE (1<<24)
       
    /* Constants */
   
        new const g_szVersion[ ] = "1.1";
       
    /* Integers */
   
        new g_iProtectWeapons;
        new g_iMaxPlayers;
       
    /* PCVARs */
   
        new g_pProtectionTime;
   
    /* Floats */
   
        new Float:g_flSpawnTime[ MAX_PLAYERS + 1 ];
   
    ///////////////////
    //* Plugin Init *//
    ///////////////////
   
    public plugin_init()
    {
        register_plugin( "Weapon-Specific Spawn Protection", g_szVersion, "H3avY Ra1n" );
       
        LoadWeapons();
       
        if( g_iProtectWeapons == 0 )
            return;
           
        RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawn_Post", 1 );
        RegisterHam( Ham_TraceAttack, "player", "Ham_PlayerTraceAttack_Pre", 0 );
        RegisterHam( Ham_TakeDamage, "player", "Ham_PlayerTakeDamage_Pre", 0 );
       
        g_pProtectionTime = register_cvar( "wssp_protect_time", "5" );
       
        g_iMaxPlayers = get_maxplayers();
    }

    /////////////////////
    //* Ham Functions *//
    //* ------------- *//
    //* Player Spawn  *//
    //* Trace Attack  *//
    //* Take Damage   *//
    /////////////////////
   
    public Ham_PlayerSpawn_Post( id )
    {
        g_flSpawnTime[ id ] = get_gametime();
    }
   
    public Ham_PlayerTraceAttack_Pre( iVictim, iAttacker, Float:flDamage, Float:flDirection[ 3 ], iTraceHandle, iBits )
    {
        if( !( 1 <= iAttacker <= g_iMaxPlayers ) || get_gametime() - g_flSpawnTime[ iVictim ] < get_pcvar_float( g_pProtectionTime ) )
            return HAM_IGNORED;

        new iWeapon = get_user_weapon( iAttacker );
   
        if( g_iProtectWeapons & ( 1<<iWeapon ) )
            return HAM_SUPERCEDE;
       
        return HAM_IGNORED;
    }
   
    public Ham_PlayerTakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
    {
        if( 1 <= iAttacker <= g_iMaxPlayers
        &&    iBits & DMG_HEGRENADE
        &&    g_iProtectWeapons & ( 1<<CSW_HEGRENADE )
        &&    get_gametime() - g_flSpawnTime[ iVictim ] > get_pcvar_float( g_pProtectionTime ) )
        {
           
            return HAM_SUPERCEDE;
        }
       
        return HAM_IGNORED;
    }
   
   
    ////////////////////////////////
    //* Read File + Load Weapons *//
    ////////////////////////////////
   
    LoadWeapons()
    {
        new szDirectory[ 128 ];
        get_configsdir( szDirectory, charsmax( szDirectory ) );
       
        add( szDirectory, charsmax( szDirectory ), "/spawn_protect_weapons.ini" );
       
        if( !file_exists( szDirectory ) )
        {
            write_file( szDirectory, ";Use this file to configure which weapons players are protected from on spawn." );
           
            return;
        }
       
        new iFile = fopen( szDirectory, "rt" );
       
        if( !iFile )
        {
            set_fail_state( "Unable to open file spawn_protect_weapons.ini" );
            return;
        }
       
        new szBuffer[ 32 ], iWeapon;
       
        while( !feof( iFile ) )
        {
            fgets( iFile, szBuffer, charsmax( szBuffer ) );
       
            trim( szBuffer );
           
            if( !szBuffer[ 0 ] || szBuffer[ 0 ] == ';' || ( szBuffer[ 0 ] == '/' && szBuffer[ 1 ] == '/' ) )
                continue;
           
            iWeapon = get_weaponid( szBuffer );
           
            if( !iWeapon )
                continue;
           
            g_iProtectWeapons |= ( 1 << iWeapon );
           
            server_print( "Loaded Weapon: %s", szBuffer );
        }
    }


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 24 мар 2012, 04:29 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
Lev писал(а):
vamp писал(а):
so you must have at least 1 weapon in your hand, not 0.
Код:
public client_command(plrid)
{
   // Get client command.
   new cmd[5];
   read_argv(0, cmd, sizeof(cmd) - 1);
   // Check if command is drop.
   if (equali(cmd, "drop"))
   {
      // Get player's weapons count.
      new num;
      new weapons[32];
      get_user_weapons(plrid, weapons, num);
      // Deny command if user has only 1 weapon
      if (num == 1)
      {
         return PLUGIN_HANDLED;
      }
   }
   return PLUGIN_CONTINUE;
}


works but not 100%.
when I have a equipment like (snark,satchel,tripmine,grenade) I can drop all.
if I have only an equipment then i cant drop my equipment.

could it be made that weapon_crowbar can not be dropped ?
with only basic amxmodx module (NO fun, fakemeta, ham etc)


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 24 мар 2012, 04:41 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
Yes.
Catch drop command, check its argument - if "crowbar" - block command, if no argument - check current weapon, if it is crowbar - block command.
Look at hl_get_weapon_id in hl.inc: viewtopic.php?f=20&t=59


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 13 апр 2012, 04:39 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
could you make it?


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 13 апр 2012, 06:22 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
Код:
#include <amxmodx>
#include <hamsandwich>
#include "hl.inc"

public client_command(plrid)
{
   // Get client command.
   new cmd[5], arg[32];
   read_argv(0, cmd, sizeof(cmd) - 1);
   read_argv(1, arg, sizeof(arg) - 1);
   // Check if command is drop.
   if (equali(cmd, "drop"))
   {
      // Block direct crowbar dropping.
      if (equali(arg, "weapon_crowbar"))
         return PLUGIN_HANDLED;
      // Block if crowbar is a current weapon.
      if (hl_get_weapon_id(plrid) == HLW_CROWBAR)
         return PLUGIN_HANDLED;
   }
   return PLUGIN_CONTINUE;
}
viewtopic.php?f=20&t=59


Последний раз редактировалось Lev 16 июл 2013, 22:24, всего редактировалось 2 раз(а).
added code


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 16 апр 2012, 21:53 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
doesn't work

compiled with the hl.inc
compiled no errors, plugins runs fine, fakemeta added, crowbar drops normal.


btw a question, amxmodx does not recongize hl1 weapons with get_user_weapon ?


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 31 ]  На страницу 1, 2, 3, 4  След.

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
cron
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB