Half-Life и Adrenaline Gamer форум

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

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




Начать новую тему Ответить на тему  [ Сообщений: 31 ]  На страницу Пред.  1, 2, 3, 4  След.
Автор Сообщение
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 03 июн 2012, 03:43 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
hehe you are getting on to me :D
anyway it is a great module for achieving many handy and fun things.
sadly with this project for the league I can not effort it, maybe in the full version.
on plugins, programming methods, and modules I try to stay as efficient as possible for the players.
maybe there is a paid assignment for either Lev or you Kord for not much maybe 30-50e in the end (couple weeks from now).
to Optimize the source when it is done.
which wont be all that much code neither :)

I really can use some help in efficiency later down the road.
this will be the last thing that im part of, that I co want to give to the hldm AG community.
Ill only play with -arT. for fun sometimes in matches besides that im planning to call in my resignation.
Im over time :D


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 08 июн 2012, 17:52 
Не в сети
Зарегистрирован:
08 июн 2012, 17:37
Последнее посещение:
25 авг 2017, 20:53
Сообщения: 3
vamp писал(а):
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.
greetz vamp

Try this:
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>

new Float:spawntime[33];
new protectiontime;

public plugin_init()
{
    register_plugin("Tripmine spawnmining protection", "0.1", "fkk");

    RegisterHam(Ham_Spawn, "player", "fw_spawn_player", 1);
    RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_player", 0);

    protectiontime = register_cvar("tripmine_protection_time", "2");
}

public fw_spawn_player(id)
{
    spawntime[id] = get_gametime();
}

public fw_takedamage_player(victim, inflictor, attacker, Float:damage, bits)
{
    if (is_user_alive(victim)) {
        new ent_name[32];
        entity_get_string(inflictor, EV_SZ_classname, ent_name, 32);
        if((equali(ent_name, "monster_tripmine")) && ((get_gametime() - spawntime[victim]) < get_pcvar_float(protectiontime)))
        {
            return HAM_SUPERCEDE;
        }
    }
    return HAM_IGNORED;
}

Keep in mind that this is my first attempt at writing code for amx so there might be some bugs, but I've tested it for a few days and everything seems alright. Cheers! :)


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 08 июн 2012, 18:05 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
Good job!


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 16 июл 2013, 16:04 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
vamp писал(а):
Изображение

Код:
#include <hl.inc>

public plugin_init()
   register_plugin("Crash fix", "1.0", "Lev")
   
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.
      new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));
      if (wepid == HLW_CROWBAR)
         return PLUGIN_HANDLED;
   }
   return PLUGIN_CONTINUE;
}

can anyone create this plugin that blocks dropping your crowbar with fakemeta or engine ?


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 16 июл 2013, 16:51 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
There is no real difference which module you will use.
In fakemeta you can use get_pdata_int in place of get_pdata_cbase in HAM.
Код:
#define EXTRAOFFSET      5
#define EXTRAOFFSET_WEAPONS   4
#define OFFSET_WEAPONID      30
#define OFFSET_ACTIVEITEM   306
stock hl_get_user_weapon_ent(client)
{
   return get_pdata_cbase(client, OFFSET_ACTIVEITEM, EXTRAOFFSET)
}
stock hl_get_weapon_id(entity)
{
   return get_pdata_int(entity, OFFSET_WEAPONID, EXTRAOFFSET_WEAPONS)
}


   new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));

So you just need this code. Replace get_pdata_cbase with get_pdata_int. If I am not wrong, it should work.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 16 июл 2013, 22:16 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
thanks for the fast response!
I will test after dinner.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 19 июл 2013, 04:14 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
Изображение

Код:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <hl>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Lev"

#define EXTRAOFFSET      5
#define EXTRAOFFSET_WEAPONS   4
#define OFFSET_WEAPONID      30
#define OFFSET_ACTIVEITEM   306


stock hl_get_user_weapon_ent(client)
{
   return get_pdata_int(client, OFFSET_ACTIVEITEM, EXTRAOFFSET)
}
stock hl_get_weapon_id(entity)
{
   return get_pdata_int(entity, OFFSET_WEAPONID, EXTRAOFFSET_WEAPONS)
}

   new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 19 июл 2013, 11:10 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
Oo
Did you just compile this? This is not a plugin. This is a sample code. You have to use it correctly.
hl.inc is not needed if you implement these functions in plugin.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 19 июл 2013, 12:11 
Не в сети
Зарегистрирован:
06 мар 2012, 02:42
Последнее посещение:
06 июл 2014, 01:42
Сообщения: 89
figured you would give me something as much :P


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Spawn Mine Protection + Server crash fix.
СообщениеДобавлено: 19 июл 2013, 14:05 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
11 июн 2024, 20:00
Сообщения: 6871
No, I gave least needed.


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

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


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

Сейчас этот форум просматривают: Google [Bot] и гости: 1


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

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